
So I have two rigid body 2D objects. The blue box is dynamic, the pink rectangle is kinematic, and can be controlled to move left and right. The box falls on the rectangle and collides fine. My issue is when I’m moving the rectangle left and right, the box doesn’t follow along. Instead it just stays still. I tried adding friction with no help. I am using translate to move the rectangle:
transform.Translate(new Vector3(-0.1f, 0, 0));
What am I missing to achieve this??
system
2
Make the box a child of the platform while it on it. You can accomplish this by shooting a short ray down from the bottom of your cube and seeing if it hits a layer you only put platforms on.
It seems to be working better moving the rigidbody’s velocity instead of its transform:
rb.velocity = new Vector3(-2f, 0, 0);
Now the cubes follow the platform as it moves around.