Game Development Community

Rotating DTS model in TX3D

by SteveRap · in Torque X 2D · 06/04/2008 (8:06 pm) · 7 replies

Does anybody know how to rotate a T3DTSRenderComponent (DTS) model?
I found the thread http://www.garagegames.com/mg/forums/result.thread.php?qt=74933, which discussed this for a T3DStaticTSRenderComponent.
I've tried implementing the code from the above thread, on the parent node, but nothing seems to happen.
What I am trying to achieve is to be able to rotate a character on the screen with a fixed camera, rather that attach a camera to a character and move the camera.
I expect this could be done with a freecamera, but I'm interested in how to rotate the object itself rather that the view of it.

#1
06/05/2008 (10:57 pm)
This is how I do it...

float _degreesX = 45;
float _degreesY = 45;
float _degreesX = 45;
 
componentScene.Transform =
    Matrix.CreateRotationX(MathHelper.ToRadians(_degreesX)) *
    Matrix.CreateRotationY(MathHelper.ToRadians(_degreesY)) *
    Matrix.CreateRotationZ(MathHelper.ToRadians(_degreesZ));

John K.

Updated: be sure to set the transform on the scene component, not the render component.
#2
06/05/2008 (11:17 pm)
John, Thanks for the reply.
Just tried this out, but the Transform property for T3DTSRenderComponent is read only.
Am I missing something basic here?.
#3
06/05/2008 (11:27 pm)
Aha. Do you have the source (pro license)? I went ahead and made it public.

John K.
#4
06/05/2008 (11:30 pm)
No, I've been holding off for now until the documentation and 3D builder are available.
Looks like I will have to buy the pro version sooner than later, as I am hitting more and more problems that I need the source for.
#5
06/05/2008 (11:31 pm)
If not, try replacing your dll with this one... It's pretty stock, with just a few private classes marked public, along with a couple other bug fixes.

www.envygames.com/tx/GarageGames.TorqueX.Framework.dll

John K.
#6
06/05/2008 (11:49 pm)
Just tried this, still only letting me read the value not set it?
#7
06/07/2008 (12:43 pm)
Just checked again, the .dll I posted should have the Transform property off of the T3DSceneComponent public. Ahhh... you were trying to set the T3DTSRenderComponent transform...

John K.