0 votes
by
retagged by
Just resetting the rigidbody.velocity and rigidbody.angularVelocity doesn't do the trick. Is there a function I can call to reset everything?

1 Answer

0 votes
by

Reposition the vehicle only:

vehicleController.Reposition (newPosition, newRotation)

Reposition the vehicle and cancel any motion:

vehicleController.HardReposition (newPosition, newRotation)

Reposition the vehicle, cancel any motion and restart the vehicle dynamics:

vehicleController.HardReposition (newPosition, newRotation, true)
by
I have noticed that about 50% of the attempts, the car does not move to the specified location. Any idea what causes can produce this behavior?

            Vector3 pos = servicePositionGO.transform.position;
            Quaternion rot = servicePositionGO.transform.rotation;
            rot *= Quaternion.Euler(Vector3.up * 90);
            controller.Reposition(pos, rot);
            controller.gameObject.transform.Translate(Vector3.forward * 1);

Also, is HardReposition deprecated or is it not in the community version?
Thanks,
Joan
by
It works fine here, at least when called from the Update loop (i.e. on key pressed).

HardReposition is also available in the Community Edition. Maybe you're using an old version?
by
I wasn't using it from the update loop. Let's check it out. Thank you
...