- Home /
Moving platform tearing
Hello,
I have created a moving platform. It is made from parts, so it is not a single object. I have applied them to an empty game object, so it is their parent. I am moving the parent object, but the platform is not moving smootly.
Is it because I am not moving the directly, but moving their parent object? If it is the problem, is there any way to fix it?
Update: Here is the code I have wrote to test the up and down movement.
var ok : boolean = false;
var ok2 : boolean = false;
function Start ()
{
Test();
}
function FixedUpdate()
{
if (ok)
{
transform.Translate(Vector3.up * 2 * Time.deltaTime);
}
if (ok2)
{
transform.Translate(Vector3.down * 3 * Time.deltaTime);
}
}
function Test()
{
yield WaitForSeconds(5);
ok = true;
yield WaitForSeconds(5);
ok = false;
yield WaitForSeconds(1);
ok2 = true;
yield WaitForSeconds(5);
ok2 = false;
}
care to share some of the code doing this? usually when I group things to a parent, there is no problem with smooth movement.
I have updated my post with the code. However, I have found out the problem. I have used FixedUpdate, because my game is physics driven, however the platform is using transform. So I have changed it to Update, and it is working fine now.
Are the child objects simply colliders? I've seen some interesting jiggling when hinged objects with rigidbodies (for example) are moved outside of physics (which is what translate does.)