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