Hello everyone!

This is my first contact with Spine Physics (that works AMAZING and love the results, btw).

However I'm wondering about some issues related to Unity interaction:

I have this Piñata rigged to move as desired:

My intention is to achieve this movement without moving the rope's origin in unity, only the piñata itself (as a hanging piñata should behave while tied to some point at the ceiling). This is, the rope being fixed both the "ceiling" and the piñata itself. Additionaly, it should move (swing) when something collides with the piñata.

Could anyone help me setting this up? Is there something I'm missing out?

thank you all in advance!

Related Discussions
...

To achieve the desired swinging motion of your piñata in Unity using Spine, you can utilize Unity's physics system in conjunction with the Spine-Unity runtime. Here's a general approach to set this up:

  1. Rope Setup: Ensure that the rope is part of your Spine skeleton and is rigged properly. The top of the rope should be fixed to a point (the "ceiling"), and the bottom should be attached to the piñata.

  2. Physics Components: Add a Rigidbody2D component to the piñata GameObject in Unity. This will allow it to interact with Unity's physics system. You can also add a HingeJoint2D to simulate the swinging motion. The HingeJoint2D should be configured to connect the piñata to a fixed point, simulating the ceiling attachment.

  3. Collision Detection: Add a Collider2D to the piñata to detect collisions. This will allow the piñata to react when something hits it, causing it to swing.

  4. Spine Integration: Use the SkeletonUtility component from the Spine-Unity runtime to ensure that the piñata's movement is correctly reflected in the Spine animation. This component can help synchronize the physics-driven movement with the visual representation of the piñata.

  5. Testing and Tuning: Test the setup by applying forces to the piñata and observing the swinging motion. You may need to adjust the mass, drag, and joint settings to achieve the desired behavior.

By following these steps, you should be able to create a realistic swinging motion for your piñata in Unity using Spine and Unity's physics system.

@Yimec I see two main ways to solve this.

  • a) Not really use Spine's new physics constraints but instead use the existing SkeletonUtilityBone Create Hinge Chain 2D functionality:
    https://esotericsoftware.com/spine-unity-utility-components#2D-and-3D-Hinge-Chains-for-Physics
  • b) You could change the setup in Spine so that you can move and rotate the piñata around and have the rope follow, instead of the other way round, plus limit the distance of the piñata bone to the ceiling-anchor (via constraints or in game-code). Then you can use a hierarchy of SkeletonUtilityBones with the piñata bone GameObject set to Mode Override and having a Collider2D and a Rigidbody2D attached.