Jump to content

[SOLVED] SetPhiAngle and WorldPosition bug


photo

Recommended Posts

Hi,

I’m looking to implement player controls for movement and rotation without using the current states implemented in the engine due to only taking ints I want more control over the movement and rotation. I’m currently using a Player Spectator.

I’ve encountered and issue when setting the Phi rotation value when setting the player spectator world transformation in the same frame. I’ve recreated the issue in a blank project which I have attached.

 

Recreation steps:

·         Set player spectator world position in the update function.

·         Set player spectator Phi rotation to 0 each frame (for real project this is set by player input)

·         Run project

 

I would expect the player rotation to remain at 0, using GetPhiRotation shows it is still 0 but the player appears to rotation very quickly as shown in the example project.

The example project code is in the AppWorldLogic.cs

Is this a bug? Is there a way using this method to get the result I would expect?

testrotation.zip

Link to comment

Problems Solved. I was looking over the documentation for the player actor: https://developer.unigine.com/en/docs/2.6/objects/players/actor/ which has the following note:

"Notice

As any transformation of a player forces it to recalculate its inner state (position, direction, angles and so on), the updirection of the player's viewport may become "negative forward". And then transformation will be recalculated by using this direction, causing flip of the player's basis. To avoid such flipping, the theta and phi angles should be recalculated by using the current viewing orientation of the player."
 
The documentation for the Player Spectator doesn't have this notice: https://developer.unigine.com/en/docs/2.6/objects/players/spectator/ 
 
After resetting the Direction after the transformation it appears to work as intended.
Link to comment
  • silent changed the title to [SOLVED] SetPhiAngle and WorldPosition bug
×
×
  • Create New...