Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Adamagocs · Jun 08, 2011 at 03:34 PM · camerameshrandomvectorwaypoint

Sample the height of the mesh?

Hello all,

I got some sereius problem. I generated a mesh (it's long and flat) via script (it's totally random) I want the camera to go on the mesh. So I sampled the vertices of the mesh and gave the coords for the camera but when the mesh go lower, the camera instantly jump under the mesh, because the vertices are far away from each other. Any idea to keep the camera always on the right position?

`http://kepfeltoltes.hu/110608/mesh_www.kepfeltoltes.hu_.jpg`

Comment
Add comment · Show 2
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image red 2 · Jun 08, 2011 at 03:48 PM 0
Share

i dont quite get your question, what exactly is the camera supposed to do?

avatar image Adamagocs · Jun 08, 2011 at 03:50 PM 0
Share

Just always go forward on the top of the mesh. It's like a plane mesh, with different heights.

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by Bunny83 · Jun 08, 2011 at 04:07 PM

To sum up:

  • You have created a "custom hightmap-like-terrain-mesh".

  • You want the camera to move across the surface of your mesh.

If you sampled a vertex position you will always need to add an offset, otherwise the camera will move directly on or in the surface. Add a small Vector.up to your positions.

If that's not your problem you should overthink your question. "It's long and flat" and "totally random" in one sentence is a bit weird.

btw. if the mesh isn't changing each frame you could use a Mesh collider and raycast against it (maybe you already do this. I'm not sure what you mean by sampling vertices).

Comment
Add comment · Show 10 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Adamagocs · Jun 08, 2011 at 04:14 PM 0
Share

"If that's not your problem you should overthink your question. "It's long and flat" and "totally random" in one sentence is a bit weird."

So it's always flat like a terrain, the length is random generated, the width is always 50, and on this mesh the heights are random generated.

I already tried $$anonymous$$esh collider, but there was always some error because I can't predefine the mesh for collider, because it's generated at runtime. So I used that Shared$$anonymous$$esh thing, but I it doesn't looked like it's working.

avatar image Adamagocs · Jun 08, 2011 at 04:26 PM 0
Share

And the first solution what you said it's not good because the degree of the up and down is not always the same. The second probame, if I go lower, the vector up help to stay on the top of the mesh, but when I go up it will go higher then normally. Third problem is what I can't explain but its really big :DDD

avatar image Bunny83 · Jun 08, 2011 at 06:59 PM 0
Share

If a mesh has different heights how can it be flat? Anyway, I still don't get your problem...

You said you want to keep your camera on the "right position". What do you consider right? The camera is moving so it's not a position, it's a path.

$$anonymous$$aybe you can take a screenshot of your mesh? You can edit your question at any time.

avatar image Adamagocs · Jun 08, 2011 at 07:08 PM 0
Share

http://kepfeltoltes.hu/110608/mesh_www.kepfeltoltes.hu_.jpg here you are!

avatar image Bunny83 · Jun 08, 2011 at 07:29 PM 1
Share

Ok, that's how i thought that it would look like. I don't see your problem by adding Vector.up to your position. The camera will always have this distance to the surface. You have to sample the position right below the camera of course.

Show more comments

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Choose a random point that is within view of camera 1 Answer

Stuck trying to change the position of my Main Camera through scripting 1 Answer

Unrealistic size of sun, viewed from earth 2 Answers

Best Mesh designing or waypoints 0 Answers

Parented Camera randomly warping about 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges