It looks like you're new here. If you want to get involved, click one of these buttons!
[AnimatedObject]
Graphic = t01 ;as a default
Scale = 2.0
Position = (0, 0, 0)
AnimationSet = UtilitiesAnimSet
[UtilitiesAnimSet]
AnimationList = ElevatorAnim#DoorAnim
LinkList = ElevatorLoop#DoorLoop
[ElevatorAnim]
DefaultKeyDuration = 1.0; <= This defines the duration for all our frames unless locally specified differently
KeyData1 = t01; elevator open
KeyData2 = t02; elevator closed
[DoorAnim]
DefaultKeyDuration = 1.0; <= This defines the duration for all our frames unless locally specified differently
KeyData1 = t03; door open
KeyData2 = t04; door closed
[ElevatorLoop]
Source = ElevatorAnim
Destination = ElevatorAnim
[DoorLoop]
Source = DoorAnim
Destination = DoorAnim
[Tiles]
Texture = ../../data/scenery/tiles.png
TextureSize = (32, 48, 0)
Pivot = top left
[[email protected]]
TextureCorner = (0, 0, 0)
[[email protected]]
TextureCorner = (32, 0, 0)
[[email protected]]
TextureCorner = (64, 0, 0)
[[email protected]]
TextureCorner = (96, 0, 0)
orxOBJECT *tile;
tile = orxObject_CreateFromConfig("AnimatedObject");
orxObject_SetTargetAnim(tile, "ElevatorLoop");
Comments
My guess is that you haven't set up the animation transitions properly.
They are the ones you set up in the LinkList property of the animation set.
So you need something like this:
and vice versa, if you wan't the reverse transition aswell. Then add those to the LinkList:
The orxObject_SetTargetAnim should then find the path to the animation.
Edit: I just read that not even SetCurrentAnim works, so maybe it's not the transitions after all...
I think what I might do first is make a copy of 04_Anim and deconstruct it slowly to match my code and see at what point it behaves like my code. I'll change "target" to "current" first and remove all 04_Anim links.
Hopefully that might turn up the basic rule I'm missing.
Well, as usual Ekerik wrote it all.
Using SetCurrent will help with this issue but actually bypass the whole graph logic. The purpose of the animation graph is for orx to find the correct animation to chain depending on the final animation you want.
Such as SetTarget("Run"), will trigger different animations depending if your character is sitting or standing (and if you have a stand up animation to go from sitting to standing).
The system itself is very powerful but its description in a .ini file is extremely annoying. I couldn't find a more elegant way to define all the links so I'm hoping to see a (community-created?) editor to do the dirty work for the developer in the future!
PS: The move went well and I just arrived to the hotel near San Francisco about 30 mins ago, thanks for asking! Time to catch some sleep now!
I just finished cutting back a copy of 04_Anim to see what happens. The results are interesting:
1. Remove Update Clock and Animation handler, add orxObject_SetTargetAnim(pstSoldier, "WalkRight") after the created object in Init().
Result: WalkRight animation plays and loops
2. Change to orxObject_SetTargetAnim(pstSoldier, "WalkLeft");
Result: WalkLeft animation plays and loops
3. Reduce the AnimSet LinkList to: LinkList = WalkRightLoop#WalkLeftLoop and AnimationList = WalkRight#WalkLeft
Result: No animation plays. Only Still frame. (I now understand that this is because of the broken links in the animation graph)
4. Change orxObject_SetTargetAnim(pstSoldier, "WalkLeft"); to orxObject_SetCurrentAnim(pstSoldier, "WalkLeft");
Result: WalkLeft animation plays and loops
5. Delete [IdleRightLoop], [IdleRight2Left] & [IdleRight2WalkRight] declarations from the ini.
Result: WalkLeft animation plays and loops
6. Delete [WalkRight2IdleRight], [IdleLeftLoop], [IdleLeft2Right] & [IdleLeft2WalkLeft] declarations from the ini.
Result: WalkLeft animation plays and loops
7 Delete [WalkLeft2IdleLeft], [IdleRight] & [IdleLeft] declarations from the ini.
Result: WalkLeft animation plays and loops
The aim of the above is to just have two animations, WalkRight and WalkLeft defined and in the link list, no transitions, and to get it to play the second animation which is to play WalkLeft by bypassing the graph. It is successful.
My own example however is not able to play the second anim. So I've proved the system works as it should, but what is in my code/config that upsets things...
I'll continue cutting pieces away until I work out what element causes my issue.
It appears with all my dancing around different settings I never had two crucial things set at the same time:
orxObject_SetCurrentAnim
used instead of...
orxObject_SetTargetAnim
But at the same time... I should have been calling the animation definitions (ie DoorAnim), not the source/target loop definitions (ie DoorLoop).
Can't believe it as that simple and I never hit on that combination with everything I tried.
Anyway all good, thanks for the tips, guys. Onto the next part.
I'd be happy to hear about any ideas on how to improve the animation/graph declaration as it's rather annoying in its current state.
The only thing that could be considered annoying is the sheer amount of sections to write and hook up. A small editor would certainly be nice if someone writes one (like a node editor to connect up the animations and output a config).
But without it, I think the system is great as it is. I'm planning to write a small tutorial on it based on my findings to make it easier for others coming in.
I have to admit than when you get 10+ animations for a character, writing all the links become a tedious task.
An editor would be great and would prevent most of the mistakes that can be made when writing the links. Also it'd allow to preview the animations chaining visually, and that would be a great feature.
Good as I don't see any editor coming anytime soon.
Eyecreate's Pey editor was a first step in this direction but I don't think there has been much progress on it lately.
I, for sure, won't write such an editor due to serious lack of time and the fact I hate writing UI code.
A tutorial might be very helpful though, I'm looking forward to seeing it!