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 /
This question was closed Mar 24, 2013 at 08:07 PM by Fattie for the following reason:

The question is answered, right answer was accepted

avatar image
1
Question by stevemk14ebr · Mar 24, 2013 at 02:11 PM · physicsfloatingboatdampingbuoyancy

Damping forces to stop boat oscillation

I have a boat that check 4 points to see if they are under water at any given time. When they are under water a force equal to the force required to hold the boat up dived by 4 plus an extra force that varies by depth(1/4 of the required boat force is applied at any point).

This works great to hold the boat up however the boat continually bounces between all 4 points very fast, i want this to happen but at a much slower rate to give the effect of boat bobbing/rolling. I would imagine that i need a damping force of some sort, any idea how i would go about it here is the code i have:

  //finding the height above and below the water, downdist
   //  is the height above water, the 4 points are frontl for //front
    // left point frontr for front right point,etc,etc
     float distfl=floatheight-frontl.transform.position.y;
                 float distfr=floatheight-frontr.transform.position.y;
                 float distbr=floatheight-backr.transform.position.y;
                 float distbl=floatheight-backl.transform.position.y;
                 float downdistfl=frontl.transform.position.y-floatheight;
                 float downdistfr=frontr.transform.position.y-floatheight;
                 float downdistbr=backr.transform.position.y-floatheight;
                 float downdistbl=backl.transform.position.y-floatheight;
                 //36.75 is the force required to //hold up the boat dived by 4 from the 4 points //acceleration=force/mass 9.8*15=force,15 is mass, 
     //147=force to hold boat up,147/4=36.75
                 if (frontl.transform.position.y<floatheight){
                     boatr.AddForceAtPosition(Vector3.up*(36.75f+(distfl*36.75f)),frontl.transform.position);
                 }
                 
                 if (frontr.transform.position.y<floatheight){
                     boatr.AddForceAtPosition(Vector3.up*(36.75f+(distfr*36.75f)),frontr.transform.position);
                 }    
                 
                 if (backl.transform.position.y<floatheight){
                     boatr.AddForceAtPosition(Vector3.up*(36.75f+(distbl*36.75f)),backl.transform.position);
                 }
                 
                 if (backr.transform.position.y<floatheight){
                     boatr.AddForceAtPosition(Vector3.up*(36.75f+(distbr*36.75f)),backr.transform.position);
                 }
     
 
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 McGravity · Jan 28, 2014 at 06:43 PM 0
Share

Has the answer been deleted? Does someone have another answer? :)

avatar image SuperChihuahua · Mar 13, 2015 at 02:41 PM 1
Share

$$anonymous$$y crazy boat has oscillated, vibrated, and bounced for about 3 days, then I found this magical line of code (where boatRB is your Rigid Body):

 boatRB.maxAngularVelocity = 0.5f;

...and the ship is now flowing like a swan on a calm lake :)

0 Replies

  • Sort: 

Follow this Question

Answers Answers and Comments

13 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

Related Questions

Object buoyancy in water on different water levels? 1 Answer

Unexpected token if 1 Answer

Having trouble with player boat movement with buoyancy pack 0 Answers

Buoyancy Script Timing Inverted 1 Answer

Pro Water - Matching Rotation 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