Player animation
by Sylvain · in Artist Corner · 07/26/2007 (6:33 am) · 16 replies
Hi there !
I have been trying to model and animate a surgical tool (a grasper). The modelling went fine, the animation (dsq file) is working in ShowTool Pro but doesn't seem to work when I launch Torque ...
Since my grasper is meant to do only one action, I have only exported one dsq file from blender and I have created completely empty files for the other basic actions (root, fall, etc)
here are some lines from my player.cs :
baseShape = "~/data/shapes/grasper/grasper.dts";
sequence0 = "~/data/shapes/grasper/player_root.dsq root";
sequence1 = "~/data/shapes/grasper/player_forward.dsq run";
sequence2 = "~/data/shapes/grasper/player_back.dsq back";
sequence3 = "~/data/shapes/grasper/player_side.dsq side";
sequence4 = "~/data/shapes/grasper/player_fall.dsq fall";
sequence5 = "~/data/shapes/grasper/player_land.dsq land";
sequence6 = "~/data/shapes/grasper/player_jump.dsq jump";
sequence7 = "~/data/shapes/grasper/Action.dsq standjump";
sequence8 = "~/data/shapes/grasper/player_lookde.dsq look";
sequence9 = "~/data/shapes/grasper/player_head.dsq head";
sequence10 = "~/data/shapes/grasper/player_headside.dsq headside";
sequence11 = "~/data/shapes/grasper/player_celwave.dsq celwave";
Here is what I get in the console :
"Sequence import failed : shape exporter newer than the running executable.
GameOne/server/player.cs (40): preload failed for PlayerDts: Load sequence GameOne/data/shapes/grasper/player_root.dsq root failed for GameOne/data/shapes/grasper/grasper.dts"
Is it because of the 'emptiness' of my dsq files ? any other idea ?
Thanks !
Sylvain
I have been trying to model and animate a surgical tool (a grasper). The modelling went fine, the animation (dsq file) is working in ShowTool Pro but doesn't seem to work when I launch Torque ...
Since my grasper is meant to do only one action, I have only exported one dsq file from blender and I have created completely empty files for the other basic actions (root, fall, etc)
here are some lines from my player.cs :
baseShape = "~/data/shapes/grasper/grasper.dts";
sequence0 = "~/data/shapes/grasper/player_root.dsq root";
sequence1 = "~/data/shapes/grasper/player_forward.dsq run";
sequence2 = "~/data/shapes/grasper/player_back.dsq back";
sequence3 = "~/data/shapes/grasper/player_side.dsq side";
sequence4 = "~/data/shapes/grasper/player_fall.dsq fall";
sequence5 = "~/data/shapes/grasper/player_land.dsq land";
sequence6 = "~/data/shapes/grasper/player_jump.dsq jump";
sequence7 = "~/data/shapes/grasper/Action.dsq standjump";
sequence8 = "~/data/shapes/grasper/player_lookde.dsq look";
sequence9 = "~/data/shapes/grasper/player_head.dsq head";
sequence10 = "~/data/shapes/grasper/player_headside.dsq headside";
sequence11 = "~/data/shapes/grasper/player_celwave.dsq celwave";
Here is what I get in the console :
"Sequence import failed : shape exporter newer than the running executable.
GameOne/server/player.cs (40): preload failed for PlayerDts: Load sequence GameOne/data/shapes/grasper/player_root.dsq root failed for GameOne/data/shapes/grasper/grasper.dts"
Is it because of the 'emptiness' of my dsq files ? any other idea ?
Thanks !
Sylvain
About the author
#2
07/26/2007 (10:41 am)
I have copied all the script files into the scripts directory ... it didn't change anything though. I still have the same errors ...
#3
07/26/2007 (10:47 am)
...
#4
Still have all the errors, including "shape exporter newer than the running executable."
I must have done something wrong, don't know what though !
07/26/2007 (11:01 am)
Hmm, i just checked in Blender, it says that it runs version 0.949 of the exporter. And i just re-exported the files with that version (the files = Action.dsq & grasper.dts, the other .dsq are still the same empty files I had) ...Still have all the errors, including "shape exporter newer than the running executable."
I must have done something wrong, don't know what though !
#5
07/26/2007 (11:23 am)
...
#6
There is still a problem left though : i've assigned Action.dsq to the 'jump' action. So every time I press the space bar, my action is triggered (the grasper grasps) but my 'player' is jumping at the same time. I've tried to modify default.bind.cs but it won't work ...
Here's what I've done :
In defaul.bind.cs
function grasp(%val)
{
}
...
moveMap.bind( keyboard, space, jump );
moveMap.bind( keyboard, g, grasp );
And in player.cs
...
sequence12 = "~/data/shapes/grasper/Action.dsq grasp";
... but it isn't doing anything when I press 'g'.
Any idea ?
07/27/2007 (7:41 am)
Hey thanks ! It works ! Actually my .dsq files were completely empty (i.e. blank files). I've exported a blank animation (2 identical keyframes) called 'root.dsq' and i've assigned this file to each action except for the one I exported before. And it works !There is still a problem left though : i've assigned Action.dsq to the 'jump' action. So every time I press the space bar, my action is triggered (the grasper grasps) but my 'player' is jumping at the same time. I've tried to modify default.bind.cs but it won't work ...
Here's what I've done :
In defaul.bind.cs
function grasp(%val)
{
}
...
moveMap.bind( keyboard, space, jump );
moveMap.bind( keyboard, g, grasp );
And in player.cs
...
sequence12 = "~/data/shapes/grasper/Action.dsq grasp";
... but it isn't doing anything when I press 'g'.
Any idea ?
#7
07/27/2007 (7:45 am)
Quote:Well, um, your function is empty.
... but it isn't doing anything when I press 'g'.
function grasp(%val)
{
// add code to play anim here
}
#8
the additional code should look somrthing like [myPlayer].playThread(0, 'grasp'); right ?
Sorry if these are noob questions !
07/27/2007 (8:19 am)
Well, that's true ! I guess that I should use the playThread method, but how do I get a reference to my player object ?the additional code should look somrthing like [myPlayer].playThread(0, 'grasp'); right ?
Sorry if these are noob questions !
#9
starter.fps\data\shapes\player\player.cs
datablock TSShapeConstructor(PlayerDts)
{
{...}
sequence26 = "./player_celsalute.dsq celsalute";
starter.fps\server\scripts\command.cs
function serverCmdPlayCel(%client,%anim)
{
if (isObject(%client.player))
%client.player.playCelAnimation(%anim);
}
starter.fps\client\scripts\default.bind.cs
moveMap.bindCmd(keyboard, "ctrl s", "commandToServer('playCel',\"salute\");", "");
starter.fps\server\scripts\player.cs
function Player::playCelAnimation(%this,%anim)
{
if (%this.getState() !$= "Dead")
%this.setActionThread("cel"@%anim);
}
07/27/2007 (9:53 am)
Double check your setup... Here's an example thats in the starter.fps demo.starter.fps\data\shapes\player\player.cs
datablock TSShapeConstructor(PlayerDts)
{
{...}
sequence26 = "./player_celsalute.dsq celsalute";
starter.fps\server\scripts\command.cs
function serverCmdPlayCel(%client,%anim)
{
if (isObject(%client.player))
%client.player.playCelAnimation(%anim);
}
starter.fps\client\scripts\default.bind.cs
moveMap.bindCmd(keyboard, "ctrl s", "commandToServer('playCel',\"salute\");", "");
starter.fps\server\scripts\player.cs
function Player::playCelAnimation(%this,%anim)
{
if (%this.getState() !$= "Dead")
%this.setActionThread("cel"@%anim);
}
#10
Change your bind to this
moveMap.bindCmd(keyboard, "g", "commandToServer('playCel',\"grasp\");", "");
Change grasp to celgrasp
sequence12 = "~/data/shapes/grasper/Action.dsq celgrasp";
Add this to: starter.fps\client\config.cs
moveMap.bindCmd(keyboard, "g", "commandToServer('playCel',\"grasp\");", "");
Clean your DSO files and test it.
07/27/2007 (10:15 am)
Try this...Change your bind to this
moveMap.bindCmd(keyboard, "g", "commandToServer('playCel',\"grasp\");", "");
Change grasp to celgrasp
sequence12 = "~/data/shapes/grasper/Action.dsq celgrasp";
Add this to: starter.fps\client\config.cs
moveMap.bindCmd(keyboard, "g", "commandToServer('playCel',\"grasp\");", "");
Clean your DSO files and test it.
#11
I had to create a command.cs file since I am not working from starter.fps but from GameOne (from the "Getting Started tutorial") and also to add playCelAnimation in player.cs.
Thanks a lot !! :)
07/30/2007 (3:43 am)
Wonderful, it works perfectly !I had to create a command.cs file since I am not working from starter.fps but from GameOne (from the "Getting Started tutorial") and also to add playCelAnimation in player.cs.
Thanks a lot !! :)
#12
I have built a new player object and also new animations, exported them as DSQs, etc.
I've bound a key to play one particular animation but that animation doesn't play everytime i press that key ... I won't work during the first seconds afer the creation of the player. Then it will work pretty fine, except if i press the button again while the animation is still playing : after that the character will react randomly to my pressing the key ...
Has anyone already been facing that problem ?
What would you advise me (except avoiding to press the key during the animation !!)
09/03/2007 (7:41 am)
It's me again !I have built a new player object and also new animations, exported them as DSQs, etc.
I've bound a key to play one particular animation but that animation doesn't play everytime i press that key ... I won't work during the first seconds afer the creation of the player. Then it will work pretty fine, except if i press the button again while the animation is still playing : after that the character will react randomly to my pressing the key ...
Has anyone already been facing that problem ?
What would you advise me (except avoiding to press the key during the animation !!)
#13
09/03/2007 (7:51 am)
...
#14
%obj.stopThread(1);
%obj.schedule(100,"playThread",1,"myAction");
Thanks !
Now I have an other issue : is it possible to have the player moving and doing an animation simultaneously ?
For now, if my character is moving I can't trigger an animation. And when the animation is running, the faintest movement of joystick (I have to work with a joystick !) will stop the animation.
09/03/2007 (8:22 am)
It seems to work OK with :%obj.stopThread(1);
%obj.schedule(100,"playThread",1,"myAction");
Thanks !
Now I have an other issue : is it possible to have the player moving and doing an animation simultaneously ?
For now, if my character is moving I can't trigger an animation. And when the animation is running, the faintest movement of joystick (I have to work with a joystick !) will stop the animation.
#15
09/03/2007 (8:37 am)
...
#16
Thanks, I wouldn't have thought of clicking that button in the exporter !
09/04/2007 (8:26 am)
I went for the blend animation idea, and it seems to work ... for now !Thanks, I wouldn't have thought of clicking that button in the exporter !
Torque Owner Redacted