Object Animation - The nuts and bolts

About the actual programming of the game.

Object Animation - The nuts and bolts

Postby DaveSparhawk » Mon Mar 17, 2014 12:49 am

Lacking any examples, i would like to suggest something:

Animations should be:
  • defined in a resource
  • declared by the test.sc or similar
  • and triggered by the game code.

The resource would contain animation name(s) with animation details such as positioning key frames.
The declaration would need to select an animation class and list the appropriate animation nam(e)
The game code would have a selection of animation classes that control how an animation behaves within the game.

An example:
An electric door/airlock:


Test.sc (or similar):
Code: Select all
...
@adoor
#99
&GLMesh
>mesh=door/sdoor.objs
>shader=shaders/mesh_deferreds
>cullface=nones

&animation
>animationclass=edoor
>animationfile=door/sdoor.anim
>animationname=slide
...

note: sdoor.anim is an example only, i do not know what extension or type animation details will be kept in.

game code would (based on action class):
  1. wait for device interface
  2. trigger a door open animation (named slide): freezing the animation on the last frame to hold door in open position
  3. wait for device interface
  4. play the door close animation: the key frames are played back in reverse to the first frame.
DaveSparhawk
 
Posts: 28
Joined: Sat Mar 08, 2014 11:14 am

Re: Object Animation - The nuts and bolts

Postby DaveSparhawk » Mon Mar 17, 2014 11:36 am

another example:
Code: Select all
@button
#1002
&GLMesh
>scale=1.0f
>x=-2.0f
>y=0.8f
>mesh=newdevices/bigswitch/bigsw_000001.objs
>shader=shaders/mesh_deferreds

&BulletShapeMesh
>scale=1.0f
>x=-2.0f
>y=0.8f
>mesh=newdevices/bigswitch/bigsw_000001.objs

&Animation
>animationClass=MomentaryPushSwitchs
>pushedFrame=1i
>restFrame=20i


as you may notice above blender deals with animated wavefront(.obj) by generating a series of objects, one for each key frame.

in this case i have around 20 frames, files named bigsw_000001.obj to bigsw_000020.obj

As i understand it, the above would require a new component for "&Animation".
which would need to trigger createAnimation()
which would likely load all the .obj files.

when it comes to rendering the animation the game would likely need to render animations separately to the normal .obj.
DaveSparhawk
 
Posts: 28
Joined: Sat Mar 08, 2014 11:14 am


Return to Code

Who is online

Users browsing this forum: No registered users and 1 guest

cron