Venomlemon

  • 21 de Abr de 2016
  • Entrou em 16 de Ago de 2013
  • Oh, amazing how I have missed that! Thanks @Pharan 🙂

    As a future reference to anyone who might have similar problem I uploaded path to adding the mix as an attachment.

  • [SOLVED]

    Problem:
    Is there a way to remove tweening in bones at start of a certain animation? I have a main characters run animation and hit animation and while in normal situation I want bones to tween when changing for instance from running into idle, I don't want to do this always. For instance when character hits I don't want her arm to first tween into starting keyframe of the hit animation but I want the bones of the arm instantly start from certain coordinates + scale every time the hit animation is played.

    Solution:
    Apparently clearing up the currently playing track right before applying the next animation is a solution to this problem. Here's the function I used to achieve solution:

    void ForceAnimation(SkeletonAnimation anim, int layer, string name, bool trueornot, float timeScale)
    {
       if(name == currentAnimation)
          return;
       
    anim.timeScale = timeScale; anim.state.ClearTrack(0); anim.state.SetAnimation(layer, name, trueornot); currentAnimation = name; }
  • SOLVED: While I don't entirely understand why it worked, it helped that hit animations are not set on loop... =)

    Heya, this is most likely due my inability as a coder but I've got a question...

    The setup
    Right now I've got Unity project with 4 direction movement using Spine animations. I've got a game object for each skeleton (front, back, side) and a animation controller that changes between walk, idle and attack animations and based on what direction you are facing it disables the other game objects (= if you turn right, the objects with front and back animations get disabled).

    Problem
    If I hit downward and in middle of attack animation turn left (game object that contains downward hit gets disabled) the hit animation is "stored" and even after 3-4 minutes if I then return back facing downwards the hit animation resumes where it left off before disabling the game object that contains it.

    Here's part of my animation controller

    public class c_playeranimationcontroller : MonoBehaviour 
    {
    
       public GameObject animations_front;
       public GameObject animations_back;
       public GameObject animations_side;
       public GameObject hitAndUseArea;
       GameObject player;
       c_playercontroller Player_c;
       SkeletonAnimation skel_front;
       SkeletonAnimation skel_back;
       SkeletonAnimation skel_side;
       string currentAnimation = "";
    
    
       //Set the connections to other scripts etc.
       void Start()
       {
          skel_front =  animations_front.GetComponent<SkeletonAnimation>();
          skel_back =  animations_back.GetComponent<SkeletonAnimation>();
          skel_side =  animations_side.GetComponent<SkeletonAnimation>();
          player = GameObject.FindGameObjectWithTag("Player"); 
          Player_c = player.GetComponent<c_playercontroller>();
       }
          
    //Listen to animation changes constantly void Update() { animateWalk(); }
    //ATTACK ANIMATIONS public void animateAttack() { if(Player_c.direction == c_playercontroller.Direction.Up) {
    PlayAnimation(skel_back, 0, "hit_back", true); } else if(Player_c.direction == c_playercontroller.Direction.Down) {
    PlayAnimation(skel_front, 0, "hit_front", true); } else if(Player_c.direction == c_playercontroller.Direction.Right) {
    PlayAnimation(skel_side, 0, "hit_side", true); } else if(Player_c.direction == c_playercontroller.Direction.Left) {
    PlayAnimation(skel_side, 0, "hit_side", true); } } //WALK AND IDLE ANIMATIONS void animateWalk() { if(!Player_c.isHitting){ if(Player_c.input_y != 0 || Player_c.input_x != 0) {
    if(Mathf.Abs(Player_c.input_y) > Mathf.Abs(Player_c.input_x)) { if (Player_c.input_y > 0) {
    animations_front.SetActive(false); animations_side.SetActive(false); animations_back.SetActive(true); PlayAnimation(skel_back, 0, "walk_back", true); Player_c.direction = c_playercontroller.Direction.Up; hitAndUseArea.transform.position = transform.position + new Vector3(0,-7,0); } else if (Player_c.input_y < 0) { animations_front.SetActive(true); animations_side.SetActive(false); animations_back.SetActive(false); PlayAnimation(skel_front, 0, "walk_front", true); Player_c.direction = c_playercontroller.Direction.Down; hitAndUseArea.transform.position = transform.position + new Vector3(0,-42,0); } } else { if (Player_c.input_x > 0) { animations_front.SetActive(false); animations_side.SetActive(true); animations_back.SetActive(false); animations_side.transform.localRotation = Quaternion.Euler(0,0,0); PlayAnimation(skel_side, 0, "walk_side", true); Player_c.direction = c_playercontroller.Direction.Right;
    hitAndUseArea.transform.position = transform.position + new Vector3(28,-20,0); } else if (Player_c.input_x < 0) { animations_front.SetActive(false); animations_side.SetActive(true); animations_back.SetActive(false); animations_side.transform.localRotation = Quaternion.Euler(0,180,0); PlayAnimation(skel_side, 0, "walk_side", true); Player_c.direction = c_playercontroller.Direction.Left; hitAndUseArea.transform.position = transform.position + new Vector3(-28,-20,0); } } } else { if(Player_c.direction == c_playercontroller.Direction.Up) { PlayAnimation(skel_back, 0, "stand_back", true);} else if(Player_c.direction == c_playercontroller.Direction.Down) { PlayAnimation(skel_front, 0, "stand_front", true);} else if(Player_c.direction == c_playercontroller.Direction.Right) { PlayAnimation(skel_side, 0, "stand_side", true);} else if(Player_c.direction == c_playercontroller.Direction.Left) { PlayAnimation(skel_side, 0, "stand_side", true);} } } }
    //SPINE FUNCTION FOR STARTING ANIMATION void PlayAnimation(SkeletonAnimation anim, int layer, string name, bool trueornot) { if(name == currentAnimation) return; anim.state.SetAnimation(layer, name, trueornot); currentAnimation = name; }

    Is there a call for reset-animation. Any other ideas?

  • Just wanted to drop in and support this feature request. Spine is by far the best animation software for games that I've ever used. Ability to have the time line trigger a sound file in editor would make it perfect for me though. Sometimes it's important to sync sound and animation to work seamlessly together and having editor to playback desired sound file would really help and speed up this work.

    Cheers for all your hard work on this awesome piece of software, my life is so much easier thanks to Spine.

  • Thanks! 🙂 it seems actually bit similar to what I've cooked up.

  • Hey guys, Spine has been invaluable tool for me in game development with my recently released game (www.bunkerthegame.com) and now I am about to start a new project, this time with the Unity 5.

    I've been thinking about implementing 4-way (or alternatively 8-way) movement to my new project and been trying to find the best way to handle different directions, that naturally would be using different skeletons.

    Em I best off just using 4 different SkeletonData-assets that I enable and disable depending on what direction my character is facing, or is there a way to change/swap active skeleton in some other way that I am not aware of?

  • Hello,

    I am currently trying to install Spine runtime into Unity3D and I get the following errors:

    Script 'Animation has the same name as built-in Unity component. AddComponent and GetComponent will not work with this script.
    Assets/spine-unity/SkeletonUtility/SkeletonUtility.cs(61,34): warning CS0219: The variable 'attachments' is assigned but its value is never used
    NullReferenceException: Object reference not set to an instance of an object. SpineEditorUtilities.ResetExistingSkeletonData (System.String skeletonJSONPath) (at Assets/spine-unity/Editor/SpineEditorUtilities.cs:386)

    I am using Unity3d version 4.6.3f1
    Spine is 2.1.20

    I did find Spine related "create skeletonAnimation" in hierarchy from "create other" folder and I was able to get character to work in Spine, however... I suspect I am doing something wrong here?

  • I don't know about rest of the Spine users, but my project would benefit from masking regardless the run times. All graphics I've produced with Spine are exported into .png sequenced pictures anyways.