I want to implement a feature where when the player passes through grass, the grass gets pushed aside, and then returns to its original position after the player leaves.

I know I can do this using Unity's physics simulation, but can I achieve this using Spine's physics? Specifically, when the player collides with grass, can I apply a force to the Spine skeleton to drive Spine's physics simulation? Is this possible?

Related Discussions
...

To achieve the effect of grass being pushed aside when a player passes through it, you can use Spine's physics simulation in combination with Unity's physics system. While Spine's physics constraints can handle dependent movements within the skeleton, they do not directly support collision detection or force application from external objects like a player character. However, you can use Unity's physics system to detect collisions and then manipulate the Spine skeleton accordingly.

One approach is to use Unity's Rigidbody2D and Collider2D components to detect when the player collides with the grass. Upon collision, you can apply a force or adjust the position of the grass bones in the Spine skeleton to simulate the grass being pushed aside. You can use SkeletonUtilityBone to bridge between Unity's physics and Spine's skeleton, allowing you to manipulate the bones based on the collision events.

For example, you can set up a Rigidbody2D and Collider2D on the grass GameObject and detect collisions with the player. When a collision is detected, you can adjust the bones in the Spine skeleton to create the desired animation effect. After the player leaves, you can animate the bones back to their original position.

This approach leverages Unity's physics for collision detection and uses Spine's animation capabilities to create the visual effect of grass movement.

10 dana kasnije

Nate hi dude
finaly I use the unity physics simulation but I got the wrong result ( unity 2022.3 LTS & spine 4.2.40 )

I don't know what I'm looking at in the video, or what the right or wrong result would be. 😬

    Nate
    Sorry, I thought the difference was obvious so I didn't explain it. Now I will explain it.

    This is the spine skeleton before adding physics

    This is the result of adding Unity physics according to the official documentation.


    Look carefully, the shape of the leaves is different. I don't know if it's the mesh problem or the bone offset.(I observed that some meshes seemed to be mirrored.) I guess it's the bone offset, but I don't know why it's offset, because the hero in the document didn't deform after adding physics, but my mesh deformed.

      suanLoBeach I'm not sure if this has to do with the fact that I've set the scale of some of the slots in the spine to negative values, like (-6,5) (0.5,-0.6)

      Thanks! I think we'll need Harald to comment on this. Monday is a holiday but he'll be here Tuesday.