Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / [BUG] GetSkeleton2DBone strangeness

Author
Message
Zef
11
Years of Service
User Offline
Joined: 27th Feb 2013
Location: Massachusetts
Posted: 7th May 2018 03:04 Edited at: 8th May 2018 03:43
I have a spriter .scon file (which I made) with 21 bones in it.
The bones have the names assigned by spriter when they were created: bone_000, bone_001,... bone_021.
Due to the sequence I created the bones some later number bones were inserted as children of earlier bones.
Each bone has exactly one sprite attached to it.
Here is the heirarchy: (indent represents child bones, the text ('bone_000') is the bone's name.

bone_000
......bone_001
............bone_002
......bone_003
............bone_004
......bone_005
............bone_006
......bone_007
......bone_008
............bone_011
............bone_012
............bone_019
............bone_020
......bone_009
............bone_010
..................bone_021

Here is the problem:
When I ask to move bone_009, the sprite attached to bone_11 moves (bone_011 probably moves, moving its sprite).
When I ask to move bone_010, the sprite attached to bone_12 moves.

If you look in the list above, the 9th bone in the list is bone_011. (I asked for 9 and 11 moves)
The 10th bone in the list is bone_012. (I asked for 10 and 12 moves)

(I'm using baxslash's excellent 'shmup' code to get me started. Hopefully that minimizes the effect of my ignorance.)

SetSkeleton2DBoneAngle(player.skeleton, GetSkeleton2DBone(player.skeleton, "bone_009"), a-110)
SetSkeleton2DBoneAngle(player.skeleton, GetSkeleton2DBone(player.skeleton, "bone_010"), a+200)

It is as though a list of bone objects was made when the .scon file was read in, but the names somehow got jumbled causing GetSkeleton2DBone to return the wrong ID for the name requested. The skeleton animates correctly, I just cannot grab hold of the bones by name.

I installed AppGameKit-V2018.05.02-Windows.zip, recently released.

I tried changing a few names but get the same result.
The bone IDs have not changed from when the skeleton was loaded, I suspect the name/bone mismatch occurred there.

Then again, maybe I made the spriter animation incorrectly. I don't know enough to be able to tell.

Any help is appreciated. Thanks.
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 7th May 2018 05:22
Have you tried moving the bones in Spriter to see how they react? I have had a couple of instances where I had to reconnect all of my bones because the structure looked OK but just wouldn't behave in the Spriter editor.
The Scon file is json, so you can open it up and read it to see if it is exporting correctly. There are online Json parsers to simplify the view.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt
Captain Ouais
20
Years of Service
User Offline
Joined: 12th Dec 2003
Location: France
Posted: 7th May 2018 07:19
Hi Zef !!!

i know that the bones in agk do not have the same numbers as in spriter!
They are numbered according to the hierachy in spriter (the left column)
the bone at the top is 0, I think we can not change its axis because it is the axis of the skeleton, but for all others it works.
The one below is 1, 2,3 etc, whatever their number in the skeleton !

Is this the problem you encountered ?
I do what i do !!!
Zef
11
Years of Service
User Offline
Joined: 27th Feb 2013
Location: Massachusetts
Posted: 7th May 2018 18:43
Batvink, the animation works flawlessly in spriter and in my AGK2 tier 1 app.

Cap'n O, my problem isn't really about the numbers. My problem is that GetSkeleton2dBone does not return the correct bone for the name specified. Literally, I ask for the right upper arm bone and it gives me the bone the right ear is attached to!

I ask for one bone and it gives me the ID for a different bone. That's why I think the names are incorrectly associated with the ID when the list is made.

I appreciate both of your thoughts on the matter.
Captain Ouais
20
Years of Service
User Offline
Joined: 12th Dec 2003
Location: France
Posted: 8th May 2018 09:39
Indeed, I tested on one of my skeletons and there is a gap with the names !

My bone: bone_016 is returned as bone 14.

Instead, use their digital identity that you find in spriter
I do what i do !!!
Zef
11
Years of Service
User Offline
Joined: 27th Feb 2013
Location: Massachusetts
Posted: 8th May 2018 11:49
I used the number got by counting bones down from the top in the spriter hierarchy list and that works. Is that what you mean by digital identity, or is it a value from the .scon file (or scml) file?

Still, GetSkeletonBone2d should work.

It looks like a bug.
Where do we report bugs?

Thanks
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 8th May 2018 12:12
I renamed the thread so that Paul can identify it is bug-related.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt
Zef
11
Years of Service
User Offline
Joined: 27th Feb 2013
Location: Massachusetts
Posted: 8th May 2018 12:36
Thank you both too much!
Paul Johnston
TGC Developer
22
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 9th May 2018 15:58 Edited at: 10th May 2018 01:46
I think it might be the order of the bones in the mainline object are different from the bone order in the entity object, although I can't be sure without seeing the scon file. I'll add some code that can account for different ordering, hopefully that will fix it.

Edit: Does the attached version fix it?

Attachments

Login to view attachments
Zef
11
Years of Service
User Offline
Joined: 27th Feb 2013
Location: Massachusetts
Posted: 10th May 2018 03:25 Edited at: 10th May 2018 04:03
Paul - You nailed it - it work fine now! Thanks!

GetSkeleton2dBone works now and the walking animation works too, but when I try to use an animation that has the character jump, the parts of the character become a jumble.
When I switch back to the original windows.exe the jump animation works fine.

I figure this version was just for testing the GetSkeleton2dBone fix, and other partially completed code is in there too.
I only mention the jump issue in case you can see a reason why it might be related to the bone name fix. I suspect they are not related.

For the time being, until the GetSkeleton2dBone fix is officially released, I'll continue using the release version of Windows.exe and my "hard-coded bone #" fix.

I'm glad that was identified and fixed - thanks again!
Paul Johnston
TGC Developer
22
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 10th May 2018 13:07
The jump issue sounds like there is still something I haven't accounted for, can you send me the scon and image files so I can try to find the cause?
Zef
11
Years of Service
User Offline
Joined: 27th Feb 2013
Location: Massachusetts
Posted: 11th May 2018 02:57
Paul, I've emailed you the .scon file and the associated images.

Thanks for looking into this.
Paul Johnston
TGC Developer
22
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 16th May 2018 17:23
Thanks for the files. The jump animation problem was caused by the some of the animations having different bone hierarchies from each other, I've added support for this in the next version. However tweening between two animations that have different hierarchies will cause momentary distortion during the tween.

Login to post a reply

Server time is: 2024-11-18 12:15:39
Your offset time is: 2024-11-18 12:15:39