Community Forum

Animation in GE?

Forum Overview >> Editor

Created13.03.2013 14:55

Baba Zed (Unknown) 13.03.2013 14:57
How do i go about animating objects in GE?

Do i do it all in the editor, or an outside editor ( i use Maya2012 btw)

Not sure how to go about it at all, i just want to animate a gate opening, any links to tutorials?

Marcus H (Xentro) 13.03.2013 17:39
First you make the "animation" second step is to bake the animation and last is to make an clip of the animation.

Baba Zed (Unknown) 13.03.2013 23:57
See that's where i'm going wrong, i don't know how to 'make' the animation? can't see how to make keyframes :(

I've looked at other animated objects, but nothing comes up in the animation window for them, is it ALL done in GE?

Or can it be done in Maya? or Blender?

Marcus H (Xentro) 14.03.2013 16:55
animate it in maya is simple
notice the time bar at the bottom of maya ? well hit on one of the numbers and then hit s.. move to next time and also move the object as you want it and then hit s again

repeat this and then you should have an nice animation.

Baba Zed (Unknown) 16.03.2013 14:43
i can animate in Maya no probs, blendshapes/ keyframe, i just didn't know if i could export the anim to GE, i'll get there....eventually, thanks for your help

Baba Zed (Unknown) 17.03.2013 14:58
Ok, i bit the bullet and installed Maya 32bit, thankfully i can still keep the 64bit version,.

So now i have the Exporter, which makes everything so much easier.

I've animated my object, in this case 'a bird', it plays fine in GE if i hit play in the editor, but my object is stationary when i go in game, how can i make it so it plays automatically looping when you start the actual game?

Baba Zed (Unknown) 17.03.2013 16:51

Baba Zed (Unknown) 18.03.2013 16:29

Baba Zed (Unknown) 20.03.2013 21:16

Baba Zed (Unknown) 22.03.2013 22:17
Right, i've learnt LUA, no problemo....pretty confident it should work....

But how do i get the game to run the LUA script for my object??
(placed via editor....NOT a shop mod)

I've put a deliberate 'Value return Nil' error in the LUA file, so i know the Game isn't executing it, else it would throw the error at me

Marcus H (Xentro) 23.03.2013 10:04
You can use an onCreate command too call the animation script.

look at the triggers at that link.

Baba Zed (Unknown) 23.03.2013 13:25
Thanks for the link Marcus, but i can't find one onCreate command in any of the trigger scripts, i just can't understand why this is so difficult, i spent the last 48 hours trying every possible combination of onCreate commands, i've scoured the web and i just don't understand what it's trying to do?
The tutorials on this site don't match up to the Giants Editor 5.01 sample files, they must be for the previous version which had different sample files in a different folder

-------currently i have this (below) in my user attribute section of the Map.i3d--------

<UserAttribute nodeId="2259">
<Attribute name="onCreate" type="scriptCallback" value="FlyingCrow.onCreate"/>
<Attribute name="xmlFile" type="string" value="models/natural/FlyingCrow/FlyingCrow.xml"/>

-------and this (below) in my FlyingCrow.lua file-------

function crowOnCreate(id)
FlyingCrow = id

FlyingCrow = {}
function FlyingCrow:load(xmlFile)

self.charIdA1 = Utils.indexToObject(self.rootNode, getXMLString(xmlFile, "map.crowexp#index"))
self.clipIndexA1 = getXMLString(xmlFile, "map.crowexp#animationClip")


function FlyingCrow:update(dt)
if FlyingCrow ~= nil then

local charIdA1 = getAnimCharacterSet(self.charIdA1)
local clipIndexA1 = getAnimClipIndex(charIdA1, self.clipIndexA1)

assignAnimTrackClip (charIdA1, 0, clipIndexA1)
setAnimTrackLoopState (charIdA1, 0, true)
setAnimTrackSpeedScale (charIdA1, 0, 3)
enableAnimTrack (charIdA1, 0)


-------and this (below) in my FlyingCrow.XML file--------

<?xml version="1.0" encoding="utf-8" standalone="no" ?>


<crowexp index="36>0" animationClip="flappoSource"/>


Marcus H (Xentro) 23.03.2013 18:34
Lets make it like this instead

<UserAttribute nodeId="2259">
<Attribute name="onCreate" type="scriptCallback" value="modOnCreate.FlyingCrow"/>
<Attribute name="index" type="string" value="0"/>
<Attribute name="clip" type="string" value="flappoSource"/>

this is the trigger lua

FlyingCrow = {};
local featureObject_mt = Class(FlyingCrow, Object);

InitObjectClass(FlyingCrow, "FlyingCrow");

function FlyingCrow.onCreate(id)
local object = FlyingCrow:new(g_server ~= nil, g_client ~= nil);


g_onCreateUtil.addOnCreateFunction("FlyingCrow", FlyingCrow.onCreate);

function FlyingCrow:new(isServer, isClient, customMt)
local mt = customMt;
if mt == nil then
mt = featureObject_mt;

local self = Object:new(isServer, isClient, mt);

self.nodeId = 0;
return self;

function FlyingCrow:load(id)
self.nodeId = id;

local index = Utils.indexToObject(id, getUserAttribute(id, "index"));

if index ~= nil then
self.animCharSet = getAnimCharacterSet(index);
if self.animCharSet ~= 0 then
local clip = getAnimClipIndex(self.animCharSet, getUserAttribute(id, "clip"));
if clip ~= nil then
assignAnimTrackClip(self.animCharSet, 0, clip);
if getAnimTrackAssignedClip(self.animCharSet, 0) then
local loop = true;
setAnimTrackLoopState(self.animCharSet, 0, loop);
self.animDuration = getAnimClipDuration(self.animCharSet, clip);

function FlyingCrow:delete()

function FlyingCrow:update(dt)

I havent finished it but you got an base to work with.
Load the lua file in the <extraSourceFiles> of an moddesc file and you should be all good other then the fact you need to activate the animation as well.

The index value is from the node that has the call attributes

- caller
-- index we have is at this place

self.nodeId is the caller if you rather use that one.

I havent tested anything of this so it might give errors or it wont.. trial and error. :P

Baba Zed (Unknown) 27.03.2013 00:11
Wow, that is awsome dude, you da man......thankyou, i nearly threw in the towel :)

It hasn't worked yet, got attempt to call global class, on line 4 for some reason, but you've give me a solid structure to work with now, great instruction thanks

Note: Log in to post. Create a new account here.