I am trying to use revolute joints in node.js server, but my wheel is not turining around its own axis but around body.
Here is my code:
var joint_def = new b2RevoluteJointDef();
joint_def.Initialize(this.body , wheel, wheel.GetWorldCenter());
//after enablemotor , setmotorspeed is used to make the joins rotate , remember!
joint_def.enableMotor = true;
joint_def.maxMotorTorque = 100000;
//this will prevent spinning of wheels when hit by something strong
joint_def.enableLimit = true;
joint_def.lowerAngle = -1 * max_steer_angle;
joint_def.upperAngle = max_steer_angle;
this.joint = world.CreateJoint(joint_def);
Then when i press button up i set motor speed like this:
this.joint.SetMotorSpeed(10000);
And wheel start rotation around the center of the body, but i want to rotate around it's own center.
This are the settings of body and wheel :
'density' : 1.0 ,
'friction' : 0.0 ,
'restitution' : 0.2 ,
'linearDamping' : 0.0 ,
'angularDamping' : 0.0 ,
'gravityScale' : 1.0 ,
'type' : b2Body.b2_dynamicBody
What am i doing wrong ? Or maybe i should use different box2d implementation. I am using box2d from: https://www.npmjs.com/package/box2dweb