Hey,
I am want trying to create a rotating bridge for my marble rolling game.
The bridge is rotating 90 degree under 0.5 seconds, then waits 2 seconds, and rotate 90 degrees again. And it is doing it the whole time. I am rotating it with transform.rotate (but my marble has a rigidbody, and moves by force)
But when I want my marble to stay on the bridge, and rotate with it, I am having troubles.
Here is how I set it up:
There is the bridge, with a box collider, and a slightly smaller triggerer child above it.
The bridge has the rotating script, and the triggerer has the following script:
var stickMain : stickRot;
var playerM : GameObject;
var player : GameObject;
function OnTriggerEnter (other : Collider)
{
if (other.tag == "Player")
{
player.transform.parent = stickMain.transform;
}
}
function OnTriggerExit (other : Collider)
{
if (other.tag == "Player")
{
player.transform.parent = playerM.transform;
}
}
This setup does not work as excepted. Most of the time, “artifacts” appear, like the scale of the marble changes, or the marble teleports to the other side of the bridge. But sometimes, when the marble is entering the bridge slowly, it works.
I am looking for suggestion/ideas for this problem.
Thank you for you help!