C
C#

help

❔ Having trouble with a player swap function

A_arira_1/29/2023
public void swap()
{
Vector3 LastPlayerPos = transform.position;
transform.position = Clone.transform.position;
Clone.transform.position = LastPlayerPos;


}
public void swap()
{
Vector3 LastPlayerPos = transform.position;
transform.position = Clone.transform.position;
Clone.transform.position = LastPlayerPos;


}
basically here i take the player position when the function is called and incorporate it in a variable (LastPlayerPos) Then i switch the player position with another gameobject (cloneposition) and swap the position of the clone with the lastplayerpos. It doesnt work tho, the clone teleport to the player but the player doesnt teleport to the clone. Does anyone know why?
SSusko31/30/2023
if you make the transform.position = new Vector3(100, 100, 100) will the player teleport to coordinates 100, 100, 100?
AAccord1/31/2023
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.

Looking for more? Join the community!