How would I make something walk backwards?
Asked by
8 years ago Edited 8 years ago
Issue
I'm working on a mini fighter. Attacking knocks away the target a certain distance, but sometimes they end up ontop of each other. Movement is automatic(so the game controls both player and AI movement to allow people to focus on comboing(or button mashing if you will).
First idea was just to move the character by walking towards a location, but that isn't exactly ideal because it looks awkward in a fight(turning away from your opponent).
Ideal Solution
Have either player or AI move 'backwards' a certain distance(or magnitude) while facing the other character.
What I have
(Snippet from the code)
1 | local magnitude = (target.Position - torso.Position).magnitude |
3 | script.Parent.Humanoid:MoveTo(target.Position, target) |
4 | elseif magnitude < = 4 then |
7 | script.Parent.Humanoid:MoveTo(torso.Position, torso) |
(TLDR - Moves until they reach a certain distance, otherwise moves if they're too close, and otherwise stands still.)
Is there any way to make a character walk 'backwards'?