- Home /
Rigidbody2D.MovePosition is not being instaneous
Hi i'm working on a 2d top down RPG with a overworld system like that of early final fantasy games where the party leader is followed by the other members. I am having an issue with the Warp Points i am using which are supposed to get all the party to moveposition to a given destination at the instant the party leader contacts the box overlap:
public void WarpTo(Vector2 warpDest, Vector2 withFace)
{
//revoke player control
ToggleIdle();
//stop current movement
StopAllCoroutines();
//update animations so player faces away from exit
anmtr.SetFloat("x", withFace.x);
anmtr.SetFloat("y", withFace.y);
//update destination and origin to be warp destination
origin = warpDest;
destination = origin;
//move rb2d
rb2d.MovePosition(warpDest);
Debug.Log("warp");
//set all historical vectors to 0
for (int i = 0; i<3; i++)
{
mHistory.Dequeue();
mHistory.Enqueue(Vector2.zero);
}
//repeat for followers
foreach(Follower follower in followers)
{
follower.WarpTo(origin, withFace);
}
//return control
ToggleIdle();
}
A similar code runs for each follower in the foreach loop. My issue is that when i take the exit on the right which is supposed to warp me to the northern entrance, i find the correct behaviour in all but the 3rd party member who instead drifts across the screen slowly to the position. This doesn't arise unless i take the right exit, i have tried the northern one which works fine perfectly and it is always the third party member.
Your answer
Follow this Question
Related Questions
Teleporting gameobject 2D 1 Answer
how retrieve final player position in previous scene after switching from a new scene? in 2d rpg 4 Answers
Problem using DontDestroyOnLoad carrying over a player, but not a camera 2 Answers
Player does not teleport to the right location 0 Answers
NPC Party Member Direction 1 Answer