- Home /
Stop Camera Following Player When Descending
Hello, I'm faily new to Unity3D and this is my first Project. My project is based on Doodle Jump but themed as a space game. I was wondering if anyone could shed some light on my current situation...
I'm having trouble getting the camera to stop following the player object once gravity kicks in (Player speed is based on collison with Objects and Gravity kicks in if you do not hit the objects).
I have a simple GameOver script that runs when the player position is lower than a certain camera height...but since the camera is fixed to the player constantly..i can't get the script to work.
Any ideas?
Answer by GerryM · Apr 27, 2012 at 07:35 PM
Not sure if I really understood your question, but if you want to kill the player based on falling you could:
1) Have some absolute height kill the player, like
if (Player.transform.y < -100) Die();
2) Have an invisible and huge collision object below and kill the player when she hits it.
You could also consider having the player just die when his speed is below/above some value, like
if (rigidbody.velocity.y < 0) Die();
If your issue is with the camera, you can change your follow script to check the camera's height and stop moving accordingly, like
if (transform.y < -100) ... // stop following
Anyhow, good luck.
Your answer
Follow this Question
Related Questions
Attaching an RTS scrolling script to a camera (Noob Question) 3 Answers
Shaking camera 0 Answers
Camera Zoom Input change. 1 Answer
How to move camera on local z axis 2 Answers
how can I set the camera like Iphone game "Samurai II" 1 Answer