Jump to content

Velocity of Players


photo

Recommended Posts

Hi All,

 

I have getting strange behaviour with velocities of PlayerSpecators. The getVelocity() call does not appear to return the players actual velocity when navigating the player in editor mode. It returns a scaled magnitude that is inconsistant with the actual positions when navigating the player via keys.

 

I have tried to attach the PlayerSpecator to the editor using engine.editor.setPlayer to however the Min velocity and Max velocity inputs do not alter the magnitude of the return velocity.

 

Any suggestions on how i can reliably get the velocity of PlayerSpecators or do i have to calculate it myself?

Link to comment
  • 3 weeks later...

The trick is, the editor camera is handled differently than standard players. Editor player ignores settings set to it via the script; instead, it uses Camera parameters set via the interface, for example, so that artists can change camera settings on the fly. This settings are saved/loaded from the configuration file.

 

Check data/core/editor folder for editor scripts. Instead of using PlayerSpactator::setMinVelocity(), the editor camera uses Tools::toolsGetCameraMinVelocity().

 

Any suggestions on how i can reliably get the velocity of PlayerSpecators or do i have to calculate it myself?

Editor player velocity is calculated in editor_controls.h (see Controls::control()). As Player::getVelocity() won't do, you'd need to modify the editor code if you want access it directly.

 

I've added info on different implementation of the editor player into engine.editor.setPlayer() description to avoid any confusion.

Link to comment
×
×
  • Create New...