Drakkheim

  • 3 feb 2023
  • Si è iscritto 24 gen 2013
  • well for the falling, I'd think you'd want a separate body and have it be a dynamic body and have it drive the skeleton position, then use a filter group to keep it from colliding with the skeleton's body.

    as for flipping the body.. Im afraid I dunno.. my character only goes to the right

  • Hi Kate,
    I think you'll have to manually flip the body in the world when you flip the character.

    And the falling down stuff gets complicated, like building joints between the bodies and letting the bodies drive the position of the bones rather than the Spine animation.

    I'd love to have instant ragdoll creation build into Spine, but I think it's a bit beyond what we can expect an animation tool to provide.

  • Hm my Spine src is from 6/28 and the LibGDX nightlies are about a month old, I don't recall needing to fix anything. :-/

    And I'm using the json skeleton rather than the binary exports, but thge index error could be if your Atlas file hasn't been refreshed?

    and here's what I popped into my BoxAtlasAttachmentLoader

    import com.badlogic.gdx.graphics.g2d.TextureAtlas;
    import com.badlogic.gdx.graphics.g2d.TextureAtlas.AtlasRegion;
    import com.badlogic.gdx.physics.box2d.Body;
    import com.esotericsoftware.spine.Skin;
    import com.esotericsoftware.spine.attachments.AttachmentLoader;
    import com.esotericsoftware.spine.attachments.AttachmentType;
    import com.esotericsoftware.spine.attachments.RegionAttachment;
    
    public class BoxAtlasAttachmentLoader  implements AttachmentLoader {
    	private TextureAtlas atlas;
    
    public BoxAtlasAttachmentLoader (TextureAtlas atlas) {
    	if (atlas == null) throw new IllegalArgumentException("atlas cannot be null.");
    	this.atlas = atlas;
    }
    
    public Box2dAttachment newAttachment (Skin skin, AttachmentType type, String name) {
    	Box2dAttachment attachment = new Box2dAttachment(name);
    	AtlasRegion region = atlas.findRegion(attachment.getName());
    	if (region == null) throw new RuntimeException("Region not found in atlas: " + attachment);
    	attachment.setRegion(region);
    	return attachment;		
    }
    static class Box2dAttachment extends RegionAttachment {
    	Body body;
    
    	public Box2dAttachment (String name) {
    		super(name);
    	}
    }
    }
    
  • And also in the update I had to add the skeleton.x and y to the bone's world offsets... but that could just be me doing something.. wrong.

  • Well I wound up making a BoxAtlasAttachmentLoader class and have that make the RegionAttachement into Box2dAttachment, now I just gotta get all the attachments put into the right position rather than in a pile at 0,0 .. oh well progress is progress

  • Wouldnt that be stretching your image? I can't imagine that would give you acceptable output for anything other than the most simple flat shapes.

  • Yeah I got it working in 8 🙂 took me a while to find out that keying the root bone makes it unmovable 🙂

  • uer.. just saw that 108 is available.

    PLEEEASE make the notice that there's a new version bigger and more noticeable.. it fades so fast and is so tiny. will try 108 and see if that works. (and maybe a sticky thread with the latest version number on it's title)

    thanks.

    • Modificato
  • I'm getting an odd error when trying to get a basic file working by following the quickstart at http://software-workshop.eu/content/spi ... et-started

     
    Exception in thread "LWJGL Application" com.badlogic.gdx.utils.GdxRuntimeException: com.badlogic.gdx.utils.SerializationException: Unknown attachment type: 4 (X chain [Gibberish]  at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:113)
    Caused by: com.badlogic.gdx.utils.SerializationException: Unknown attachment type: 4 (X[Gibberish] )
    	at com.esotericsoftware.spine.SkeletonBinary.readAttachment(SkeletonBinary.java:143)
    	at com.esotericsoftware.spine.SkeletonBinary.readSkin(SkeletonBinary.java:121)
    

    I've attached a zip with the exported files .. (not the image atlas though)

    Using 1.06 any ideas, I'm not doing anything odd or strange as far as I can tell..