Hello Unity community !
I want a sphere which moove in direction of camera forward.
That work but when the speed is too high, the drift effect is too strong.
When i turn my camera to the right, the sphere need a couple of second to move on camera.forward.
The huge problem is to compensate the forces, when you turn, to obtain a more reactive gameplay.
Im trying to compensate that with the if(), when cam.transform.forward.x between 0 and 1 we turn to the right, if i increase the force value maybe i can compensate the centrifugal effect.
I have also try Force.Impulse mode
// This script is on my sphere player
void FixedUpdate ()
{
Vector3 mouvment = cam.transform.forward;
if(cam.transform.forward.x != 0) // right if positive, else left
{
rigidbody.AddForce(new Vector3(mouvment.x*30,0,1));
}
rigidbody.AddForce(mouvment * speed * Time.deltaTime);
}
Thanks !
↧