Jump to content

loodakrawa

Members
  • Posts

    161
  • Joined

  • Last visited

  • Days Won

    19

Posts posted by loodakrawa

  1. 12 hours ago, alex2020 said:

    Hi

    i wrote a class for script processing (for the tags and variables) but i don´t want it to run on every update.

    Is there a way to check if the frame is a keyframe ?

    like:

    
    // pseudocode:
    if (animator->isKeyframe()){
      doMyScript();
    }

     

    Well, there's nothing built-in if that's what you're asking. Key frames are not special in regards to the actual animation, especially since you can advance the simulation with any delta time which can cause the current frame to never land exactly on a keyframe.

    That being said, you can probably achieve it by inspecting the keyframe times yourself via animator->Entity->CurrentAnimation->etc and keeping track when you pass a keyframe.

    Alternatively you can add events to the animation and subscribe via the Animator->EventTriggered event.

  2. On 12/11/2018 at 2:10 AM, Vincent Laugier said:

    Hi, I'm trying to do the following (in Unity):

    • pause a running animation
    • resume a paused animation
    • jump to a given key of an animation
    • hook to the end of an animation (in order to notify that the animation has stopped playing)

    EDIT (some solutions): 

    To hook to the end of an animation, see 'AnimationFinished' in Animator.cs

    For jumping to the given key of an animation, here is a solution that works for my use case, I added the following function in Animator.cs (it's an adaptation of the 'Play' function)

     

    Hi,

    As you already figured out you can pause and resume by setting the Speed property. For the end of the animation - Animator.cs exposes the AnimationFinished event which you can subscribe to.

    As for jumping to specific keys - what's the use case for that? Could you achieve the same effect by splitting the animation into several smaller ones and then just switch animations instead of jumping to different keys?

  3. On 4/11/2018 at 9:07 AM, alex2020 said:

    Hi,
    i´m trying to implement some kind of normal mapping in monogame.
    For this i have to switch the character map in the draw loop.
    Is this possible?
    It seems like i have to wait until the next update until the character map changes takes effect.

    I draw the player to a rendertarget, then i push a character map to the player (the normal map) and draw the player again to my normalmap-rendertarget.
    Then i use a shader to combine those two rendertargets.

    Or do you have a better idea for this?
    Maybe 2 player objects with different character maps, but i thinks it will be difficult to keep both in sync...

    Hey,

    How about implementing a custom Animator that has both the Texture and Normal data as the sprite parameter? Something like:

    class CustomAnimator : Animator<TextureNormal, SoundEffect>

    With TextureNormal being some kind of datastructure that has both your texture and normal data. That way you can draw both with one loop.

  4. On 3/3/2018 at 1:46 PM, Aaike64 said:

    I´m starting a project with Libgdx and Spriter but your work sounds very interesting. Does this work with Xamarin Forms?

    I have no experience with Xamarin Forms - but I don't see why not. The core library just basically crunches numbers and gives you the numbers about the required transform. You "only" need to map it to something visual - which I assume you can do with Xamarin Forms.

  5. On 2/1/2018 at 7:07 PM, Mito said:

    Hi, im new here :P

    I have some issues (i use monogame with visual studio 2005)

    1.- i Tried to import spriterdotnet.monogame 1.6.1 from nuget but when  it has installed send me some errors with Monogame.framenetwork... the same thing happen with spriterdotnet.monogame.importer 1.6.1... after that i choose the 1.6 version

     

    2.- With 1.6 version i follow the example in github but in this part 

    SpriterContentLoader loader = new SpriterContentLoader(Content, scmlPath);

    loader.Fill(factory);

    the loader fill part send me a null error message :(

     

    I will be grateful if you can help me :)

    What kind of errors are you getting? Especially for the 1.6.1 version

  6. On 1/21/2018 at 8:34 AM, johns1111 said:

    Hi,

    I could not find any tutorial and/or answer to this in the forum (only a few suggestions that the feature should be there):

    Is there a way to explicitly position a bone such as manipulating it before the animation state or directly after? Typical example having a run animation with the weapon arm always targeting the mouse, so the weapon/arm would have to be rotated and positioned after applying the animation state. If this exists, does it also support simple IK so that for example the upper arm does not become disconnected from the weapon?

    My target framework is Monogame.

    Hi,

    At the moment there's no API to do such a thing. I plan to add stuff like this into the new version (one fine day in the future). However, if you end up implementing something like that, please consider submitting a PR - I gladly accept contributions :)

    p.s. MonoGame is awesome

  7. 2 hours ago, Ori Pessach said:

    Sadly, the amount of work needed to support this makes that unfeasible for me at this time. I have a game to finish...

    Same here. I work on this library between a full-time job and the game I do in my spare time which unfortunately doesn't really leave a lot of time. I plan to rewrite the core of the library and add more advanced features in the future but that will take a while.

  8. On 12/26/2017 at 12:15 PM, Ori Pessach said:

    I have a related question - I also need to run two animations at the same time, when each animation affects different parts of my character. That's a bit like the blinking scenario, only more elaborate (so it can't be solved by swapping out sprites.)

    The character has an attack that's done by waving one arm around. Because it's only one arm, I was able to implement this using Unity's animation layers - the attack is an animation that only moves the arm. Other animations (walking, jumping, the idle animation) affect other body parts. The attack animation is triggered by setting a boolean to true, and the rest is done by Unity's animation system. The result is pretty cool - the character can be walking, jumping or just standing, and start the attack immediately, regardless of where it is in the animation cycle. 

    This was done with Spriter2UnityDX, and it works pretty well, except that I've reached the limits of what Spriter2UnityDX can handle (specifically, it messes up the z ordering of more complex characters) and I'm looking to migrate to using SpriterDotNet - the one blocking issue is that I don't see any way to implement the attack as described above. 

    Any ideas on how to do that?

    Thanks,

    Ori

    I don't think you can do this directly without some kind of trickery. Maybe have a completely separate entity for the arm and just play it on top of the rest of the character?

     

     

    On 12/30/2017 at 11:19 AM, Ori Pessach said:

    The functionality doesn't seem to be there, which is a shame - it's very useful and there doesn't seem to be a workaround to do what I need to do.

     

     

    On 12/31/2017 at 4:07 PM, Ori Pessach said:

    Another thing that doesn't seem to be supported (at least with the mecanim addon) is blend trees.

    You're right, blend trees are not supported yet + lots of other advanced blending techniques. But feel free to implement them and open a PR and I'll gladly merge it.

  9. 3 hours ago, poewang13 said:

    animator.EventTriggered += e => Debug.Log("Event Triggered. Source: " + animator.CurrentAnimation.Name + ". Value: " + e);

    This line literally is registering a function to the event.

    Try

    animator.EventTriggered += e => GiveDamage();

    Btw, this is basic C# - I recommend reading about Delegates, Events, Actions and Funcs.

  10. 10 hours ago, poewang13 said:

    Thank you for answer .Now I can change animations but I can't find event system.For example,I have a fire animation and after starting 0.5 seconds, I want add a event trigger for using InstantiateBullet function.How can I do that ? In spriter , I can add a point but the other things :( Can you record a video about this problem for everone after that can you can immobilize the first message

     
     
     

     

    Once again - the docs and examples are your friend.

  11. 2 hours ago, poewang13 said:

    Hi

    I am new user and I think , I miss somethink :(

    I watch a video in youtube about this plugin and I did samething but I have 2 problems ,firstly  I can see many GreyGuy's animations in spriter but I don't see them in unity.is this normal ? and How can I change the animations ? can I change animations with your code or must I write code ?

    Here spriter animations window and in unity,GreyGuy and no animations :( 

     

    Hi
    You can't see them because they are not listed. You're supposed to control them programmatically. You can use the code from the example to see how certain things are done but that alone won't get you far. For everything else - read the docs and try the examples.

  12. Not sure without debugging but I suspect your move is not actually zero. Checking floats for a specific value should be done with an epsilon not with an actual equality check.
    Something like:

    const float EPSILON = 0.001f; // basically a small threshold
    
    if(Math.Abs(move) < EPSILON) {
      // trigger Idle animation
    }

    If that's not it - just debug it.

  13.  

    18 hours ago, CJX3M said:

     

    Glad you fixed it - and don't worry, it happens to all of us :-D

    Adding this here for future reference.

    If you can't see your animation, check the following:
    1) all the images are imported as Sprites
    2) your animation game object has a normal scale
    3) your animation game object is not hidden by something in the front

    Also, the Controller is just a very basic example of how to control the animation, it does not get generated when importing .scml files. It's also worth noting that SpriterDotNet isn't integrated with the Unity's animation system and therefore needs to be controlled programmatically - hence the Controller in the example.

  14. 1 hour ago, ffman22 said:

    I have a question, does spriter dot net support the animatior controller in unity? 

    No since Unity's animation system doesn't support all the features Spriter has + it also doesn't provide enough low level access to do a proper integration (at least last time I checked). However, Dengar's implementation has a better integration with Unity so check that out. Also, there's another lib by Dengar that adds a portion of the same functionality to SdN) so you might want to check that as well.

  15. 7 hours ago, ThunerSkelett said:

    All the Animation i made shouldn't thei be in the .prefab ?

    It generates a distinct prefab for every Entity in your .scml file and each prefab has all the animations of the associated Entity. I still don't understand what your issue is - but hopefully this helps. If you still have issues - try first reading the SdN documentation and the Unity Specific documentation and then, if you still have an issue, explain it in detail here.

  16. On 10/25/2017 at 1:55 AM, ThunerSkelett said:

    I can now drag the .prefab into the game and if i start the game i see the Animation.

    The Problem is i can't acces the file for the  Animation anymore i checked on the example there it is  the same what could be the reason for that?

     

    What exactly do you mean by "i can't acces the file for the  Animation"?

  17. On 10/7/2017 at 9:51 PM, Noxalus said:

    Thank you for your answer @loodakrawa

    I was expecting to be able to do what is shown in the video, but didn't find anything about that in the documentation.

    Unfortunately, even if it's cool, it doesn't match my needs because the animation of the sub-entity is stuck to the timeline of the main entity, so they are not independent like I would like them to be.

    Another use case example is a "blink eyes" animation, I asked the question many months ago. You might want to have a "blink eyes" animation on an animated character that doesn't depend on every animation timelines, it's the same problem here.

    What I have done to achieve this is that I created a class SpriterSubstituteEntity that take a reference Animator, the filename to replace (it would be better to be the name in the Spriter hierarchy, but I didn't be able to find how to retrieve this info), and an another Animator to use as replacement. This class will synchronize (transform + color) the Animator used as substitute with the sprite part filename found in the reference Animator:

    
    new SpriterSubstituteEntity("play-button.png", Animators["MainMenu"], Animators["PlayButton"]);

    I also create a child class from MonoGameAnimator to be able to hide the idle "play-button" from the main menu animation.

    For now, it works like a charm :)

     

    I'm glad you managed to fix it - and this sounds like a perfectly good solution :-D

    That being said - I'm doing a major overhaul of the whole project and I'll try to design it in the most flexible way to allow easier customisations such as this.

  18. On 10/2/2017 at 1:14 AM, Noxalus said:

    Hello everyone! :)

    I'm currently trying to replace a sprite part of an entity by another entity, but I don't really know how to do it properly.

    I made a main menu screen into Spriter to easily place and animate every element. It works great, except I would like to animate each element independently.

    Let's take the example of the play button. I would like to give it a pulse animation, so I created a new entity "PlayButton" with a single "Pulse" animation next to my "MainMenu" entity with its "Idle" animation where I placed all elements. When I load the Spriter file in my game, I will display the "Idle" animation of the "MainMenu", but I would like to replace the idle play button by the "PlayButton" entity.

    For now, I add my 2 entities in my scene, and set the "PlayButton" entity position according to the position of the play button in the "MainMenu" entity. The problem is the idle play button is still visible. I already tried to hide it (alpha to 0, remove it from the Spriter collection, etc...), but it didn't work like I expected. In addition, I would like that the "PlayButton" entity follows the same behaviour than the play button from the "MainMenu" entity. If I decide to create an animation in the "MainMenu" entity that moves the play button out of the screen, I would like to combine this translation with the animation of the "PlayButton" entity.

    Is someone already did this? Do you know how I'm supposed to do that properly?

    Thanks in advance for your help :)

    I'm not sure if I understand correctly but from what you said I think that you have a spriter animation for the whole menu. Technically you could make this work with sub-entities and a bunch of logic but I think a much better approach is to have individual entities for buttons and just assemble them in the program into a menu without having and actual menu entity in spriter.

    If you still want to have a menu spriter entity, then you can probably achieve the result you want with sub-entities. I'm not sure if there's a more up-to-date explanation but check it out here:

     

  19. On 9/13/2017 at 4:54 PM, alex2020 said:

     Sry for the late response.

    I got it working. After updating from vs 2015 to vs2017 i created new projects with .net Standard and copied the code over. For some unknown reason nuget installed everytime in one of my libs old Spriter 1.5.0. After Clearing the nuget cache and manually deleting the files nuget worked again.  But the monogame.portable was not working. I had to remove monogame.portable and add monogame.portable.opengl to my Windows project. (Android worked)

    I dont know why the automatic switch for the portable wasnt working.

    But now its working again.

    Glad to hear you managed to get it working in the end. NuGet still seems confused with all this new .NET Standard stuff - hopefully they'll fix all these complications in the future. As for MonoGame.Portable - I'm trying to figure out how to depend on it without forcing the inclusion in the client because you end up with both the portable and real one which causes problems.

    On 9/16/2017 at 8:07 AM, alex2020 said:

    how do i use the new SpriterDotNet.MonoGame.Importer.dll ?

    greetings alex

    If you want to load the SpriterDotNet types directly with the content pipeline, you can include it in your .mgcb content file like this. Then you choose SpriterImporter as the importer for .scml files and load them like this. The alternative is loading the .scml files manually and deserialising them into the Spriter data structure which is a bit more complicated but you avoid dealing with the content pipeline which is a major pain.

  20. 10 hours ago, alex2020 said:

    I created a new library in dot net standard 2 and copied my code over.

    The code is working (no Errors) and spriter.net 1.6.1 is includet  via nuget.

    My Android and windows game projecty include the lib and complain that monogame is not compatible with dot net Standard 2.0. (or 1.0)

    How is your project Setup for such a case?

     

     

    Do you mean you're getting the NU1701 warning? If yes, just ignore it (or add it to the project's ignored warnings) - there's nothing really that can be done about it until (if) MonoGame Portable gets converted to a .NET Standard library. Everything should still work properly.

    Or are you getting another error?

  21. 8 hours ago, mr_tawan said:

    Just upgraded the version today and MonoGame just stopped working. Looks like MG does not support .Net Core/.Net Standard quite yet.

    There's no error or exception though.

    What exactly is happening? No errors or exceptions seems very strange.

    It shouldn't have anything to to with MG itself but your runtime environment. That being said, I plan to update everything to .NET Standard 2.0 (which is supposed to be awesome) any day now.

×
×
  • Create New...