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.

3 Dimensional Chat / [SOLVED] Blender Animation to AGK (0.o)?

Years of Service
User Offline
Joined: 9th Sep 2020
Posted: 31st Dec 2020 22:26
Hi, I try for few days to understand how to import and use animations from Blender (.dae) into AGK. I follow this tutorial:

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:

I am rightly informed that the ID is already in use

Test 2:

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.

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:

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!

The author of this post has marked a post as an answer.

Go to answer

Years of Service
User Offline
Joined: 23rd Mar 2005
Location: Hertfordshire, England
Posted: 1st Jan 2021 06:08
Use either FBX or Blend and unfortunately unlike Dark BASIC Professional (which supporting Appending Animation)., for AppGameKit you either have to replace what is loaded OR simply have all the animation pre-baked.
I'd recommend just using the Blend File, then outputting a .txt that you create a custom loader for; that lists the Animation Name and Frame Range that can be loaded into say an Array or such.
Years of Service
User Offline
Joined: 9th Sep 2020
Posted: 1st Jan 2021 17:48 Edited at: 1st Jan 2021 17:49
Hi thanks for replying, I tried to use the .blend file (but I am informed that "No suitable reader found for this file format"...Loading the .fbx file instead, the mesh is distorted and the animations are not reproduced ... also I ignore the animations as Pre-Bake, in blender I tried, but in the program itself after they are no longer reproduced, is this normal? also I ignore how to :
Quote: "
outputting a .txt that you create a custom loader for; that lists the Animation Name and Frame Range"
sorry i m a super noob...
Virtual Nomad
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 1st Jan 2021 23:39
does this recent post help?
[My Home] [Now Playing]
[AGK Resource Directory] [TGC @ GitHub]
[Google Forum Search]
Years of Service
User Offline
Joined: 9th Sep 2020
Posted: 2nd Jan 2021 20:13 Edited at: 3rd Jan 2021 00:58
Hi Virtual Nomad , nice to talk with you again
Unfortunately not ... when I use .fbx the Mesh gets distorted and if I try to play an animation, everything goes crazy ... could it be Blender 2.91? Should I use 2.80 perhaps? A stupid question, do .dae files, include the Mesh and can I add physical and collision properties later?
I guess I have to use .dae files ... Use one animation, remove it and play another one, and split all the animations into single .dae files ... it's almost a week and I'm always back to square one

Ps. Second stupid question, if I add physical and or collision properties in Blender, are they exported together in the .dae file?

I finally understood maybe where the problem is .. Tomorrow I will write the solution here if I am lucky .. it all depends on the frame rate you use in Blender, since the "PlayObjectAnimation" command in AppGameKit works in seconds ... now I have another doubt , if in AppGameKit you set a maximum FPS 30 - 60 - 120, will it affect the animations?! .... but if anyone has a better idea or advice please write them down
Years of Service
User Offline
Joined: 9th Sep 2020
Posted: 3rd Jan 2021 18:14 Edited at: 13th Jan 2021 17:07
This post has been marked by the post author as the answer.
This is what I learned:
In Blender...

1) Create the Mesh (without ever using scales)
2)Create the armature using single bones (without ever using scales)
3)Set the UV and the texture (Use Images or paint it)
4)Parenting the mesh with the armature( With automatic weight)
5)Check and / or adjust weight (Weight Painting)
6)Set the origin of the mesh and the origin of the armature a the bottom, touching the grid (VERY IMPORTANT) because that will be use from AppGameKit as reference for place the model

-Ready for Animation-
(Never use Scale)
7)Create a new Action (in Dope sheet)
8)Create your first animation (example from frame 1 to 21 Idle)
9)Create next animation in the same action (example from frame 21 to 61 Walk)
10)Create all the animation you need.

-Ready for export your model in AGK-
11)Select both the mesh and the armature
12)Export as (.dae) file
13)You can leave the def setting of Blender or
Quote: "- Export .dae : Apply modifiers, selection only, triangulate."

(need more test for see the best way for export .dae)

-In AGK-
14)Use the command " LoadObjectWithChildren ( IDobject , file name )" [example] LoadObjectWithChildren ( 888 , "Animation.dae" )
15)Use the command " PlayObjectAnimation ( objID, animName, starttime, endtime, loop, tweentime )
[example] PlayObjectAnimation ( 888 , "" , 0 , 0.20 , 1 , 0 ) this will play our first animation ( Idle from frame 0 to frame 20 )
for be precise, when you are in Blender --> DopeSheet --> ActionEditor --> View you can switch the frame in seconds, very helpful because AppGameKit use the seconds for reproduce your animation
so for the next animation (Walk from frame 21 to 61) you will have PlayObjectAnimation ( 888 , "" , 0.20 , 2.13 , 1 , 0 )

I hope can help.
If there is a better way or want to add more tips please write it here
Bio Fox
Years of Service
User Offline
Joined: 11th Nov 2004
Location: The BioFox Bunker
Posted: 24th Jan 2021 20:33
Hey, HYDRAK, I too am trying to load animated .dae models from blender into AGK. I have fully modeled, textured, and rigged by model, as well as created an animation, but when loading with children into AppGameKit the model is all contorted. I believe it's because of the scale in Blender (which you mention not to use). How can I tell if that's the issue? Can you point out where I can check this in blender? Thank you!
BioFox Games
DBPro Master
Years of Service
User Offline
Joined: 21st Nov 2007
Location: Austin, TX
Posted: 3rd Feb 2021 02:11
You can see (and remove) scale keys on the dope sheet

A single player RPG featuring a branching, player driven storyline of meaningful choices and multiple endings alongside challenging active combat and intelligent AI.
Bio Fox
Years of Service
User Offline
Joined: 11th Nov 2004
Location: The BioFox Bunker
Posted: 9th Feb 2021 02:42
Thanks for the reply! I realized 1) I had to reset scaling on the bones and model to 1.0 for X, Y, Z and 2) don't use Scale when rigging. I also made my own bones instead of using Rigify. All of that helped me create an animated model that AppGameKit could load. Appreciate the help!
BioFox Games

Login to post a reply

Server time is: 2023-12-01 05:52:28
Your offset time is: 2023-12-01 05:52:28