Hey, guys! I’m looking forward to create tank mechanics like old resident evil games but I can’t make my player to rotate. I’ve been trying using this code but it doesn’t rotate very well.
void Player::HandleMovement()
{
horizontal = Input::GetAxisRaw(L"Horizontal");
vertical = Input::GetAxisRaw(L"Vertical");
Vector3 localDirection(0, 0, vertical);
localDirection.Normalize();
direction = localDirection;
Quaternion localRotation = Quaternion::Euler(0, horizontal * deltaTime, 0);
localRotation.Normalize();
rotation = localRotation;
playerRb->SetLinearVelocity(direction * speed);
playerRb->SetLocalOrientation(rotation * rotationSpeed);
}