Jump to content
madrussian

addTorque and addForce

Recommended Posts

So I wrote an AI bombing script, using bombers to hit moving ground targets.

 

The bombers' waypoints are updated dynamically.  Most of the time the AI responds well enough flies the planes to their waypoints and drop their bombs at the right times, hit their targets, etc and everything looks great.

 

However, often enough the AI does not keep up with the waypoint's position updating, and these AI fail to turn their planes in time (for whatever reason).  Sometimes the AI is actually way behind, and don't really turn / fly towards their waypoints, which results in the planes being out of position and the bombs appearing to be "flung" towards their targets (which doesn't look good).  So I started using the addTorque command to torque the planes a bit (to simulate the AI turning correctly).  This completely fixes the issue, makes everything look perfect, and I'm very happy with the result!

 

The bad news is that the addTorque command does not work on planes from mods.  Specifically, every CUP plane I tried and every IFA3 plane I tried.  (Just tried a handful from each.)

 

I was curious if this issue had something to do with mass (or lack thereof).  So I checked mass via getMass command.  Turns out vanilla planes do have mass but mod planes do NOT have mass (getMass returns zero).  I figured I'd simply give mod planes mass via setMass and try addTorque again.  So now the mod planes have mass but still do not respond at all to addTorque.  Also checked and the mod planes don't respond to addForce either (where as the vanilla planes do respond to addForce).

 

Anyone know what's going on with addTorque and addForce on mod planes (why they have no effect)?  Any idea how to get these two commands working with mod planes?

 

(Btw- I welcome any and all help, even simply things I may have missed, thanks!)

Share this post


Link to post
Share on other sites

It is because most planes in mods use the old simulation="airplane"; and not the new physX "airplaneX". They are not compatible with physX commands.

  • Like 1

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×