I understand the challenge you're facing with Spine characters in a 3D environment. This is a common issue when mixing 2D and 3D workflows.
Understanding the Problem
The spine-unity skeleton components SkeletonAnimation and SkeletonMecanim use a normal 3D MeshRenderer, which means normal Unity rules apply for arranging and sorting elements in your scene. However, the mesh vertices are generated based on your Spine skeleton's coordinate system, which can extend beyond where you logically want your "ground point" to be.
Recommended Solutions
Here are a few approaches to handle this:
1. Offset in Spine (Recommended)
The cleanest approach is to adjust your skeleton setup in Spine:
- Create a "ground" bone or reference point at the actual bottom-most point of your character mesh (accounting for feet, deformations, etc.)
- Position this at Y = 0 in Spine
- Use this bone as your root instead of the original root
- All your attachment art and bones can then sit above this point
This ensures nothing extends below Y = 0 in the Spine coordinate system, and your character will naturally sit on the ground plane when the root is at Y = 0 in Unity.
2. Unity-Side Offset
If modifying the Spine skeleton isn't ideal, you can handle it in Unity:
- Keep your Spine root where it logically makes sense
- In Unity, add the SkeletonAnimation component to a child GameObject
- Offset that child GameObject upward by the amount needed to clear the ground
- Use the parent GameObject (at Y = 0) for gameplay logic, shadows, and positioning
This way your gameplay anchor point stays at the ground level, but the rendered mesh is elevated just enough to prevent clipping.
3. Adjust the Ground Plane
Alternatively, you could slightly lower your visual ground plane in Unity (e.g., to Y = -0.1 or whatever offset you need) while keeping collision and gameplay logic at Y = 0. This gives your character mesh room to extend below the gameplay ground without visual clipping.
Shadow Considerations
For projected shadows, ensure they're being cast from the correct reference point (your gameplay root at Y = 0) rather than the mesh's actual bounds. Unity's shadow system should handle this correctly as long as your light and shadow settings are properly configured.
The first approach (adjusting in Spine) is generally the most robust, as it keeps your coordinate systems aligned and prevents future issues with animation, effects, or additional characters.