OpherV Posted August 27, 2014 Share Posted August 27, 2014 I'm using P2 and I have three boxes: "body", "left wing" and "right wing". The wing boxes are connected to the body using a hinge joint. The physics world has no gravity. I'm attempting to rotate the wings around their hinge connection, as if the joint is motorized but I'm not exactly sure how to achieve that. If I exert force with a downward vector on the center of the wings, the body itself flies down. This is undesirable. With an actual hinge motor, only the wings will rotate about the hinge, affecting the body only when they hit it. Which forces should be added to the wings, and at which origin points? Link to comment Share on other sites More sharing options...
schteppe Posted August 28, 2014 Share Posted August 28, 2014 To make things simpler, how about enabling the motor on the constraint?constraint.enableMotor();constraint.setMotorSpeed(1);See the docs for p2.RevoluteConstraint http://schteppe.github.io/p2.js/docs/classes/RevoluteConstraint.htmlOr one of the demos http://schteppe.github.io/p2.js/demos/car.html tidelake 1 Link to comment Share on other sites More sharing options...
OpherV Posted August 28, 2014 Author Share Posted August 28, 2014 Schteppe - I have no idea how I missed that.Looks like I was trying to literally and figuratively reinvent the wheel Thanks! Link to comment Share on other sites More sharing options...
OpherV Posted August 28, 2014 Author Share Posted August 28, 2014 How do I get the motor to turn counter-clockwise though? Setting the motorSpeed to a negative value doesn't seem to help? Scratch that Link to comment Share on other sites More sharing options...
Recommended Posts