apply force to every vertice on object
Hey guys! So i stumbled upon this problem while creating a buoyancy effect.
Ive got every vertice-position in the world-space, yet whenever I apply force it just rotates the object (understandably) based on the forces.
I have loops running that determines which vertices ARE in the water, yet i cant come up with anything to make them go upward. I have even calculated the required buoyancy force based on the mass of the object, but im start to think that i dont even need to use this part.
I attach a picture to show that while the object is in the "water", it can detect wether or not particular vertices are underwater
So any idea where should i go from now on? or what can i do? Every help is appreciated. Thanks
Answer by mephlaren · May 12, 2017 at 03:01 PM
ok, i found the answer. In the loop where im sorting if the given vertice is underwater or not, i just added this:
GetComponent<Rigidbody>().AddForceAtPosition ((transform.up*coefficientUp)/(1+UnderWatermes[i].y/10),UnderWatermes [i]);
Had to play with it to find the golden number for coefficient, now i just need to calculate the air resistance, based on this. :D
Your answer
Follow this Question
Related Questions
How to stop a sphere that is using GetAxis from moving? (Roll-A-Ball Tutorial) 0 Answers
Car will only turn right (& ignored collders) 0 Answers
Adding Gravity to a game object to make a black hole sucking effect. 1 Answer
Is it possible to put collision detection in an if statement? 0 Answers
How can we control two player objects at one time with RayCasting? 1 Answer