![unity – When I rotate a recreation object, it retains transferring the identical course unity – When I rotate a recreation object, it retains transferring the identical course](https://thefuntrove.com/wp-content/uploads/https://cdn.sstatic.net/Sites/gamedev/Img/apple-touch-icon@2.png?v=9bca23db2259)
[ad_1]
When I attempt to rotate my recreation object, it retains transferring in identical course. I feel there may be fairly fundamental resolution however could not determine it out.
Here is my code:
non-public void Move()
{
rb.velocity = new Vector3( rb.velocity.x, rb.velocity.y, pace * forwardSpeedMultiplier * Time.deltaTime );
float xVelocity = horizontalInput * speedMultiplier * horizontalSpeed * Time.deltaTime;
float yVelocity = -verticalInput * speedMultiplier * verticalSpeed * Time.deltaTime;
rb.velocity = Vector3.Lerp(rb.velocity,
new Vector3(xVelocity, yVelocity, rb.velocity.z),
Time.deltaTime * smoothness);
}
Note that I’m utilizing a rigidbody to maneuver it.
I attempt to add + rework.ahead
to the primary line. It sort of works nevertheless it messes up the pace.
I do know that is in all probability fundamental query however nonetheless would recognize the assistance.
[ad_2]