Game Development Community

Root animation Switching in Script

by Stephen Sinclair · in General Discussion · 04/23/2007 (1:13 pm) · 3 replies

Hi All,

I am a bit new at this so this maybe an easy question. I have an AI bot that creates a PlayerData datablock and inherits from PlayerShape. I have shapeFile property pointing to "~/data/shapes/player/player.dts";.

Everything works fine, players show up in the correct position and the animations work as planned. I would like some AIplayers to spawn in a crouched position (I have a crouch.dsq) as the root animation. How do I do this in script? Can I change the sequence0 to equal something else? Do I create a different PlayerData data block and have it point to a different directory with the root.dsq overridden by the crouch DSQ? Can I set the player instances root to something different. Its the exact same player shape and dts, all I want to do is start with a different root. Any ideas?

Thanks,
Steve

#1
04/25/2007 (9:47 pm)
Look in player.cc in method Player::pickActionAnimation() and you will see that the current animation is based on what motion the player is experiencing.

You could make some code changes to add some flags which you can check before telling the engine which root animation to play. Then set those flags from script. There are many other possible ways to solve this in code.

I would not make another datablock if its going to use the same player mesh. Waste of memory.
#2
04/25/2007 (10:50 pm)
You could probably just have the aiplayers play the crouch animation right before they're spawned. rather than spawning them directly from new(), you could create them somewhere else first, start the crouch animation, and then transport them to the spawn point using setTransform().
#3
10/01/2010 (1:47 am)
I know this is an old thread, but I was wondering if I could get a hold of that crouch dsq you're using.