Jump to content
This site uses cookies! Learn More

This site uses cookies!

armedunity.com uses cookies to improve user experience.

By continuing to use this site, you agree to allow us to store cookies on your computer.

  • 0
Sign in to follow this  
meone

Camera moves off the terrain

Question

Hello,
When camera is near to the terrain, it moves off the map. What is the script I should insert to prevent the camera from moving off the terrain?

Share this post


Link to post
Share on other sites

5 answers to this question

Recommended Posts


  • 0

Your question is extremely general. You can't ask how to cook chicken and not specify what kind of chicken. You haven't stated why the camera is even moving in the first place or what script is moving it. Is it a minimap camera, player camera, car camera... A little more specifics need to be known

Share this post


Link to post
Share on other sites
  • 0
Please login or register to see this quote.

 

main camera is following the car, the car is driving in the mountainious places what is made with terrain, when the camera moves near to the terrain it goes through it, and i want to fix this..

Edited by meone

Share this post


Link to post
Share on other sites
  • 0

Then the answer would be as young stated, cast a raycast down, if hit distance less than a specific amount, move the position up

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...