Community Forum

Start animation

Forum Overview >> Editor

Created22.03.2015 11:07

Luke Luculus (luculus) 22.03.2015 11:08
I have a question!
How can I make a character animation in Giants editor 6.03 start so she is watching the game. Mind you without LUA file via user attributes.
Is this possible?

Emil Drefers (Unknown) 23.03.2015 09:04

what do you want to do exactly?

Well, setting up a skinned mesh is not possible with the GE.
For this task you would have to use Maya for example.


James Biddulph (Unknown) 26.03.2015 08:24
animation cannot be done simply though the user attributes, simple animations for example raising and lowering a tailgate can be done outside of Maya (or Blender) but you need to use Markup file language (XML) to do this, but as Emil points out more complex animation need to be created within Maya (or Blender). We all wish there was a user attribute to make animation but sadly there is not.

Luke Luculus (luculus) 29.03.2015 18:23
So the animation is done with Maya and also runs in the editor.
The problem that is not running the animation in the game.

Emil Drefers (Unknown) 30.03.2015 08:54

please be a bit more specific about what you have animated and when this animation should be played.


Luke Luculus (luculus) 30.03.2015 19:11
It is an animal that is about to move a little . Head up and down . no complex animation . only that they are not so rigid on the map and the animation should start when the game starts

Emil Drefers (Unknown) 31.03.2015 08:36

for this case you should write a new script.
With a new script you can play the animation randomly, also you could insert more then one animation into the object. This would make it much nicer.
An animal which stands somwhere and alwys does the same might look pretty unreal (or insane) pretty soon.


Luke Luculus (luculus) 31.03.2015 14:14
That is now my problem is I do not know how to write scripts and Lua. Nor do I know where to insert it. I just thought that it gets easier.


Marcel Schmidt (dresser98) 01.04.2015 19:26

I try to help. If you want to write a script read the API Reference: first. Ok, if I understand you right, you want to start an Animation wich are exist in the I3D.First add the specialization animatedVehicle to your mod then add below function:load(xmlFile):

function LuaFile:load(xmlFile)
self.backWindow = Utils.indexToObject(self.components, getXMLString(xmlFile, "vehicle.animationParts.backWindow#index"))
self.backWindowAnimChar = getAnimCharacterSet(self.backWindow)
local clip = getAnimClipIndex(self.backWindowAnimChar, getXMLString(xmlFile, "vehicle.animationParts.backWindow#clip"))
assignAnimTrackClip(self.backWindowAnimChar, 0, clip)

You can see that we loaded an object from the vehicle XML. The next step is to create a new Tag <animationParts> for example and then another new tag with the index and clipname:

Vehicle XML:
<backWindow index="0>10|7|0" clip="backWindowAnimation" />

But the path must be correctly: "vehicle.animationParts.backWindow#index" Tags-> "<vehicle><animationParts><backWindow index="0>10|7|0"/></animationParts></vehicle>"

Here are the indexes in the Giants Editor from the object with animation and the clip(name) (you can find it when you open your I3D with a Texteditor and scroll down. It looks like:

<Animation >
<AnimationSet name="backWindow">
<Clip name="backWindowAnimation" duration="2500">
<Keyframes nodeId="278">
<Keyframe time="500" rotation="0 -0 0"/>
<Keyframe time="2500" rotation="74.9988 -0 0"/>
<Keyframes nodeId="280">
<Keyframe time="0" rotation="0 -0 0"/>
<Keyframe time="500" rotation="0 0 -79.9519"/>

Now you can start your animation with this command:"enableAnimTrack". Write the command below the update() part. After the command is the "CharakterSet" wich we have define at the top of this post as "self.backWindowAnimChar" and the number of the track.

function LuaFile:update()
if InputBinding.hasEvent(InputBinding.examplekey) then
enableAnimTrack(self.backWindowAnimChar, 0)

If you press the key "examplekey" wich you must add in the modDesc it should work.


PS. Sorry for mistakes I cant write english very well :-D

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