Getting the Z Rotation of an Actor on the Ground

Hi Everyone,

I’m currently trying to get the Z rotation of an actor on the ground but when I use Get Actor Rotation it always returns a value of 0. If I make the actor fly it works as it should and gives me the correct angle (pitch). This is for a mod for Ark: Survival Evolved by the way. I’m trying to raise or lower the amount of time it takes to reach maximum run speed on the larger dinos depending on the slope of the ground that they are running on. If they go uphill it takes longer to reach max speed and vice versa.

What nodes can I use to achieve this? I really just want to get an angle to work with so that I can plug it into my formula and speed things up or slow things down. I’ve also tried to get the angle using Get Actor Forward Vector and Get Actor Up Vector, normalizing both, sending them to a Dot Product node, and then running them through a ACOSd node, but that constantly gives me 90 on the return value.

I’ve been wondering about trying to get the angle between the actor’s current location and their last location from the frame before while the actor is moving but I’ve not been able to figure out how to do that. Are there any better ways to get the angle of the slope that the actor is traveling over?

Thanks.

For the first bit I think you need GetControlRotation.

For the second part, the angle between the actor and the ground will be 90 otherwise they would look weird moving up or down a slope.

The angle between forward and up will also always be 90.

Your idea about dot product and aCOS is the right one, just do the sum between the actor’s forward vector and the forward vector of anything that is not on a slope.

The incline of the character is given by the formula below, here I’ve done it with the first person camera:

You would use GetActorRotation.

Thank you for the reply.

Unfortunately I’m still having trouble understanding this. Doesn’t GetControlRotation use the camera angle to get its values? I’d like to avoid that and instead use the actor’s body angle because they may be looking around in different directions.

I think what’s breaking all of this is that when the actor is moving on the ground it automatically sets the GetActorRotation and GetActorForwardVector nodes to 0 for the Z value, which as far as I can tell makes them both useless for my needs as I’m basically trying to find the pitch of the actor’s body. You said above that I should use the actor’s forward vector and the forward vector of anything that is not on a slope. What could I use as the other thing?

Hi, Sorry for the delay, best to use the quotes, otherwise I don’t get a notification.

Have you tried that code. In fact, I just used two copies of the forwarrd vector, and not another object.

The code works, I have used it.