Hey there,
I’m currently struggling on Rotating my pawn according to a given vector in Blueprints.
This Vector represents gravity in my prototype. Normal gravity is represented by Z = -1. Gravity Towards the ceiling would be Z=1, towards a Wall X = 1 /-1 or Y = 1 / -1.
My Custom Gravity is already working, Movement too (except the need of a few additions like not moving in the air, but that’s not part of my problem).
Now I would like to rotate my Pawn accordingly, so it’s feet are facing towards the gravity, but I’m struggling hard understanding how to make a correct rotation out of this vector
It’s for a Pawn. I already tried out “Set Actor Rotation” triggered by a key and by setting a fixed rotation which is working as intended.
But for getting the correct rotation from the vector, I’m still struggling.
No, I trigger a gravity change via button, so (x=0,y=1,z=-1) becomes for example (x=1,y=0,z=0)
That is already working, but I need to rotate the pawn correctly, so it looks like the level has rotated around the player
Thanks for that
Got it working by adding rotation manually to the Pawn, but I had to add a few more things, so also 180° turns when changing for example from (x=0, y=y, z=-1) to (x=0, y=0, z=1) are covered. But I would also like to add more angles, then I can’t work that way. At least not when the blueprint should be still readably.
That’s why I try to achieve to get the rotation out of the vector.
Currently, I change the gravity direction vector by aiming at a wall.
Then it creates a new gravity direction vector by doing a line trace and using the impact normal, which determines the gravity in my level and “pulls” my pawn in the direction of this gravity.
Now I’m using “make Rot from Z” with my gravity Vector * -1 and use that rotation with “Set Actor Rotation”.
Alway thought the solution has to be a lot more complex, maybe that’s why my tries never worked