- Home /
Moving Player After Falling Certain Distance [Beginner/C#]
Hey! I don't really know how to phrase this off the top of my head, so bear with me.
I've been trying to move the player object when he falls below distance "y" and I don't understand how to make it so that it applies to his fall from any location, not just one specific spot. What is meant is, if the player falls from (1,2,3) on a 3D plane, I want it to reset at (1,40,3), just like (3,2,1) would still reset at (3,40,1). I'm very new to C# so I would love some help!
Answer by whydoidoit · Mar 10, 2014 at 10:45 AM
So something like this would do that:
void Update() {
if(transform.position.y >= 40) {
//Reset your player here
}
}
Are you sure that the y is increasing though? I'd have thought falling would be decreasing the y coordinate.
That's exactly what I was looking for, and yes, I meant -40. Thank you!
Your answer
Follow this Question
Related Questions
Is it possible to convert a Collider into a Spawner? 0 Answers
Car won't return to respawn point after hitting a trigger 2 Answers
Spawn OnTriggerEnter 0 Answers
Calculating a Respawn Position at Runtime 3 Answers
Instantiate prefab at certain positions 3 Answers