If actor is going right direction of Object Transform

Hi,

what you can try is:

  1. Get the forward vector of you vehicle
  2. Calculate the normalized direction between vehicle and check point
  3. Get the difference between vehicle direction and waypoint direction

Now I can image two methods I would try

  1. If they point in the same direction then the Y should be positive if the point in different directions than the Y should be negative
  2. If the dot product is greater zero then they should point in the same direction

Havent tried it just a few thoughts on it. I added an image to visualize what I’m talking about. Probably I’m wrong. So see this as base of discussion :). (Because I’m not on a pc with unreal engine access to test it)

freakxnet

Hello. I’ve looked at countless examples of getting the angle between 2 vectors or finding Look at Rotation from pawn to object but I’m just not able to make this work. I have a vehicle and a checkpoint system and I’m trying to determine if the vehicle is going towards the next checkpoint. If not, a Wrong Way notification will play.

I have a variable called “Path Vector” which contains the position of the next checkpoint. It’s prints out the position on screen of the next checkpoint once I clear one, it does this for each checkpoint I pass through. I need to use the current player position and check if I’m moving towards the “Patch Vector”. This is what I have so far.

This is on a tick event so if the player is facing towards the next checkpoint, nothing or the animation will stay diabled. If False where the player is not facing in the general area of the next checkpoint, or is going in reverse, the wrong way notification will play.

Any help appreciated.

What this currently does is play the notification only if a) Car is going in reverse, or b) car faces X or Z positions. It’s pointing in the Y position either positive or negative direction, it thinks it’s going in the right direction. It’s seems the Path Vector position does not have any impact.

Thanks for the response. I Understand where your going with it and have it myself before however I may be doing it wrong though as I’m still very new to all this. The reason I was using the velocity what so it would pick up that your going the wrong way by reversing. Hopefully someone could post a sample blueprint.

I think this would be much better solution. Will try it out. Thanks!

Another solution could be:

Get the distance between player and waypoint. The distance should decrease over time. If the distance increases then the player cleary drives in the wrong direction.