Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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
1
Question by Brenden-Frank · Jun 15, 2013 at 06:47 PM · meshtriggerwatermeshcolliderunderwater

How would I detect water level at the player's position?

I have an area trigger currently, that occupies the same space as the body of water. When the player enters the area trigger, an event is fired which triggers an underwater effect.

The problem with this approach is that it is innacurate when the water level is actively changing due to waves generated by gerstner displace.

My question is what would be the most efficient way to actively track the water level at the player's position and trigger the underwater effect?

Solutions I have thought of so far:

-Use a mesh collider and update the mesh real time based on the water mesh (sounds incredibly inefficient)

-Scrap gerstner displace and keep the water at a predictable level that the area trigger can accurately account for

-Check the mesh vertices closest the player for height and do a check versus the player height (also possibly inefficient)

I'd love to hear the community's thoughts on this, source engine seemed to figure this out ages ago on pretty tame pc's.

Comment
Add comment · Show 5
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 Jamora · Jun 15, 2013 at 07:13 PM 0
Share

Have you considered creating your water surface with a different algorithm? A perlin noise heightmap would probably be easier to work with... $$anonymous$$ight not look as nice tho. I suggest Perlin noise because there is a generator available for free at the asset store. http://u3d.as/content/unity-technologies/procedural-examples/3zu

avatar image Kirbyrawr · Jun 16, 2013 at 01:45 AM 0
Share

I want to know it too, it seems to be a interesting answer.

avatar image pvzkiller · Jun 02, 2014 at 01:12 AM 0
Share

I don't have any solution, but I am looking for a way to support the exact same thing on my side. In order to stimulate things a bit more on this problem, and for the good of the whole community, I am personnally offering compensation to the person who can give a working and efficient (framerate) answer. Some things just need to be done in order for Unity to grow faster.

avatar image pvzkiller · Jun 02, 2014 at 01:20 AM 0
Share

One thing I can recommend to anybody wanting an answer to this: don't wait for it to happen. Ins$$anonymous$$d, there are some alternate ways to bypass this limitation, like forcing your camera location to move up or down via program$$anonymous$$g when the camera is moved within the $$anonymous$$imum and maximum amplitude of Gerstner waves. Or in another way that doesn't modify your camera transform at all, just make a white flash appearing over everything else. This will simulate transition from surface to underwater, and can also basically simulate some water foam. This is an easy and straight-forward alternate solution that will work both in Unity Pro and Unity Free.

avatar image Fappp · Apr 26, 2015 at 06:52 AM 0
Share

Just picked this up in this thread. Will post progress here too.

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by Jeff-Kesselman · Jun 02, 2014 at 01:15 AM

I would put the water on its own layer and do a ray-cast down from the center of the player.

This is assuming your mesh collider properly tracks your water deformation.

Comment
Add comment · 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
0

Answer by Fappp · Apr 26, 2015 at 09:36 AM

Just found this, definetely not my work or anything! But seems like a very graceful solution for water at first glance :)

http://scrawkblog.com/category/water/

Comment
Add comment · 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

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

19 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How to change scenes by touching objects? 2 Answers

Non-Convex Mesh Collider triangle limit - is it more than 255? 0 Answers

Changing Mesh and Mesh Collider of an Object 0 Answers

Find all triangles inside given bounds 1 Answer

Weird bounce on collision with perfectly aligned (generated) meshes for fast object 3 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