Game Development Community

Sorry about the double post

by USC - IMD student 2 · in Torque Game Builder · 02/18/2008 (1:19 pm) · 1 replies

Hello everyone, n00b Torque developer here. Please excuse the length of the inquiry I'm about to write. The more info I provide, the more accurate your help will be. That's my philosophy.

Basically, I have five sprites: a left arm, a right arm, a left leg, a right leg, and a torso. Optimally, the limbs would be mounted to the torso so when the torso moves, the limbs move. The problem is that though I can code the limbs to rotate when they're independent of the torso (i.e. not mounted), the minute I mount them to the torso the code ceases to function.

An example of the relevant code is:

if($limbUpCounter == 1)
{
$limbAcceleration = $limbAcceleration + 0.2;
if(%this.limbSelected == 1)
{
%this.limbAngle = %this.owner.getRotation();
if(%this.limbName $= "leftarm")
{
%this.owner.setRotation(%this.limbAngle + $limbAcceleration);
}
else if(%this.limbName $= "leftleg")
{
%this.owner.setRotation(%this.limbAngle + $limbAcceleration);
}
else if(%this.limbName $= "rightarm")
{
%this.owner.setRotation(%this.limbAngle - $limbAcceleration);
}
else if(%this.limbName $= "rightleg")
{
%this.owner.setRotation(%this.limbAngle - $limbAcceleration);
}
}
}

where limbUpCounter is changed to 1 on the up arrow press, then changed to zero on release; %this.limbSelected checks to see if the limb has been selected i.e. able to move; %this.limbName checks which limb the code is running on; limbAcceleration is a steadily increasing global variable that increases the speed that the limb rotates the longer the code is pressed. Etc.

Notice I use the Torque function setRotation. It works. But when the limbs are mounted, this function does not work. When the limbs are mounted, setMountRotation does not work either (from the name it seems like it should). Just searching through the 1.7 documentation, I can't really find any other functions that seem relevant.

It seems to me that there's probably some simple function already included in Torque that should allow me to rotate mounted objects without rotating the mount. But I'm stumped. Could anyone point me in the right direction? Maybe some variable that has to be changed to allow the mounted objects to rotate while still mounted? Thanks.

#1
02/20/2008 (1:05 pm)
From the other post I take it you figured it out?

I've often wondered about doing a piece comprised player character in TGB. My conclusion was that it would be more trouble than its worth. How is it working out for you? What kind of game are you doing? Admittedly, if you wanted location based damage, this method of player generation seems like the only option.