DSE Posted September 12, 2015 Report Share Posted September 12, 2015 Its my own framework based on opentk/opengl. I have found another small issue if you are interested, its fairly odd and is only happening on a couple of animations on the goblin guy. Do you want the information ? Quote Link to comment Share on other sites More sharing options...
loodakrawa Posted September 13, 2015 Author Report Share Posted September 13, 2015 Its my own framework based on opentk/opengl. I have found another small issue if you are interested, its fairly odd and is only happening on a couple of animations on the goblin guy. Do you want the information ? Yeah, absolutely. Just try to describe the issue as best as you can and pinpoint the exact .scml / animation / time and I'll give my best to fix it. Quote Link to comment Share on other sites More sharing options...
DSE Posted September 13, 2015 Report Share Posted September 13, 2015 ok its - "Goblin_enemy_smallhead.scml" and the "to_Ladder" animation. The animation runs but the shoulders and feet end up in the wrong location and the shield disappears. Hope that helps. Quote Link to comment Share on other sites More sharing options...
Mike at BrashMonkey Posted September 13, 2015 Report Share Posted September 13, 2015 I have two guesses for why this would have issues: 1) This animation has keyframes set to "instant" for the speed-curve...this mean the key frame does NOT tween at all.. it holds static for it's entire duration and then instantly pops to coordinates/transforms etc of the next keyframe once it reaches it. 2) This animation might not have bones for every image... or they might be different bones from the other animations. So, for animations like these, you can NOT tween from one animation to it, or from it to another animation, you must just immediately switch to or from these animations. Trying to tween to or from these animations would definitely lead to strange and unwanted results. cheers,Mike at BrashMonkey Quote Link to comment Share on other sites More sharing options...
lucid Posted September 13, 2015 Report Share Posted September 13, 2015 That makes sense. All seems to work now inside my framework :cool: I had one issue with the bat animations where the 'a' attribute can be "nan". Thank you for finding this. Saving "nan" to any value is definitely a bug and your workaround is exactly what I would have suggested. I will have a look into why this happened as soon as I can. and @loodakrawa, great job on the implementation overall. You seem to be making awesome progress. Quote Link to comment Share on other sites More sharing options...
loodakrawa Posted September 15, 2015 Author Report Share Posted September 15, 2015 Thanks! :) There's definitely an issue with this. Everything except the last keyframe seems to be working fine. Also the instant curve works as it should - not interpolating between keys, just showing the last keyframe. But in the last keyframe (Time = 171) something goes wrong and everything is at a weird angle/position. I manually stepped through the code and it seems that everything gets calculated as per the scml. @Lucid, any ideas what might be the cause? Screenshots of the anim at the 3 keyframes: Quote Link to comment Share on other sites More sharing options...
Mike at BrashMonkey Posted September 15, 2015 Report Share Posted September 15, 2015 Hmm... at a glance this might be due to improper support for negative scale image or bones.. for example to flip an image, set its x scale to -1.0 cheers. Quote Link to comment Share on other sites More sharing options...
loodakrawa Posted September 15, 2015 Author Report Share Posted September 15, 2015 Yeah, it is related to negative scales and angles. I managed to find a solution but I'm waiting for lucid to confirm (sent him a pm) if I got that right. Quote Link to comment Share on other sites More sharing options...
lucid Posted September 15, 2015 Report Share Posted September 15, 2015 Hi loodakrawa,See if this helps: // before adding the parent.angle to child.angleif(parentInfo.scaleX*parentInfo.scaleY<0) // if one, but not both are negative{ child.angle*=-1; // or child.angle=360-child.angle // (if you want to keep it within the 0 - 360 range)} loudo 1 Quote Link to comment Share on other sites More sharing options...
loodakrawa Posted September 15, 2015 Author Report Share Posted September 15, 2015 Fixed, thanks. @All if you find any other issues, please let me know. lucid 1 Quote Link to comment Share on other sites More sharing options...
loodakrawa Posted October 6, 2015 Author Report Share Posted October 6, 2015 Implemented Animation Blending. Changed the license from MIT to zlib. Quote Link to comment Share on other sites More sharing options...
loodakrawa Posted October 17, 2015 Author Report Share Posted October 17, 2015 Massive update. SpriterDotNet now implements ALL Spriter features. :mrgreen: Quote Link to comment Share on other sites More sharing options...
Aprowolf Posted October 19, 2015 Report Share Posted October 19, 2015 First of all , Amazing job , and congratulations on releasing the Implementation :)I am testing this Importer atm . I dunno how I missed it XDI have came across 1 Issue though : Shifting child transform position.x and .y disturb The looks of some of the animationsthat happens on the line 54, in apply transform , in UnitySpriterAnimator child.transform.localPosition = new Vector3(deltaX, deltaY, child.transform.localPosition.z); and solved to me by the line child.transform.localPosition = new Vector3 (0, 0, child.transform.localPosition.z); for all my scmls. That Solved my Issue by making the child always takes the local 0,0 x y position and keep z position / while only the parent takes the x y world position and rotation. I just wanted to point out my solution should someone experiance similar thing Also , brilliant job :) Quote Link to comment Share on other sites More sharing options...
loodakrawa Posted October 19, 2015 Author Report Share Posted October 19, 2015 First of all , Amazing job , and congratulations on releasing the Implementation :) I am testing this Importer atm . I dunno how I missed it XD I have came across 1 Issue though : Shifting child transform position.x and .y disturb The looks of some of the animations that happens on the line 54, in apply transform , in UnitySpriterAnimator child.transform.localPosition = new Vector3(deltaX, deltaY, child.transform.localPosition.z); and solved to me by the line child.transform.localPosition = new Vector3 (0, 0, child.transform.localPosition.z); for all my scmls. That Solved my Issue by making the child always takes the local 0,0 x y position and keep z position / while only the parent takes the x y world position and rotation. I just wanted to point out my solution should someone experiance similar thing Also , brilliant job :) Glad you like it :) Which animation is affected by this? In the next couple of weeks I'll add support for the remaining features in the Unity plugin so I'll probably heavily modify the current version but still, I'd like to keep an eye for these potential bugs. Quote Link to comment Share on other sites More sharing options...
Aprowolf Posted October 19, 2015 Report Share Posted October 19, 2015 The Way I Understand It Happens that the "child game object" x, y is relative to the "parent", while the parent x,y is relative to world. that is why sitting the child to 0,0 fixes the Issue. Quote Link to comment Share on other sites More sharing options...
Aprowolf Posted October 19, 2015 Report Share Posted October 19, 2015 Almost forgor ^^ Fast question : The Alpha Channel on Sprites inside sprite renderer are not yet to be Implemented no? because I can not see my alpha channel changing Quote Link to comment Share on other sites More sharing options...
loodakrawa Posted October 19, 2015 Author Report Share Posted October 19, 2015 Almost forgor ^^ Fast question : The Alpha Channel on Sprites inside sprite renderer are not yet to be Implemented no? because I can not see my alpha channel changing Yeah, I didn't even realise that. The Unity plugin is a little behind the MonoGame example because I've been focusing on implementing all the features in the core library. With that finished, I'll focus on fixing the Unity plugin ASAP. Thanks for reporting the issue! Quote Link to comment Share on other sites More sharing options...
memer Posted October 19, 2015 Report Share Posted October 19, 2015 Thanks for the great work loodakrawa and others, to ask a stupid question is there a small guide on how to set this up for unity since it's new? Do we use the spriter2unity plugin from here : http://brashmonkey.com/forum/index.php?/topic/3993-spriter-for-unity-50/ ? Quote Link to comment Share on other sites More sharing options...
hippyman Posted October 19, 2015 Report Share Posted October 19, 2015 For starters I just want to say thanks for making this! Is there any chance you could put together something to help others understand a little better how the implementation works? It does work with minor issues. I had one crash when transitioning animations on the green rectangle scml file but I didn't look into it too much. Overall it's nice and clean and works quickly. My only issue is that there's literally like no comments and for somebody who doesn't know c# that makes things a bit difficult. I really don't need much, I was just hoping you could make like a flow chart or a diagram to show how everything works together along with a SCML file. PS Sorry to sound ungrateful, I really don't want you to think that's what this is. This is extremely cool that you have a full-featured implementation! :D Quote Link to comment Share on other sites More sharing options...
loodakrawa Posted October 19, 2015 Author Report Share Posted October 19, 2015 Thanks for the great work loodakrawa and others, to ask a stupid question is there a small guide on how to set this up for unity since it's new? Do we use the spriter2unity plugin from here : http://brashmonkey.com/forum/index.php?/topic/3993-spriter-for-unity-50/ ? There's a Unity project in the SpriterDotNet repo. It is not up to date due to a recent push to implement all the features in the core library. However, it's being worked on and should be complete soon (as a nice Unity package). For starters I just want to say thanks for making this! Is there any chance you could put together something to help others understand a little better how the implementation works? It does work with minor issues. I had one crash when transitioning animations on the green rectangle scml file but I didn't look into it too much. Overall it's nice and clean and works quickly. My only issue is that there's literally like no comments and for somebody who doesn't know c# that makes things a bit difficult. I really don't need much, I was just hoping you could make like a flow chart or a diagram to show how everything works together along with a SCML file. PS Sorry to sound ungrateful, I really don't want you to think that's what this is. This is extremely cool that you have a full-featured implementation! :D Thanks for the feedback! While writing the library I took really a lot of effort into breaking down everything into smallest possible methods and naming everything in a consistent and meaningful way (hoping to have self-documenting code). Also, I used only the most common data structures which are available in virtually any language. But I understand why it might be a bit hard to understand, especially if you're not familiar with the scml data structure. In light of this, I will add a document that explains the general flow. In the meantime, you can start by looking at the "main" method and trying to follow the flow while keeping any scml open for reference. I've added a note about animation blending in the official documentation. The crash you discovered should not be happening and I'll fix it asap. hippyman 1 Quote Link to comment Share on other sites More sharing options...
hippyman Posted October 20, 2015 Report Share Posted October 20, 2015 Thanks for the feedback! While writing the library I took really a lot of effort into breaking down everything into smallest possible methods and naming everything in a consistent and meaningful way (hoping to have self-documenting code). Also, I used only the most common data structures which are available in virtually any language. But I understand why it might be a bit hard to understand, especially if you're not familiar with the scml data structure. In light of this, I will add a document that explains the general flow. In the meantime, you can start by looking at the "main" method and trying to follow the flow while keeping any scml open for reference. I've added a note about animation blending in the official documentation. The crash you discovered should not be happening and I'll fix it asap. Very cool to hear and I definitely look forward to it. I'll take a closer look at everything next time I run through it all again. Quote Link to comment Share on other sites More sharing options...
loodakrawa Posted October 25, 2015 Author Report Share Posted October 25, 2015 The Way I Understand It Happens that the "child game object" x, y is relative to the "parent", while the parent x,y is relative to world. that is why sitting the child to 0,0 fixes the Issue. I've been looking into the issue you're having and couldn't replicate it. The DeltaX and DeltaY take care of the Spriter's pivot point. If you set it to 0,0 it's not going to work properly if anything has a non default pivot point. The only other thing I could think of is pivot points of imported Sprites in Unity. The plugin assumes that the Sprites are imported with Unity's default settings. Let me know if this helps. Quote Link to comment Share on other sites More sharing options...
Aprowolf Posted October 26, 2015 Report Share Posted October 26, 2015 Ah no no , The 0,0 "fix" is for the (Child) game object NOT for the pivots points. Examine the game objects that has has name "child" to it and check their "transform" position :)this is the suggested Fix , and it sets the child game object to 0,0again , not the pivots , the child objects, you transform.position.x and .y had deltaXandDeltaY affecting the local position in the original code Oirginal : child.transform.localPosition = new Vector3(deltaX, deltaY, child.transform.localPosition.z); Suggested Fix: protected override void ApplyTransform (Sprite sprite, SpriterObjectInfo info) { GameObject child = children [index]; GameObject pivot = pivots [index]; SpriteRenderer renderer = renderers [index]; float ppu = sprite.pixelsPerUnit; renderer.sprite = sprite; Vector3 size = sprite.bounds.size; float deltaX = (0.5f - info.PivotX) * size.x * info.ScaleX; float deltaY = (0.5f - info.PivotY) * size.y * info.ScaleY; pivot.transform.localEulerAngles = new Vector3 (0, 0, info.Angle); pivot.transform.localPosition = new Vector3 (info.X / ppu, info.Y / ppu, 0); child.transform.localPosition = new Vector3 (0, 0, child.transform.localPosition.z); //The fix Suggested if anyone has "position" of game objects appearing in diffrent places child.transform.localScale = new Vector3 (info.ScaleX, info.ScaleY, 1); ++index; } In case you can not replicate the Issue still , I'll be releasing my game in the next 3~5 days , and I'll be more than happy to share any file with you and the community to improve the New scml Importer :)Check you message box for sample file~I tried my fix on "Grey Guy" example and it was distorted, then it worked properly when i changed pivots from "center" into the respective human anchoring points. it is 6am in the morning now , I am heading to bed and will test it again hopfully as soon as i finish my game and should not get distracted XD hopefully you'll find the smaple file helpful ^^ Quote Link to comment Share on other sites More sharing options...
loodakrawa Posted October 26, 2015 Author Report Share Posted October 26, 2015 I probably haven't explained it well enough. The pivot I was referring to is Spriter's pivot point, not the "pivot" object created in Unity. The "pivot" in Unity is basically the position of the object and it's being set to X and Y and the "child" is moved by deltaX and deltaY to account for the pivot point defined in Spriter. I took a quick look to the files you sent me. If you check the .meta files of your /parts folder you'll notice that the spritePivot property is not {x: 0.5, y: 0.5} as it should be with the default settings. I'm pretty sure resetting the pivot point of your sprites in Unity should fix the issue. I will however try to incorporate support for sprites with different pivot points. Quote Link to comment Share on other sites More sharing options...
Aprowolf Posted October 26, 2015 Report Share Posted October 26, 2015 Ooh I see, I tried changing the Unity sprites pivots points to default (center) and it fixed it XD Cheers bro ^^It is because almost every sprite I have has a costume pivot point ii did not this that this was not supported, but it is kool kool since it is working fine ^^ thx bro Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.