Home Game Development 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

0
unity – When I rotate a recreation object, it retains transferring the identical course

[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]

LEAVE A REPLY

Please enter your comment!
Please enter your name here