Finding the rotation of my vehicle relative to an actor

I have been trying to create an actor which checks the direction a player is driving in inside of an area. I am trying to punish the player for driving on the wrong side of the road.

I am able to get the rotation of the vehicle but it’s rotation is relative to the world and not this actor. This isn’t letting me rotate the actor to follow roads in my project.

Is there a way to get the rotation of a vehicle (player pawn) relative to the actor?


(The box on the left side of the road is rotated 180 degrees but still acts the same as the box on the right).

Is this all in the level BP?

If so, then you can find the relative rotation with

image

You can use a dot product here, getting the forward vector of the trigger and the forward of the car you can easily get the result if the both vectors are similar or opposite. granted the triggers are rotated correctly respective to the direction you want to go in.

1 Like

I had been making it in the trigger box blueprint.
I’m sorry I don’t have a screenshot of the blueprint right now, its on a pc I won’t have access to til wednesday.

Thankyou for the advice anyway, will make sure to use this.

1 Like