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  
arwe2793

water hellp

Question

hi, i want make obijact floating water, idea is to make script whick make les gravity, so its looks like undervater jumping or similar effect. somebody hawe such script? may other techniquas, but keep in mind that im still a litle nob in unity :P

Share this post


Link to post
Share on other sites

1 answer to this question

Recommended Posts

  • 0

You can create a simple buoyancy effect by adding a force to your object depending on how high it is above the water level. When it is exactly at the water level, the force should be exactly equal to gravity. Above a certain height, the object is completely out of the water and gets no lift from floating.

The key to getting a good floating effect is that the place where the buoyancy force is applied is not generally the same as the object's center of mass. For example, a car's center of mass will be located near the engine, but its "center of buoyancy" will be in the passenger compartment where all the air is.

I've attached an example project with a script that applies forces to a simple object. It works OK for a floating object with a fairly regular shape, but you might want to add more points of buoyancy if you are modelling, say, a large boat.

By "andeeeee" at Unity Forum

Check This Link for Sample Project and More Info

Please login or register to see this link.

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...