• Unity
  • adding physics objects to spine skeleton

Hi all, I am trying to attach a physics objects to a spine character I have created but I'm having some difficulty. I was wondering what would be the best way to add such an object like a cape or physics based hair?

I can attach a rigid body but the actual animation of the character is not applying force to the attached rigid body. It follows the translation of the animated bone but does not apply any forces to the rigid body so it just behaves as though it were not attached at all. Any suggestions would be appreciated.

Thanks.


01 Dec 2015, 01:09


FYI, after a bit more experimentation I discovered I can use RigidBody2D.MovePosition() to make a rigid body follow a bone properly. There are weird issues if the bone moves really fast but it's a start.

I know Mitch made a demo of a character with a physics-driven cape. It doesn't seem to be part of the Spine sample files. But I vaguely remember he showed how to do it.


01 Dec 2015 9:53 am


The setup is around the 2 minute mark.
Though it doesn't showcase it as good as the other setup where you can control the character and he runs and the cape flaps around. There WAS a video of that or something. Maybe you'll have better luck finding it.


01 Dec 2015 9:55 am


Also see check this video :


01 Dec 2015 10:02 am


The Raptor Animated Physics scene file from the Example unity files shows how to drive bones with physics.
Check its SkeletonUtility setup. Notice the use of SkeletonUtilityKinematicShadow.


01 Dec 2015 10:12 pm


Okay, Nate found it.

3 months later

Thanks for the videos.

What I wanted to do was actually a bit different. I needed to attach a separate spine object with it's own bone hierarchy overridden and fully ragdolled temporarily to another spine object's bone. So they are essentially two separate spine objects temporarily needing to interact. Sort of like picking up and carrying a ragdoll character and dropping it but while carrying the ragdoll character it should react the movement while being carried. Using RigidBody2D.MovePosition to follow a bone has worked out just fine for this. It's probably not in the scope of Spine2D to handle physics interaction between two separate object hierarchies but luckily the skeleton utility allows custom behavior like this.

a year later

@Pharan @Nate @[deleted]

Sorry for necro-ing this thread. I'm currently looking for a physics based solution for my cape and found this awesome thread and vidoes. But the problem is I'm using rigidbody2D.

Nate's method is great, but it only works on ridibodies. :doh:

Do you guys have any suggestions on getting physics-driven capes for rigidbody2D's ? :love:

I tried to change the SkeletonUtilityKinematicShadow.cs to reflect rigid2D's .. but no luck.

Any help would be greatly appreciated!!

I tried playing around with rigidbody2d.moveposition, as mentioned by captainbeeves. But my limited coding skills weren't able to succeed there.

[edit]
I did a work around. I attached a unity cloth sim to the bones that were exposed in the skeleton utility. Going to test it out some more, but hopefully this can work

Pharan wrote

I know Mitch made a demo of a character with a physics-driven cape. It doesn't seem to be part of the Spine sample files. But I vaguely remember he showed how to do it.


01 Dec 2015 9:53 am


The setup is around the 2 minute mark.
Though it doesn't showcase it as good as the other setup where you can control the character and he runs and the cape flaps around. There WAS a video of that or something. Maybe you'll have better luck finding it.


01 Dec 2015 9:55 am


Also see check this video :


01 Dec 2015 10:02 am


The Raptor Animated Physics scene file from the Example unity files shows how to drive bones with physics.
Check its SkeletonUtility setup. Notice the use of SkeletonUtilityKinematicShadow.


01 Dec 2015 10:12 pm


Okay, Nate found it.