- Home /
treadmill/moving platform - moving Objects by colliding on a platform to the direction of the platform
Hello.
I'm new to game dev and unity maybe that is why this is so hard for me.
I'm trying to build a moving platform in 3D similar to the treadmill concept but for a factory.
my current code, move the items that Hit the platform to the right of the (ITEM) not the platform .. I know that because when i rotate the "item" or change it's direction, it starts moving in a different direction than that of the platform's
void OnCollisionStay(Collision collision) { collision.collider.transform.Translate(this.transform.right * Time.deltaTime); }
this code is on the platform that is supposed to move the collided objects to the X axis of the platform that is not what is happening, it moves the "items" ( collided objects ) to the collided objects's X-axis so it's currently moving based on the collider's direction no the platform.
it seems to be quite simple, could anyone help?
Your answer
![](https://koobas.hobune.stream/wayback/20220612235821im_/https://answers.unity.com/themes/thub/images/avi.jpg)