Khalram

  • 14 نوفمبر 2013
  • انضمّ(ت) 27 يوليو 2013
    • تم التحرير

    Greetings fellow Spiners,

    I'm having some problems with the Unity 3D c# runtime. I'm trying to load a different atlas (created in the Editor) and using one of the images there as an attachment, but it turns invisible when I try to attach it.

    // Doesn't work
    AtlasAttachmentLoader loader = new AtlasAttachmentLoader( atlas.GetAtlas() );
    RegionAttachment att2 =  loader.NewAttachment(skeletonAnimation.skeleton.Data.Skins[0], AttachmentType.region, "hat") as RegionAttachment;
    

    I'm able to attach something I get from the it's own skeleton, but not from a different atlas nor it's own atlas.

    // Works
    Skeleton s = new Skeleton(dataAsset.GetSkeletonData(true));
    Attachment att1 = s.GetAttachment("hat", "hat");
    skeletonAnimation.skeleton.FindSlot("left hand").Attachment = att1;
    

    Pretty lost on this one, if you guys could provide some help I'll mail you a shot of Caipirinha :beer: .
    Thanks in advance! 🙂

    Hey, dude. Can you give us a little more information on what you're trying to do?
    I get that you're trying to attach something to a bone, is that it?
    Which runtime are you using?

    Nate wrote

    Do it like this:

    skeletonNode = CCSkeletonAnimation::createWithFile("spineboy.json", "spineboy.atlas");
    skeletonNode->addAnimationState(); // Makes additional state available.
    skeletonNode->setAnimation("run_weapon", true, 0);
    skeletonNode->setAnimation("shoot_pull", false, 1); // Uses additional state.
    

    You're awesome, dude. Thanks! :clap:

    Thanks for the quick answer, Nate!

    Doing it like this the character does not animate, although he does change the attachments for the hands (he equips the bow and arrow):

    				AnimationState *state1 = AnimationState_create(skeletonNode->getAnimationStateData());
    				AnimationState_setAnimationByName(state1, "shoot_pull", false);
    				AnimationState_apply(state1, skeletonNode->skeleton);	

    The getAnimationStateData is something I did for saving me the trouble, it just does this:

    return stateDatas[stateIndex];

    Hey Nate, can you help me out?
    I'm trying to combine some animations, but I'm having some problems in cocos2d-x.
    If I just set an animation on top of another it doesn't work.
    I'm trying to mix the shooting and walking animation with no success.
    This is the result:
     Loading Image

    I'm doing it like this:

    skeletonNode->setMix("run_weapon", "shoot_pull", 0.25f);
    ...
    skeletonNode->setAnimation("run_weapon", true);

    And then:

    skeletonNode->setAnimation("shoot_pull", false);

    He freezes the legs but the shooting animation keeps rolling.
    The shooting animation has keys just for the arms while the walking animation keys the whole body.
    Am I doing something wrong?
    Thanks! :rock:

    • تم التحرير

    Greetings fellow game designers.
    I created this thread so we can express our gratitude for this amazing software.
    Every time I open Spine and read documentation I get psyched to work on it and code with it.
    2D skeletal animation finally got the support it deserved, and the price on this software is incredibly low.
    Will use it in every game I can, and I'll be watching Esoteric Software for any new stuff.
    Thanks for this well-polished, very useful tool.