Hello everyone, I want to Move my character to Cube Actor’s location but I don’t want it to be so close, so I subtracted the Cube’s location by 150 units it worked but there is an issue here, I want my character to stay away from the cube 150 units from its location or direction. but it always from to a specific location of the cube.
basically, i want my character to get close to the cube’s location, and stop when it reaches 150 units
The (Vector - float) math node is some kind of hybrid, that will convert float into a vector (x=150,y=150,z=150) in your case. This absolute vector is always the same, so it will always move to the same point relative to the cube’s location.
What you want to do is substract 150 units in the character-to-cube direction. First you need to find the direction, which you can achieve by doing subtracting character location from cube’s location and normalizing the result, like so :
(Cube.GetActorLocation - Self.GetActorLocation) → GetSafeNormal
The result vector is a one-unit vector with a direction that points from character to cube. Multiply that by 150 and you have your offset. Subtract that offest from cube’s location and it should do the trick.
So in the end something like this :
Cube.GetActorLocation - ((Cube.GetActorLocation - Self.GetActorLocation)->GetSafeNormal * 150)