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  
zincsing

Water

Question

I have a plane which is my water, i want the player to be able to jump into the water and be able to swim around, also having it look like water from when the player is in it. :d

Share this post


Link to post
Share on other sites

3 answers to this question

Recommended Posts

  • 0

There is a few ways you can do that depending on what you mean by swimming. Swimming above the water (not allowed to go under) or above and under water. If you mean swimming above water then you will have two different planes, the water itself and another for the player to stand on (with mesh turned off to give the illusion that you are swimming). You then just add a simple script that says if the player is making contact with that plane, then play swimming animation. If you mean going under and actually swimming around, then you can create a cube (or some other object that fits your water scene) and OnTriggerEnter say if(Player) then turn off the gravity and movement script, then turn on your swimming movement script. Then OnTriggerExit turn gravity back on, disable the swimming script and enable the player movement script. If you want to add a little more realism then reverse the gravity by slightly forcing the player upward and slightly deducting health or air. It is not really that necessary though. All that is very simple except the swimming movement script. If I were you, I would do that first thing, the rest will only take you a few minutes. I would write you a small movement script but I don't think I will have the time

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