• Editor
  • Unity: Can I mix Spine anims with 3D objects?

Hey Nate, amazing work on meshes and ffd! So much fun to play with! It's hard to believe how much Spine has grown in a year.

I'm messing around with Spine in Unity for the first time, and I'm wondering if there's a way (maybe obvious) to mix spine characters and 3D elements in a top down game. Specifically, I was thinking that I would use an orthographic camera angled at roughly 45 degrees downward, and have the spine skeleton animations perpendicular/orthogonal to the floor and facing the camera, so a spine character can move in front of or even within a 3D object which is covering the ground. The spine animation would be stretched vertically in relation to the camera, so that it appears to be uniformly scaled from the orthographic camera's view.

The problem I'm running into is that Spine offsets the depth coordinates of each bone mesh within a skeleton animation, so moving a camera into the air and then angling it down 45 degrees means that bones which are in front of the animation are seen lower relative to the rest of the skeleton than they would be if they were seen head on in the normal approach. Is there a way to have this kind of 2D/3D world, with Spine animations staying always orthogonal to the ground, and still have the spine animations appear correct? Is there some way to lessen the distance used for the depth offset, compensate for the depth offsets with y offsets for each bone, or just a better way to do this?

Thanks,

Alex

Related Discussions
...
  • تم التحرير

The z/depth offset is adjustable and removable.
Check the Update method of SkeletonComponent.cs.

Line 193 of the latest runtime goes something like:
float z = -i * 0.1f;

You can set that second number to something much smaller.
Or you can just set z to always be 0f, which is what I do.

Another way to do this would be to just make the Spine SkeletonAnimation GameObject a child of your logical game character and align the rotation of that gameobject to be the same rotation as the camera. This setup works better with the camera and also works with a perspective camera.

In general though, Spine should work fine with 3D stuff in Unity. You just need to handle sorting well.

This is wonderful, thanks for your time and your quick reply, Pharan!

fun recommences 😛

Thanks Pharan! 🙂

3 أعوام لاحقا

@Pharan @[محذوف]

Hi guys,

I can't seem to find SkeletonComponent.cs in the Unity Runtimes. Has it been replaced by something else?

Thanks

You've necro'ed a 3+ year old thread. 🙂 SkeletonRenderer is now the lowest level component. If you want to use AnimationState, then you probably want SkeletonAnimation.
Spine-Unity Runtime Documentation: SkeletonAnimation