Heya!
Let’s cut straight to the chase;
I want some enemies in my tower defense game to be able to let’s say “look” in the direction and idk create a hitbox part into the direction (facing it) where they’re moving on the path. The thing is, enemy positions on the track are stored as Vector3 s. Which makes it impossible for me to determine the look direction.
I’ve found a work around to this problem though. I get the position that is x (very tiny amount, in this case 0.1) studs in from of the enemy on the path and then use CFrame.LookAt() to get the direction the hitbox part has to look.
The thing is that sometimes, more commonly when going around corners, it just summons the hitbox part backwards. So it doesn’t go towards the enemy’s movement direction but in the opposite side.
On this line, you are using hitboxPart.CFrame.LookVector which will be equal to CFrame.new().LookVector as you havent assigned a CFrame to the part yet.
The CFrame on the right side of the “=” is evaluated before being assigned to the part’s property, meaning you can’t use the part’s new CFrame before it is assigned.
That surprisingly worked!
Thanks!
Although I tried to make a different calculation without the hitbox part and it didn’t work for it.
Or did I mess something up?
I can’t visualize what you mean, considering I’m trying it from my character’s position to the SpawnLocation and it doesn’t go in the opposite direction. Can you record or make a screenshot?