Hello,
first of all sorry if this is a trite question, but I am quite new of unity and Spine and looking into forum I have not found tips
Following this video:
I was able to export from Spine and create my prefab into Unity
Moreover using Unity Animator with Parameters and Transitions I was able to play beetween different animation (using a script controller to change parameters) with good results
Practically, until now, I am not using runtimes.
Now I have the problem that my character should have an hit animation for melee weapons.
Reading the docs: http://de.esotericsoftware.com/spine-using-runtimes#Combining-animations
I create a new Animation with only keframes for bones in the torso, to be able to have legs not effected by the merge of animations.
In this way, for example, the hit animation should be good while I am running or walking or in idle state
My question is:
Exist a way to achieve this result (combine animations) using only the Unity Animator ?
Or I have to heavily modify my controller script as the Basic Platformer Controller created by Mitch Thompson available into the examples ?
In fact I see that into Spine examples Unity Animator is not used and all is done with Basic Platformer Controller script.
Could you help me and suggest the path to follow ?
Thanks!
ps. sorry for bad english!
1. sayfa (Toplam 1 sayfa)
matteo.piccioni
7 years ago
- matteo.piccioni
- Mesajlar: 7
Mitch
You do it the normal Mecanim way. Create a new Layer in the Animator.
7 years ago
-
Mitch - Mesajlar: 978
matteo.piccioni
Thanks,
I will look into
In general why should I use runtimes instead of normal mecanim way ?
I will look into
In general why should I use runtimes instead of normal mecanim way ?
7 years ago
- matteo.piccioni
- Mesajlar: 7
Mitch
Runtime has more features. Baking (as opposed to using SkeletonAnimator) doesn't support a lot of features (like Color keys, realtime IK, FFD, so on).
If you use SkeletonAnimator (not SkeletonAnimation) you kind of get the best of both worlds... but there are still some inherent problems with SkeletonAnimator because of the way Mecanim handles blending.
If you use SkeletonAnimator (not SkeletonAnimation) you kind of get the best of both worlds... but there are still some inherent problems with SkeletonAnimator because of the way Mecanim handles blending.
7 years ago
-
Mitch - Mesajlar: 978
matteo.piccioni
Ok, I am trying to understand
There 3 way to use Spine with Unity
1) Using Baking. Useful to export project without Spine runtimes. Better to avoid if not necessary.
2) Using SkeletonAnimation:
Right click into: xxxx_SkeletonData -> Spine -> Instantiate (SkeletonAnimation)
In this way I was able to attach a new script that call runtimes command as:
I remove SkeletonAnimation script from my prefab and I add the script Skeleton Animator (that add Animator script to prefab too)
From xxxx_SkeletonData context menu I did 'Generate Mecanim Controller'
Now my prefab has the following scripts:
Transform
Skeleton Mesh (Mesh Filter)
Animator (with right Controller)
Skeleton Animator (with the xxxx_SkeletonData)
other personal script...
Now I have that the character is moving using Parameters definid into Unity Animator but how should I use the advanced runtime features ?
All the example into runtimes make use of SkeletonAnimation
Thanks!
There 3 way to use Spine with Unity
1) Using Baking. Useful to export project without Spine runtimes. Better to avoid if not necessary.
2) Using SkeletonAnimation:
Right click into: xxxx_SkeletonData -> Spine -> Instantiate (SkeletonAnimation)
In this way I was able to attach a new script that call runtimes command as:
public class SpineController : MonoBehaviour {
#if UNITY_4_5
[Header("Graphics")]
#endif
public SkeletonAnimation skeletonAnimation;
#if UNITY_4_5
[Header("Animation")]
#endif
[SpineAnimation(dataField: "skeletonAnimation")]
public string runName = "Run";
[SpineAnimation(dataField: "skeletonAnimation")]
public string idleName = "Idle";
[SpineAnimation(dataField: "skeletonAnimation")]
public string jumpName = "Jump";
protected MyController _controller;
void Awake()
{
_controller = GetComponent<MyController>();
}
// Use this for initialization
void Start () {
}
// Update is called once per frame
protected virtual void Update()
{
if (_controller.State.IsGrounded)
{
if (Mathf.Abs(_controller.Speed.x) < 0.1f) //idle
{
skeletonAnimation.AnimationName = idleName;
}
else //move
{
skeletonAnimation.AnimationName = Mathf.Abs(_controller.Speed.x ) > 0.6f ? runName : runName;
}
} else {
if (_controller.Speed.y > 0) //jump
skeletonAnimation.AnimationName = jumpName;
else //fall
skeletonAnimation.AnimationName = jumpName;
}
}
}
3) Using SkeletonAnimator (The better way)#if UNITY_4_5
[Header("Graphics")]
#endif
public SkeletonAnimation skeletonAnimation;
#if UNITY_4_5
[Header("Animation")]
#endif
[SpineAnimation(dataField: "skeletonAnimation")]
public string runName = "Run";
[SpineAnimation(dataField: "skeletonAnimation")]
public string idleName = "Idle";
[SpineAnimation(dataField: "skeletonAnimation")]
public string jumpName = "Jump";
protected MyController _controller;
void Awake()
{
_controller = GetComponent<MyController>();
}
// Use this for initialization
void Start () {
}
// Update is called once per frame
protected virtual void Update()
{
if (_controller.State.IsGrounded)
{
if (Mathf.Abs(_controller.Speed.x) < 0.1f) //idle
{
skeletonAnimation.AnimationName = idleName;
}
else //move
{
skeletonAnimation.AnimationName = Mathf.Abs(_controller.Speed.x ) > 0.6f ? runName : runName;
}
} else {
if (_controller.Speed.y > 0) //jump
skeletonAnimation.AnimationName = jumpName;
else //fall
skeletonAnimation.AnimationName = jumpName;
}
}
}
I remove SkeletonAnimation script from my prefab and I add the script Skeleton Animator (that add Animator script to prefab too)
From xxxx_SkeletonData context menu I did 'Generate Mecanim Controller'
Now my prefab has the following scripts:
Transform
Skeleton Mesh (Mesh Filter)
Animator (with right Controller)
Skeleton Animator (with the xxxx_SkeletonData)
other personal script...
Now I have that the character is moving using Parameters definid into Unity Animator but how should I use the advanced runtime features ?
All the example into runtimes make use of SkeletonAnimation
Thanks!
7 years ago
- matteo.piccioni
- Mesajlar: 7
Mitch
SkeletonAnimation and SkeletonAnimator both derive from SkeletonRenderer. Most everything still applies the same. SkeletonUtility still works with SkeletonAnimator as well as they both implement the ISkeletonAnimation interface.
7 years ago
-
Mitch - Mesajlar: 978
Xelnath
I struggled with this myself, Matteo.
In the end, I ended up writing my own character controller because I'm insane like that. However, for everything except manually assigning the animations by later, the Mechanim direction is more intuitive to learn up front.
In the end, I ended up writing my own character controller because I'm insane like that. However, for everything except manually assigning the animations by later, the Mechanim direction is more intuitive to learn up front.
7 years ago
- Xelnath
- Mesajlar: 408
matteo.piccioni
Thanks for answers,
Xelnath you mean the Mechanim direction using Backing or using SkeletonAnimator ?
Xelnath you mean the Mechanim direction using Backing or using SkeletonAnimator ?
7 years ago
- matteo.piccioni
- Mesajlar: 7
frp529
Mitch said:"If you use SkeletonAnimator (not SkeletonAnimation) you kind of get the best of both worlds... but there are still some inherent problems with SkeletonAnimator because of the way Mecanim handles blending."
I use SkeletonAnimotor create a very simple demo.But there is a problem after animation transition.I don't know why.
Here is the link:
http://esotericsoftware.com/forum/Spine-animation-second-frame-wrong-when-using-animator-4965?p=23266#p23266
I use SkeletonAnimotor create a very simple demo.But there is a problem after animation transition.I don't know why.
Here is the link:
http://esotericsoftware.com/forum/Spine-animation-second-frame-wrong-when-using-animator-4965?p=23266#p23266
6.5 years ago
- frp529
- Mesajlar: 2
decoamorim
To create the mecanim layer mask is the same as in 3D?You do it the normal Mecanim way. Create a new Layer in the Animator.
Developer/Founder at DCF Studios
http://www.studiosdcf.com/
Author of
Cruz Brothers[PS4 / STEAM] [upcoming on XboxOne] - http://www.cruzbrothersgame.com
Bunny Battle Arena[STEAM] - https://store.steampowered.com/app/872340/Bunny_Battle_Arena/
http://www.studiosdcf.com/
Author of
Cruz Brothers[PS4 / STEAM] [upcoming on XboxOne] - http://www.cruzbrothersgame.com
Bunny Battle Arena[STEAM] - https://store.steampowered.com/app/872340/Bunny_Battle_Arena/
6.5 years ago
-
decoamorim - Mesajlar: 130
Mark topic unread
• 1. sayfa (Toplam 1 sayfa)
Dön Unity
- Tüm zamanlar UTC