- Home /
Bike body rotates in opposite direction than wheels
Ok I have impulse button for my bike which should rotate the bike around it's center (like elasto mania), but when i do so when facing left side of screen the wheels rotate in opposite direction than body. When facing right side it is just fine.
EDIT: I noticed that the wheel rotates clockwise when i add torque and it's facing left, but still moves to the left like it's rotating counter-clockwise... Odd.
Latest EDIT: I still need some help... It seems like the model is wrong way but nothing helps
Here's the rotating code that changes facing:
function getAround(){
var joints = GetComponents(SpringJoint2D);
for(var joint: SpringJoint2D in joints){
var temp = joint.anchor;
joint.anchor = Vector2(-temp.x,temp.y);
}
//var temp = object;
//var temp2 = object2;
//object = temp2;
//object2 = temp;
runko.rigidbody2D.isKinematic = true;
object.rigidbody2D.isKinematic = true;
object2.rigidbody2D.isKinematic = true;
runko.transform.Rotate(Vector3(0,1,0), 180);
runko.rigidbody2D.isKinematic = false;
object.rigidbody2D.isKinematic = false;
object2.rigidbody2D.isKinematic = false;
facing = vaihto(facing);
}
And here demonstration of the problem:
Answer by Klarax · Feb 03, 2014 at 02:29 PM
Do you have a parent for this bike? if not do so, and parent the bike to it. Then use that parent to rotate. might be the model forward axis set to y and not z.
wrapper.transform.Rotate(Vector3(0,1,0),180);
i tried this but the problem persists
The model should be fine there is 3 more gameobjects attached to it and they rotate with the body
The 3 other objects are indeed rotated wrong way but how can I fix that? one is particle system and one is a light
Your answer
Follow this Question
Related Questions
the player is flying off the ramp (collider) 1 Answer
Prevent gameobjects from overlapping - 2D 0 Answers
How to freeze all enemy objects at once 1 Answer
Rigidbody2D.velocity out of controll 3 Answers