Hello there everyone, i am currently having a bit of trouble with making a target and spell trace system i am currently making a single player game with the WoW spell system, lock on to a target and trace a line between you and the target. and once a spell is cast it will follow the trace/vector to the enemy, i am having quite some problems making the trace line from me to AI, i have a sphere in my Character BP that is gonna be used for range limiting (hopefuly) any advice/instructiobs on how to do this would be fantastic! (can post screenshots if anything is needed)
Hi,
To make an object follow a target until it touch it you can:
-
spawn an actor at start location with rotation from start Location to target location.
-
In eventTick (float deltaTime), you move your actor by
FVector TargetDirection = Target->GetActorLocation () - GetActorLocation ();
TargetDirection.Normalize () //Don’t forget this line
FVector newLocation = GetActorLocation () + TargetDirection * Velocity
Don’t forget rotation, the same way.
3 When you are close from target or OnOverlapActor Active your spell effect
It is c++ style but the same functions exist in blueprint