Actor moves towards the wrong axis in UnrealEngine

50 Views Asked by At

I am trying to run the airsim drone inside an unreal engine environment.After placing the actor start position on a custom environment for my drone and rotating the drone towards the way I want it to face, the orientation is all messed up during my runs. The drone moves towards the global coordinates of the environment and not the local ones I am setting. Is there any way to preset the axis and orientation of the actor? I moved the pivot and rotated the actor making the axis and the orientation aligned inside unreal engine, saved and packaged the project but after I run my scripts it still moves towards the global axis of the custom environment. The picture shows the axis and rotation before and after the alignment, thank you in advance for any kind of help!

rotation I want with the global coordinates,

aligned rotation and axis the way i want them but doesnt change during the run

1

There are 1 best solutions below

2
On

You need to work on following topics in order to address the issue permenantly.

  • Euler Rotations (Understand Gimball Lock, Order of Rotation Problem)
  • Quarternions (Always have true rotations)
  • Coordinate Spaces

First things first its a standard behavior and you dont need to modify it. Understanding World Coordinate Space and Component Coordinate space is important here. (Also between your two images, you are swapping it) When you move character or pawn its moving over World Space, input calculations done in the same space. So when you give X axis, your character moves over Forward Vector. So dont play with orientation of character blueprint, when the mesh comes allign it with capsule and take reference turquise arrow make arrangements based on that.