- Home /
Moving a rock with 2D physics
So i'm trying to move a rock that i made (a 2D sprite) by making a character push it. The character is made up of a rigid body and a box and a circle collider while the rock is a circle collider and a rigid body.
The rock moves just fine but the character is rotating with it. I want the character to just stand put on the ground and not move up along the edge of the rock when the rock is rotating. I hope my problem makes sense ^^ I have not been able to find a solution yet, but im guessing the problem is with my character. It would be great to get an answer!
/Eluthion
Answer by NextGenGames · Dec 08, 2014 at 02:04 AM
You could try to define the Z rotation to equal zero.
Make a new script.
Here is some code you should try, simple but effective.
#pragma strict
//Javascript
function Update();{
rotation.z = 0;
}
I would also check Fixed Angle in the rigidbody 2D component.