Hi, I try for few days to understand how to import and use animations from Blender (.dae) into AGK. I follow this tutorial:
https://forum.thegamecreators.com/thread/221714
This part is not very clear, I guess it is my fault, I don't understand how to code in AppGameKit the part with frames
Quote: "
4) import the 3d model in agk
- For an animated Object (or multi object): Use LoadObjectwithchildren ().
- Use the frame for your animation. For example, in blender, you should have:
Total frames (10 for Animation of 20 frames) : 200 frames
- frame 0 to 20: Walk
- frame 21 to 40: run
- frame 41 to 60: die
and so ...
In AppGameKit, you can use:
walk -> framend = 20/200 or 0.1 -> PlayObjectAnimation (objid, ' "0,0.1,1,0)
Run -> framend = 40/200 or 0.2 -> PlayObjectAnimation (objid, "" 21 / 200,0.2,1,0)
die -> framend = 60/200 or 0.3 -> PlayObjectAnimation (objid, "" 41 / 200,0.3,1,0)
and so.
Et voilĂ !
"
I probably do something wrong ... from what I understand I export the armature and mesh to (.obj), and export everything again in (.dae) format.
Test 1:
Player:
AddVirtualJoystick(4,50,90,15)
LoadObject(888,"Pirate.obj")
Pirate=LoadImage("PirateTexture.png")
SetObjectImage(888,Pirate,0)
LoadObjectWithChildren(888,"Idle.dae")
I am rightly informed that the ID is already in use
Test 2:
Player:
AddVirtualJoystick(4,50,90,15)
LoadObjectWithChildren(888,"Idle.dae")
Pirate=LoadImage("PirateTexture.png")
SetObjectImage(888,Pirate,0)
PlayObjectAnimation(888,"",0,81,1,0)
The model is visible with the texture and the animation works.
Test 3:
I created a unique animation where frame 0 to 81 displays Idle phase, frame 81 to 131 displays Walk phase.
Player:
AddVirtualJoystick(4,50,90,15)
LoadObjectWithChildren(888,"IdleWalk.dae")
Pirate=LoadImage("PirateTexture.png")
SetObjectImage(888,Pirate,0)
PlayObjectAnimation(888,"",0,81,1,0)
At this point the frames no longer work, any number I type are ignored and the animation is played in full or not at all.
Test 4:
Player:
AddVirtualJoystick(4,50,90,15)
LoadObjectWithChildren(888,"Idle.dae")
//LoadObjectWithChildren(888,"Walk.dae")
Pirate=LoadImage("PirateTexture.png")
SetObjectImage(888,Pirate,0)
PlayObjectAnimation(888,"",0,81,1,0)
//PlayObjectAnimation(888,"",0,51,1,0)
At this point I have divided the two animations and if viewed individually they both work.
1) I would like to know if there is a better or correct way to make this work.
2) I am also confused about how and when to load the model (.obj) and animation (.dae). Should I load both files?
3) How can I correctly write point 4 of the tutorial?
4) Do I need to create a single action in Blender, which includes all the animations divided by the frames?
Thank you for your time!