Download

Get velocity - coming or going.

I’m looking to express if an object is moving at or away from another.

So if physics object is moving away from player it would yield a negative result but coming at the player a positive

So far I’ve been getting both objects velocity and subtracting them.

So if object is moving in X axis +100mph and player is behind it moving +110mph and eventually reaches the object, it would only return a positive if the player stepped past it so the object, as is then moving a positive at the players location.

Likewise if the object is standing still when the player reaches it. It would yield 0 because it’s not moving.

Thus the expression could be

Hit bool true if relative speed is >= 0

In context this is to prevent ones own projectile to be spawned from player but without using a delay etc to account for any lag it will not collide with the player as it is spawning at the players speed plus atleast a little more velocity.

One approach to avoid colliding with the player is to use collision channels.

Well I figured out pretty much what I need.

Actor location - other actor location = A
Actor velocity - other velocity
Dot prod of a and b