Game Development Community

What can prevent setConstantForcePolar?

by Drethon · in Torque Game Builder · 05/23/2009 (7:04 pm) · 4 replies

Some change I made stopped my game objects from moving with setConstantForcePolar, I've confirmed the inputs are a valid rotation and a force of 55. I've checked through all my changes (I'm using subversion...) and nothing makes sense as something that would affect this.

Any suggestions as to where I should be looking?

#1
05/26/2009 (9:43 pm)
a look at the actual code you used to apply teh polar force would be great, so we could see whats going on.
#2
05/27/2009 (5:43 am)
function Spaceship::onUpdate(%this)
{

  // Rotate ship

  setConstantForcePolar ( %this.getRotation() , 55 ) ;
}
#3
05/27/2009 (9:58 pm)
ok...your code should look like this:
function Spacehip::onUpdate(%this)
{
     %this.setConstantForcePolar(%this.getRotation(), 55);
}

you where trying to use the function w/o referencing the object in which you were tryin to apply the force onto...

now, be carefull, cuz you're doing that like 60 times a second, you should consider doing it somethin like 10 times a sec. at most.... also, dont even consider adding heavy calculation on a function that runs every tick... that will kill your game's performance big time.
#4
05/28/2009 (5:26 am)
That was actually a typo, sorry. I found the issue was I had added mass to the ship without realizing that had an affect on how it moved. As a result of the additional mass I needed to increase the force drastically...

For the moment I'm not worried about the performance hit, just about making features work. I'm planning on moving the action from the ship to the engine and using a timer on the engine to add its effect to the ship...