- Home /
Attach rigidbody to ground below it
I'm working on a game where I have trees that have a rigidbody component on them because they should be "throwable" when picked up (similar to in Black & White).
What I want is that when the tree is standing on the ground it should be anchored by a hard spring so that the roots of the tree is holding it to the ground and when the tree is picked up the spring is broken and the object can be thrown.
Sorry if my explanation is bad, hopefully my exceptional paint skills will explain better.
What I've tried:
I tried putting a sprint joint in the tree and a fixed joint on a gameobject on the ground, however the tree keeps falling over instead of swaying when hit with something.
Any suggestions would be appreciated.
Answer by dpakmenon · Jul 03, 2016 at 12:42 PM
@mlepp You probably figured it out already but leaving answer here for others!
Add joint to roots and have rigidbody counteract gravity by something like rb.AddForce (Physics.gravity * -1)
as long as it stays on the ground. Stop counteracting gravity when joint is broken
Your answer
![](https://koobas.hobune.stream/wayback/20220611230953im_/https://answers.unity.com/themes/thub/images/avi.jpg)