Author Topic: Why does set-object-speed use world coordinates?  (Read 1625 times)

0 Members and 1 Guest are viewing this topic.

Offline General Battuta

  • Poe's Law In Action
  • 214
  • i wonder when my postcount will exceed my iq
Why does set-object-speed use world coordinates?
Any way we can get local coordinates as an argument? Setting the 'subjective' field to true doesn't seem to do it (in fact I'm not sure what that field does.)

 

Offline Iss Mneur

  • 210
  • TODO:
Re: Why does set-object-speed use world coordinates?
Because nobody has posted, I figured I should reiterate (and possibly add to), for the record, what I told General Battuta last night.

I have checked the code that is being used by the set-object-speed-* sexps, and as far as I can tell there is no reason that the sexps should not work as described, excepting the issue that caused Battuta to post this (which I describe below).

As for the meaning of subjective, it changes the way that the sexp applies the speed change.  When subjective is false, or not defined, the set-object-speed-* sexps set the object's speed on the universe grid (that is, the grid that you see in FRED).  Whereas when subjective is true, the sexp(s) set the objects speed adjusted for the object orientation.  That is, when subjective is true, set-object-speed-z (for example) sets the objects speed in the direction that it is facing. Whereas when subjective is false, it sets the objects speed in the z-axis of the universe grid1.

This means there is almost no reason to set subjective to anything but true.



As for the instance that General Battuta is having trouble with, slowing a ship down as it comes out of warp.  This seems to be caused by the fact that when a ship is warped in, it is forced to travel two ship radii2 (at warpout/warpin speed)3 before the normal game physics engine is allowed to affect the ship.  Keep in mind that these details apply only to the default and knossos warptype (though the other warptypes have similar restrictions).

Where this causes a problem is that set-object-speed-* operates directly on the ships velocity vector, which assumes that physics are working normally.  This results in the ship speed on the HUD being indicated correctly (as set by the set-object-speed-*), but the ship continuing to move as warpin speed because the engine is ignoring the standard physics and thus, ignoring the velocity vector.  This results in set-object-speed-* appearing to do nothing, while the ship is warping in.



1) Which is the default axis you are looking down when you startup FRED.
2) Seemingly one radius on each side of the fireball. Remember that the ship is spawned and exists before it is moved through the fireball.
3) Though it is actually defined as travelling at warpin/warpout speed for enough time to travel two ship radii.
"I love deadlines. I like the whooshing sound they make as they fly by." -Douglas Adams
wxLauncher 0.9.4 public beta (now with no config file editing for FRED) | wxLauncher 2.0 Request for Comments

 

Offline Backslash

  • 29
  • Bring Our Might To Bear
Re: Why does set-object-speed use world coordinates?
One other thing.  If you ever use a set-object-speed-z sexp and wonder why the frak the ship isn't moving, you may need to use $use_newtonian_dampening:.  The reason is without this flag, Z damping is 0, which means the ship's Z speed instantly changes back to its natural state (throttle or whatever).

 

Offline Iss Mneur

  • 210
  • TODO:
Re: Why does set-object-speed use world coordinates?
One other thing.  If you ever use a set-object-speed-z sexp and wonder why the frak the ship isn't moving, you may need to use $use_newtonian_dampening:.  The reason is without this flag, Z damping is 0, which means the ship's Z speed instantly changes back to its natural state (throttle or whatever).
Oooh, yet another "feature" that would have broken Battuta's plans :P
"I love deadlines. I like the whooshing sound they make as they fly by." -Douglas Adams
wxLauncher 0.9.4 public beta (now with no config file editing for FRED) | wxLauncher 2.0 Request for Comments

 

Offline General Battuta

  • Poe's Law In Action
  • 214
  • i wonder when my postcount will exceed my iq
Re: Why does set-object-speed use world coordinates?
Quite so. Poor, poor Battuta.

Thank you kind souls for educating me; I'm in your debt.

  

Offline Sushi

  • Art Critic
  • 211
Re: Why does set-object-speed use world coordinates?
One other thing.  If you ever use a set-object-speed-z sexp and wonder why the frak the ship isn't moving, you may need to use $use_newtonian_dampening:.  The reason is without this flag, Z damping is 0, which means the ship's Z speed instantly changes back to its natural state (throttle or whatever).

Basically, it's a magic "make physics work the way you'd think it does" flag. :p Unfortunately, there are other random exceptions, such as the warp-in physics already mentioned...