Hello all,
Sorry to bother you with this one, but I was wondering if someone could spare the time to explain motors to a newbie like me who has very little physics knowledge 🙂
I'm currently trying to just work out what each of the properties of the motor actually does, but the documentation mainly just uses the name in a sentence and I can't seem to find any explained 'examples' of code (Google has failed me yet again *sigh* lol)
I am using the following code to rotate a triangular object about its centre:
var jointDef:b2RevoluteJointDef = new b2RevoluteJointDef();
//Attach the triangle to the background
jointDef.Initialize(gameWorld.GetGroundBody(), rotatingTriangle, rotatingTriangle.GetWorldCenter());
jointDef.maxMotorTorque = 5;
jointDef.motorSpeed = 1.5;
jointDef.enableMotor = true;
var jointInWorld:b2RevoluteJoint = gameWorld.CreateJoint(jointDef) as b2RevoluteJoint;
I had initially thought that maxMotorTorque would restrict the speed at with the object could 'spin' (torque is something to do with spinning right? :/ ) but this doesn't seem to be the case and the object keeps gradually getting faster after a very slow start. What I'd really like is for the object to spin at a set pace regardless of other objects bouncing off it (it seems to slow down/speed up when hit from different angles) and only rotate at a set speed, not continually speed up. What is the best way to do this? I've been digging about for days trying to get an explanation of this stuff that I can understand haha I'm really regretting not taking Physics at school now 😕
Sorry to bother you with this one, but I was wondering if someone could spare the time to explain motors to a newbie like me who has very little physics knowledge 🙂
I'm currently trying to just work out what each of the properties of the motor actually does, but the documentation mainly just uses the name in a sentence and I can't seem to find any explained 'examples' of code (Google has failed me yet again *sigh* lol)
I am using the following code to rotate a triangular object about its centre:
var jointDef:b2RevoluteJointDef = new b2RevoluteJointDef();
//Attach the triangle to the background
jointDef.Initialize(gameWorld.GetGroundBody(), rotatingTriangle, rotatingTriangle.GetWorldCenter());
jointDef.maxMotorTorque = 5;
jointDef.motorSpeed = 1.5;
jointDef.enableMotor = true;
var jointInWorld:b2RevoluteJoint = gameWorld.CreateJoint(jointDef) as b2RevoluteJoint;
I had initially thought that maxMotorTorque would restrict the speed at with the object could 'spin' (torque is something to do with spinning right? :/ ) but this doesn't seem to be the case and the object keeps gradually getting faster after a very slow start. What I'd really like is for the object to spin at a set pace regardless of other objects bouncing off it (it seems to slow down/speed up when hit from different angles) and only rotate at a set speed, not continually speed up. What is the best way to do this? I've been digging about for days trying to get an explanation of this stuff that I can understand haha I'm really regretting not taking Physics at school now 😕