Petr Schreiber
06-03-2007, 20:48
Hi,
as kryton9 requested some more info on animations for the game, I have few ideas:
Mike has a set of great profi tools ( Poser, ... ), if he has some time, they would be great for creating some story animations.
In game animations would be also good, for simplier stuff like just ship entering hangar or something like that.
For this kind of stuff TBGL animation functions could be used.
I have prepaired very very simple demoscript on this topic.
It is just silly UFO with animable cockpit part - please see in attached source.
I will show you what's behind it...
I have created the model of UFO in thinEdge. The main body part is stored in "UFO_Body" layer, cockpit glass in "UFO_Glass".
To define bone for the glass part, you just have to load the model :) and do this:
tbgl_m15DefBoneLayer %MODEL_UFO, %BONE_FOR_GLASSPART, "UFO_Glass", 0.25, 0.38, 0
I have used some equates to make parameters clear.
So first parameter is model number, second is ID of the bone ( 1 to 32, may be improved in future releases of TBGL ).
Third parameter is string, containing layer name you want to became bone-controlled.
Last 3 numbers are "anchor", point around which the bone will rotate. I just decided for mentioned point, as I now this part could have joint at this coordinates.
To animate the model, you must do following steps:
tbgl_m15resetBones %MODEL_UFO
tbgl_m15RotBoneZ %MODEL_UFO, %BONE_FOR_GLASSPART, -45 + sin(gettickcount/1000)*45
tbgl_m15ApplyBones %MODEL_UFO
tbgl_m15DrawModel %MODEL_UFO
First, you need to reset bone angles in model you want to animate.
Then you set the rotation, in this case around Z axis. After that you just apply the bones and render the model.
Hope you were able to follow me, if not please ask :),
Petr
Edit by MikeHart: The first code entry wasn't visible :)
as kryton9 requested some more info on animations for the game, I have few ideas:
Mike has a set of great profi tools ( Poser, ... ), if he has some time, they would be great for creating some story animations.
In game animations would be also good, for simplier stuff like just ship entering hangar or something like that.
For this kind of stuff TBGL animation functions could be used.
I have prepaired very very simple demoscript on this topic.
It is just silly UFO with animable cockpit part - please see in attached source.
I will show you what's behind it...
I have created the model of UFO in thinEdge. The main body part is stored in "UFO_Body" layer, cockpit glass in "UFO_Glass".
To define bone for the glass part, you just have to load the model :) and do this:
tbgl_m15DefBoneLayer %MODEL_UFO, %BONE_FOR_GLASSPART, "UFO_Glass", 0.25, 0.38, 0
I have used some equates to make parameters clear.
So first parameter is model number, second is ID of the bone ( 1 to 32, may be improved in future releases of TBGL ).
Third parameter is string, containing layer name you want to became bone-controlled.
Last 3 numbers are "anchor", point around which the bone will rotate. I just decided for mentioned point, as I now this part could have joint at this coordinates.
To animate the model, you must do following steps:
tbgl_m15resetBones %MODEL_UFO
tbgl_m15RotBoneZ %MODEL_UFO, %BONE_FOR_GLASSPART, -45 + sin(gettickcount/1000)*45
tbgl_m15ApplyBones %MODEL_UFO
tbgl_m15DrawModel %MODEL_UFO
First, you need to reset bone angles in model you want to animate.
Then you set the rotation, in this case around Z axis. After that you just apply the bones and render the model.
Hope you were able to follow me, if not please ask :),
Petr
Edit by MikeHart: The first code entry wasn't visible :)