- Home /
Do Spring Joints work with Empty Game Objects?
Hi, I've tried so many permutations and scoured the answers and forums and all over for a decent tutorial on spring joints and have had no luck. Hopefully if I word it this way some one could please chime in! :)
I want to create an Empty Game Object which will be parented to a bone in a character. I want this "null point" (a.k.a empty game object) to bounce around like a somewhat stiff spring based entirely on the motion of the character - no matter what makes it move (keyboard or external device etc). Btw, I am not using canned animations in the character, I am animating the character's skeleton programmatically (actually via a Kinect controller but that doesn't matter here).
Then I plan on having a bone (inside a strand of hair with a weight map associated to it) LookAt the springy Null Point. That way the strand of hair will animate nicely as secondary animation to the character. I figure I could put multiple springy null points attached to this character associated to bones and weight maps in the mesh so that I can simulate a bit of secondary animation and soft body type stuff easily.
The problem is I can't even get the most basic spring joint to work when driven by controls like the keyboard. I've tried this with spheres and cubes in test scenes to no luck no matter what settings.
Can anyone PLEASE ;) provide the simplest of demo example scenes and/or walkthrough exactly what settings and what parentings and what components go where to achieve this?
thanks!!
Answer by Waz · Jul 04, 2011 at 12:23 PM
No demo scene, sorry, but just do this:
Arm
Hand
Anchor + Ribidbody with isKinematic=true
Yoyo + Rigidbody + SpringJoint with connectedRigidbody=Anchor
WOW thanks!
Using your example here, my problem was that I had the Yoyo parented to the Arm or Hand as well when I tried it. I never thought to move the empty null (Yoyo in your case) to the root. I thought it would need to be parented to the character since it would have to move with it. I guess the rigidbody connected property takes care of that?? It just totally wasn't intuitive to me to do it your way.
I was either getting crazy motion or none at all and had tried various combinations of turning on the position and rotation constraints on either of the 2 rigidbodies. I also tried throwing a fixed joint in there and trying to connect the spring joint to the fixed joint.
Unity really needs to clean up their docs. You made it perfectly clear to me. thanks for your help! :)
sorry about commenting in the wrong place before - I moved it here now - I try to keep this place clean, but it was a typo/user interface mistake I made... Will be more vigilant in the future with keeping the answers website clean. Thanks again for your help!
Your answer
Follow this Question
Related Questions
How to move a GameObject (bone) between two other gameobjects (nodes) ? 0 Answers
How to create a trampoline kind of object in unity? 1 Answer
Attach object to avatar bone 1 Answer
using Contains(gameObject) to find and destroy a gameObject from a list 2 Answers
How do I stop gameobjects with bones and colliders from colliding into each other 0 Answers