Apply a non-centered force to a collection of 'joined' GameObjects
I have a table, that is constructed with 3 GameObjects as the top, and two more as the legs. These are connected by setting the parent of all objects to the centre piece. (Eg, top1.transform.parent = top2.transform;) When I applied an upwards force to the right leg, I was hoping that leg would raise but the other would stay, rotating the entire table anti-clockwise. However any upwards force on any of the objects would cause the entire construct to move upwards.
Is there an easy way to achieve the effect I'm after? The force code I'm using is: legRigidBody1.AddRelativeForce(new Vector2(0, 1), ForceMode2D.Force);
Thanks!
Answer by JedBeryll · Aug 21, 2016 at 02:22 PM
Only the root gameobject should have a rigidbody, no more, no less. When you took care of that, check out this method: https://docs.unity3d.com/ScriptReference/Rigidbody.AddForceAtPosition.html
Your answer
Follow this Question
Related Questions
How to make a Object move to the right slowly? 0 Answers
Cannot get my double jump to work (2D) , 0 Answers
How to add a startforce to a rigidbody 2D but let gravity take it from there? 1 Answer
The ban on going beyond the edge collider 0 Answers
How can I prevent 2d joints from "sagging" over time like in this video? 0 Answers