Jump to content
Spriter Forums

SpriterDotNet - An implementation for all C# frameworks


loodakrawa

Recommended Posts

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

Link to comment
Share on other sites

  • 3 weeks later...
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.

Link to comment
Share on other sites

  • 1 month later...

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...

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • 4 months later...
  • 3 months later...

Hi
Sorry English is short.
SpriterDotNet, SpriterDotNet.MonoGame
All version 1.6.1.0
nuget error can not be installed
So install as source

monogame v 3.7.1
android works well
IOS error
  Error loader.Fill (factory)

I saw something in the error

Microsoft.Xna.Framework.Content.ContentLoadException: Could not find ContentTypeReader Type. Please ensure the name of the assembly contains the type of assembly in the full type name: SpriterDotNet.MonoGame.Content.SpriterTypeReader, SpriterDotNet.MonoGame, Version = 1.6.1.0, Culture = neutral, PublicKeyToken = null (SpriterDotNet.MonoGame. Content.SpriterTypeReader, SpriterDotNet.MonoGame)

How do I do this?

Link to comment
Share on other sites

On 1/13/2019 at 12:19 AM, sabi04 said:

Hi
Sorry English is short.
SpriterDotNet, SpriterDotNet.MonoGame
All version 1.6.1.0
nuget error can not be installed
So install as source

monogame v 3.7.1
android works well
IOS error
  Error loader.Fill (factory)

I saw something in the error

Microsoft.Xna.Framework.Content.ContentLoadException: Could not find ContentTypeReader Type. Please ensure the name of the assembly contains the type of assembly in the full type name: SpriterDotNet.MonoGame.Content.SpriterTypeReader, SpriterDotNet.MonoGame, Version = 1.6.1.0, Culture = neutral, PublicKeyToken = null (SpriterDotNet.MonoGame. Content.SpriterTypeReader, SpriterDotNet.MonoGame)

How do I do this?

This is my mistake.
It looks like Link all the assemblies are set in the link option.

 
Link to comment
Share on other sites

  • 2 weeks later...
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.

Link to comment
Share on other sites

  • 2 weeks later...

ok for simplicity i skipped the "only per key frame check" and check for variables and tags in every update loop.

But i found another problem.

In my landFromJump animation i placed a variable (setNextAnimation = idle) at the last frame. Its never reached because of the delta time.

If i place a variable or tag at the last 17 frames of the animation its never reached. (1000 frames / 60 fps =>  16.6 frames)

If i place it before frame 982 its working fine.

if (animator.FrameData.AnimationVars.ContainsKey("setNextAnimation")) {
    if (animator.FrameData.AnimationVars["setNextAnimation"].StringValue != "") {
        string nextAnimation = animator.FrameData.AnimationVars["setNextAnimation"].StringValue;                   
        animator.Transition(nextAnimation, 0.5f);
    }
}

I tried the AnimationFinished Event but it don´t know the variables either if i place them on the last frames.

 

Link to comment
Share on other sites

  • 2 months later...

Played with both solutions yesterday SpriterDotNet was able to import everything semlessly, whereas Spriter2Unity struggled with some of the animations.
I ended up using SpriterDontNet but the lack of integration with Unity´s animator seemed like a huge throwback (I love state machines). That is the reason why I coded a simple solution that integrates SpriterDotNet with Unity´s animator, you cannot modify the animations in Unity but you can use the animator as you would do with regular animations.

A self-explanatory video:



PD: Be sure to turn on the subtitles

Link to comment
Share on other sites

  • 7 months later...

Heya folks, I have a question about how best to approach something. I set up per pixel collision detection by looping through the sprite data for the current frame (animator.FrameData.SpriteData), converting the in-game collision test position to a texture coordinate and then checking for the opacity of the pixel at that location on the texture, but I'm having trouble figuring out which bone corresponds to the sprite that was collided with. My intention is to set it up so that certain bones take more damage when hit. So far the best idea I've come up with is to set up both per pixel collision detection to accurately detect that a collision occurred, as well as a bounding box for specific collision zones to determine where the hit occurred, but that seems messier than would be ideal and wouldn't let me mark certain bones to be ignored by the per pixel collision detection.

Is there a better way to approach what I'm trying to do here? Is there a way to loop through the bones currently being drawn rather than the sprites that would let me determine which bone has the sprite attached that is receiving a collision?

Link to comment
Share on other sites

I pretty much solved my own problem, but in case other folks want to go down this path in the future: From what I gather, the animator.FrameData.SpriteData contains objects that represent the information about the way a sprite needs to be positioned and drawn. It doesn't seem to contain a reference to the name of the bone that it is attached to by default. I edited the SpriterDotNet API to add a string variable named BoneName to the SpriterObject class in the SpriterModel.cs file, and then added "info.BoneName = timeline.Name;" to the top of the AddSpatialData method in the FrameDataCalculator class. This allows me to retrieve the BoneName from a SpriterObject. 

Link to comment
Share on other sites

  • 4 weeks later...

Does this implementation support "transitioning" from the current state of an animation to the starting state of the same animation? I have an attack animation, and I want to "transition" from the ending state of the animation to the beginning state of the next animation, but it seems to bug out. If I replace the Transition calls with Play it works, but of course without the transition.

Link to comment
Share on other sites

Ran into another issue, curious if anyone has any tips. I was having trouble syncing up a walk cycle with the creatures movement because I was getting an odd inconsistent jitter. After investigating the issue, it seems that every time a bone hits a keyframe, it freezes for a frame. Is this intended, or is there some kind of workaround? It isn't noticeable normally, but it is noticeable in situations where you're trying to seamlessly sync movement to an animation.

Link to comment
Share on other sites

On 1/5/2020 at 4:25 AM, sds_alex said:

Ran into another issue, curious if anyone has any tips. I was having trouble syncing up a walk cycle with the creatures movement because I was getting an odd inconsistent jitter. After investigating the issue, it seems that every time a bone hits a keyframe, it freezes for a frame. Is this intended, or is there some kind of workaround? It isn't noticeable normally, but it is noticeable in situations where you're trying to seamlessly sync movement to an animation.

In case anyone runs into this in the future, ultimately the issue boiled down to the pre-cached interpolated frames, and disabling pre-cacheing stopped the problem. 

Link to comment
Share on other sites

  • 3 weeks later...

Does anyone have any clue why adding a string metadata to an event causes the scml file to fail to load? It tells me that the file can't be found when I use Spriter = LoadContent<Spriter>(scmlPath); (it just returns null and outputs something about not finding the file in the console) I can add metadata to bones fine, but for some reason it refuses to load if there is a metadata variable attached to an event.

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...