Game Development Community

Backwards Player

by Patrick Webber · in Torque 3D Professional · 12/20/2012 (12:43 pm) · 14 replies

Hi all,

So I've just recently purchased a player model for my game and when I imported him I noticed something irritating: the player animations are backwards. I guess my question really is, how can I set him up to be facing the right direction?

I'm not really sure how to do this, but I've been playing around in the setRenderPosition and getCameraEye transform functions in the Player class with little success.

I feel like I should just be able to add some sort of rotation to the camera or render position to have a quick fix for this.

I've also tried rotating the model in Blender and in the Shape Editor, but the animations still play backwards.

Anyone have any ideas here? Any help would be appreciated.

Thanks,
Patrick

About the author

I'm a computer science major at Stony Brook University, and have been working with the Torque Game Engine for a number of years.


#1
12/20/2012 (2:41 pm)
If your model is also in Milkshape-format then it is fairly easy. Get yourself a copy of Milkshape. In the tools menu you then can select Reverse Animation and export your model in the dts format.
#2
12/20/2012 (3:14 pm)
Would like an image to see what the exact issue is.
There is settings you can play with in Torque to adjust animation speed (setting it -1 would reverse the animation)
Or rotate the shape (in the shape editor)
#3
12/20/2012 (4:19 pm)
Hey guys,

Here's a link to the picture. The animations are all set correctly, the guy is just facing the wrong way. Even after rotating the model in the Shape Editor, the animations make him face the other way. I've also played with rotating and positioning the camera in the shape editor with no success.

@Richard
My model is sadly not in Milkshape-format, my team just uses Blender for our modeling stuff, is Milkshape free for commercial use?

Edit: That picture is the standard 3rd person camera for the model.
#4
12/20/2012 (4:26 pm)
To clarify, the issue is not that the animation is playing backwards, but that the model is facing the incorrect direction, and any rotational changes we make when in the shape editor are reset as soon as the animation starts playing.
#5
12/20/2012 (4:38 pm)
sounds like the eye or cam node is backwards, if you rotate everything that will make no difference, try just rotating the cam & eye nodes
#6
12/20/2012 (5:09 pm)
I thought that might be the issue, but I have tried many combinations of placing and rotating the camera's for first and third person, but none of them seem to actually change anything. I always get a similar result to the picture, but with different camera placements/distances.
I saw something in the engine code mentioning that the only transforms for the camera are with the position, not rotation. So I thought there might be a quick fix somewhere in the Player class. I'm a bit lost with the Matrix stuff though.
#7
12/20/2012 (5:35 pm)
Its not the camera you need to rotate its the node, the camera lines itself up to the node in the model, try editing the model and rotating the eye and cam nodes, I had a similar problem years ago when I mounted a gun to my player, the mount node was the wrong way around so the gun mounted backwards.
#8
12/20/2012 (5:59 pm)
The camera for this model is not a node contained within the DAE file. We have been adding in the node using Torque's Shape Editor. Rotating the node within that does nothing. Is this not the case if we were to add it within Blender?
#9
12/20/2012 (7:03 pm)
no, nodes are aligned to the world and as standard player models face backwards in Torque, the CAM and EYE nodes are where the cameras are aligned to. If the nodes where set up so the player's front looks forward in the front view within 3DS Max the EYE node is backwards at least in 3DS Max, I have seen this happen before.

You need to in a modelling program to rotate the cam and eye node's so the camera when it mounts the player in Torque aligns correctly.
#10
12/20/2012 (9:50 pm)
Sadly I don't have 3DSMax, and when the file is imported into Blender the animations seem to break, so I can't export it again. Is there no way to adjust this stuff from inside the engine?
#11
12/21/2012 (12:07 pm)
without looking at the model I can't say, I would be glad to look at it for you though.

You can email me at:- deadly(at)clara(dot)net

In the mean time I'll knock a quick test model up and see what I can do
#12
12/21/2012 (12:19 pm)
Thanks for the offer David, but I can't send out this model due to the EULA. I did follow your instructions with the broken import and the model did export turned around!

Thanks for your help, now I've just got to get the animations working again.
#13
12/21/2012 (12:43 pm)
Hi Patrick
Each model uses a core element to the machine statement.
Chose the pelvis and set the direction as a flow following the green arrow forward, the red right and blue up and you'll be okay.
This applies to all programs modeling, then export model again to DAE or DTS.
Another way is to rotate the bound box 180 degrees in the modeling program that you use.
#14
12/21/2012 (1:49 pm)
ok, had a play around and you can rotate the player model within the shape editor.

select the BIP01 node and apply a rotation to this node
you can also do this manually by adding
%this.setNodeTransform("Bip01", "-0.00291549 -0.0951161 0.799032 0 0 1 2.25965", "1");
to the end of the function SoldierDAE::onLoad(%this) within the last }

the 2.25965 is the rotation you should play with.

replace SoldierDAE with whatever your player datablock is named