#Tekken alike movement

10 messages · Page 1 of 1 (latest)

civic girder
#

im trying to make the player walk around the opponent but everything i have tried makes it move slightly back or slightly towards the opponent. I have tried using nodes to get the direction for walking around, used pure math but it doesnt seem to work.
My best attempt was when i rotated the sideways vector and i could control how accurate the circular movement was but i dont think thats the best solution.

civic girder
#

i still dont know the proper way of doing this, could anyone help me

empty canyon
#

If you rotate your model to look around target every frame, your movement direction is global_transform.basis.x

civic girder
#

but thats the problem, since the axis doesnt follow the circle of distance it always goes further from the opponent, even if the character is looking towards the target

#

heres a visual demostration:

#

this is even worse when moving at faster speeds, where it almost instantly goes out of bounds

empty canyon
#

Then I guess you need to do some math. Get vector going from p2 to p1, rotate the vector how many degree you want, add the result to p2 position (p3), and use vector going from p1 to p3 as movement direction

#

The problem would be to calculate how much you need to rotate the vector since it depends on distance p1 and p2

civic girder
#

the circle would be p3 btw