Eric Posted January 4, 2013 Share Posted January 4, 2013 Does anyone have some insight on turning a model using the command AddBodyTorque to point in the direction the Model is moving. Thanks for any help, Eric Quote Link to comment Share on other sites More sharing options...
cassius Posted January 5, 2013 Share Posted January 5, 2013 RotateEntity? Is it your main character. More info would help. Quote amd quad core 4 ghz / geforce 660 ti 2gb / win 10 Blender,gimp,silo2,ac3d,,audacity,Hexagon / using c++ Link to comment Share on other sites More sharing options...
Josh Posted January 5, 2013 Share Posted January 5, 2013 Use this to calculate the omega (rotational velocity) then multiply that by the mass to get the torque you need: http://www.leadwerks.com/werkspace/page/Documentation/le2/_/command-reference/bodies/calcbodyomega-r52 Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Eric Posted January 5, 2013 Author Share Posted January 5, 2013 Yes I'm looking at those commands but what I can't figure out is what to put in the CalcbodyOmega Rotation field .... If I am applying a force and my Model starts to move, how do I know what information to enter in the rotation vector to make sure it points in the direction of movement? Thanks, Eric Quote Link to comment Share on other sites More sharing options...
DaDonik Posted January 5, 2013 Share Posted January 5, 2013 The easiest way is to have two TPivot's that you use to get the desired rotation. Position one pivot right where your model is and the other at the place you want to look at. Let the first pivot point at the second one and then get the rotation from your first pivot. Now use that rotation in CalcBodyOmega and you are done. Quote (Win7 64bit) && (i7 3770K @ 3,5ghz) && (16gb DDR3 @ 1600mhz) && (Geforce660TI) Link to comment Share on other sites More sharing options...
Josh Posted January 5, 2013 Share Posted January 5, 2013 Is this a character walking? If so, I would use the character controller. If the model only rotates on the XZ plane, an ATan2 operation will get the yaw angle from a normalized vector. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Eric Posted January 6, 2013 Author Share Posted January 6, 2013 Ok once I have the Yaw Angle.. Which I Do... How do I use the AddBodyTorque and CalcBodyOmega to turn the Model only on the Y Axis to face the calculated Yaw Angle... Nothing I seem to Try Works float Angle=atan2(Position.X-PreviousPos.X,Position.Z-PreviousPos.Z) * 180 / PI; AddBodyTorque(Model,CalcBodyOmega(Model,Vec3(0,Angle,0))*ModelMass,0); This is my latest try...but I'm getting something wrong. Is this the right way to Apply Torque only on the Y axis? Thanks, Eric Quote Link to comment Share on other sites More sharing options...
Eric Posted January 6, 2013 Author Share Posted January 6, 2013 Got it... Whew!! AddBodyTorque(Model,Vec3(0,CalcBodyOmega(Model,Vec3(0,Angle,0)).Y*10000,0),0); 2 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.