Game Development Community

Rotation on a 2D 3D Object and?....

by VcDeveloper · in Torque Game Builder · 12/07/2008 (9:17 am) · 4 replies

I need help with rotating a 3D object. I posted this in the Mathematics forums to see if there is a 3D transform functions I can use to solve this.

#1
12/09/2008 (10:58 am)
I had some similar issues with 3d objects. I'm guessing your trying to rotate the 3d object like you would a normal scene object. Unfortunatly the magical frame that holds the 3d object is static, and won't move for anything that scripting alone can fix.

My solution was to mount the 3d object on a scene object then I wrote a little script to tie in the 3d shape's rotation with its parent. Please note that this was for a top down game:

%parent = 3dshape.getmountedparent();
%rotation = %parent.getrotation();
3dshape.setshaperotation(0, 0, %rotation);

I scheduled that along with any movement updates I had running with it to control the scene object.

Hope this helps?
#2
12/10/2008 (2:12 pm)
Let me try that and get back with, but for I this is what I did the control the rotation:

function bluePlayer::updateAnimation( %this )
{
if($turnRt || $turnLf)
%this.DoTurnRotation();
else
$turnSince = 0;

other stuff................
..........................
}

function bluePlayer::DoTurnRotation(%this)
{
$turnOk = getRealTime() - $turnSince;
if($turnOk < $turnNow (=500ms))
return;

$turnSince = getRealTime();
............
do the rotation stuff......
............
}

what do you think?
#3
12/11/2008 (12:45 pm)
Personally having a hard time following the code as I read it, lol. What kind of game are doing? What are the 3d shapes being used for? With a little perspective I can probably be a little more help.
#4
12/13/2008 (9:51 am)
It's a version off the Adventure Kit, but I want to use a 3D character instead of the animated cell character.

But, I'm having a difficult time rotating the 3D character inside the object the same way I would in 3d Space. So, I gave up and just hard coded the 8 isometric directions. I really want to be able to rotate any angle, but I have not found a solution. And, in addition to hard coding the rotations, it's very diffult to control, because it rotates to fast. I tried using a time function to slow it down, but now it looks un-natural for a 3D character.

So, it looks like I'm going over to TXB. I've been spending some time with it for the last two days and they have did a brilliant job with the interface. And much easier than TGB. This environment is more of my style of development. So I will import everthing over to TXB and finish up there. Here I have better access to 3D untilites and context sensitive help.

This was my goal from the start, but I never did put time into TXB. And, now that I have, I see it is a very powerful combo with XNA. I'm also waiting for the 3D TXB.