Author Topic: Hands visible in first person  (Read 2268 times)

I am looking to create a parkour-like playertype and I was wondering how I would achieve making it so that you can see hands, animated, in first person. What I mean by this is when you walk in first person, you can see the classic hands waving and moving as you would see in third person. Thus, allowing me to further animate the hands and create more of a parkour-like playertype.

Thanks in advance!

since im not clear of how torque works, we will use the "godzilla" weapon from the Rampage Gamemode

Code: [Select]
////////////////
//weapon image//
////////////////
datablock ShapeBaseImageData( godzillaLeftHandImage )
{
   // Basic Item properties
   shapeFile = "./lHand.dts";//"base/data/shapes/empty.dts";
   emap = true;
   
   mountPoint = 1;
   
   doColorShift = true;
   colorShiftColor = "1.0 0.878 0.612 1.0";
   
    offset = "0 0.2 0";
};

datablock ShapeBaseImageData( godzillaWeaponImage )
{
   // Basic Item properties
   shapeFile = "./rHand.dts";//"base/data/shapes/empty.dts";
   emap = true;

   // Specify mount point & offset for 3rd person, and eye offset
   // for first person rendering.
   mountPoint = 0;
   offset = "0 0.2 0";

   // When firing from a point offset from the eye, muzzle correction
   // will adjust the muzzle vector to point to the eye LOS point.
   // Since this weapon doesn't actually fire from the muzzle point,
   // we need to turn this off. 
   correctMuzzleVector = false;

   eyeOffset = "";//"0.7 1.2 -0.25";

   // Add the WeaponImage namespace as a parent, WeaponImage namespace
   // provides some hooks into the inventory system.
   className = "WeaponImage";

   // Projectile && Ammo.
   item = godzillaWeaponItem;
   ammo = " ";
   projectile = godzillaWeaponProjectile;
   projectileType = Projectile;

   //melee particles shoot from eye node for consistancy
   melee = true;
   doRetraction = false;
   //raise your arm up or not
   armReady = false;

   //casing = " ";
   doColorShift = true;
   colorShiftColor = "1.0 0.878 0.612 1.0";

   // Images have a state system which controls how the animations
   // are run, which sounds are played, script callbacks, etc. This
   // state system is downloaded to the client so that clients can
   // predict state changes and animate accordingly.  The following
   // system supports basic ready->fire->reload transitions as
   // well as a no-ammo->dryfire idle state.

   // Initial start up state
stateName[0] = "Activate";
stateTimeoutValue[0] = 0.5;
stateTransitionOnTimeout[0] = "Ready";
//stateSound[0]                    = godzillaWeaponDrawSound;

stateName[1] = "Ready";
stateTransitionOnTriggerDown[1] = "PreFire";
stateAllowImageChange[1] = true;

stateName[2] = "PreFire";
stateScript[2]                  = "onPreFire";
stateAllowImageChange[2]        = false;
stateTimeoutValue[2]            = 0.1;
stateTransitionOnTimeout[2]     = "Fire";

stateName[3]                    = "Fire";
stateTransitionOnTimeout[3]     = "Ready";
stateTimeoutValue[3]            = 0.2;
stateFire[3]                    = true;
stateAllowImageChange[3]        = false;
stateSequence[3]                = "Fire";
stateScript[3]                  = "onFire";
stateWaitForTimeout[3] = true;

stateName[4] = "CheckFire";
stateTransitionOnTriggerUp[4] = "StopFire";
stateTransitionOnTriggerDown[4] = "Fire";


stateName[5]                    = "StopFire";
stateTransitionOnTimeout[5]     = "Ready";
stateTimeoutValue[5]            = 0.2;
stateAllowImageChange[5]        = false;
stateWaitForTimeout[5] = true;
stateSequence[5]                = "StopFire";
stateScript[5]                  = "onStopFire";
};

function godzillaWeaponImage::onFire( %this, %obj )
{
%obj.playthread( 2, activate2 );
}

function godzillaWeaponImage::onMount( %this, %obj )
{
%obj.playThread( 1, armReadyBoth );
%obj.mountImage( godzillaLeftHandImage, 1 );
parent::onMount( %this, %obj );
}

function godzillaWeaponImage::onUnmount( %this, %obj )
{
if( %obj.getMountedImage( 1 ).getName() $= "godzillaLeftHandImage" )
%obj.unMountImage( 1 );

parent::onUnmount( %this, %obj );
}

function godzillaWeaponImage::onPreFire(%this, %obj, %slot)
{
return;
}

function godzillaWeaponImage::onStopFire(%this, %obj, %slot)
{
return;
}

there has been someone that was able to make hands visible but i am not sure which node to be visible in first person mode, so we use this as a attempt to make hands appear

I'm pretty sure badspot just took the hand model from the player doll and made a model out of that, and set the LOD (you see it when exporting using milkshape) to a value that makes it so it only appears in first person. I couldn't tell you what to set it to exactly because I haven't messed with it personally, but try 1. It's 0 by default.

Basically, it's just taking the hand models and putting them on an image, and mounting that image to the player's actual hands. Unfortunately, I think this is the only good way to do this with Torque's limitations, and it means the hands will disappear when you hold an object (unless more than one image can be attached to a mount point at once - not sure about this part).

Unfortunately, I think this is the only good way to do this with Torque's limitations, and it means the hands will disappear when you hold an object (unless more than one image can be attached to a mount point at once - not sure about this part).

Yes. The slots are just an arbitrary list of mounted images. They have nothing to do with the actual mount points on the model.

Yes. The slots are just an arbitrary list of mounted images. They have nothing to do with the actual mount points on the model.
Of course, even if that can be done, there's still a limit to how many images can be attached to an object at once, correct?

Of course, even if that can be done, there's still a limit to how many images can be attached to an object at once, correct?

Yes. Only image slots 0, 1, 2 and 3 are usable.