Question by
informalyt167 · Dec 31, 2020 at 07:53 AM ·
c#playerpositioningx-axis
IMPORTANT! how to set float to the player x position
ok first of all thanks so much for trying to help but i cant for the life of me figure out how to set a float to a players x position so i can spawn a enemy -10 from the xpos if that makes sense so once you get the players position minus it by 10 all times to i can spawn the same enemy close to the player! THANK YOU SO MUCH
Comment
Answer by Hasster1 · Dec 31, 2020 at 07:58 AM
If you want to set s position to it's original position + some number, you can use transform.Translate(x,y,z)
No, wait, i got it, you want to place enemy onto the player's position - 10 on x axis, is that right? If you're trying to do it in enemy's script, you can just use
transform.Position(player.transform.position.x - 10, player.transform.position.y, player.transform.position.z)
Or something like that