- Home /
Question by
You_Bored_Bro_Gaming · Jan 03, 2017 at 09:03 AM ·
teleportingdimensionsrelative positionrelative movement
How to teleport an object relative to itself
In my game I have dimension hopping and basically if you press h, it teleports you to hellish world and if you press it again, it teleports you to heaven. I want to know how I can teleport this player exactly like a hundred units below itself. is it like Transform.position = new Vector3( player.Transform.position.x, player.Transform.position.y-100, player.Transform.position.z) or something? I'm relatively new to this. (bad pun, I know). please help?
Comment
You are totally right, https://docs.unity3d.com/ScriptReference/Transform-position.html
transform.position = new Vector3(transform.position.x,transform.position.y -100, transform.position.z)
Ok, thank you so much. Just wanted to confirm my theory :)
transform.position += Vector3.down * 100f;