How could we move or reset the vehicle in forward direction only?

I want to reset the vehicle in the forward direction whenever it falls off the track or gets turned in opposite direction. Please help me figure out the same. I have coded the following in trigger script whenever the vehicle is out of track but it not always gets reset properly facing in the forward direction.

    other.setLocalEulerAngles(0, 0, 0, 0);
    other.rigidbody.teleport(-3.5, 1, other.getLocalPosition().z, 0, 0, 0);

Below is the link to the test scene.
https://playcanvas.com/editor/scene/1626114

Hi @yash_mehrotra,

Did you figure this out? The project seems to be down/private and not accessible right now.

@Leonidas Yeah I have figured this out. You could close it.

1 Like