Game Development Community

Change Player Shape changing weapon

by University of Pisa (#0004) · in Torque Game Engine · 04/16/2006 (3:06 am) · 4 replies

Hi,
I need to change appearance of player when he gets a new weapon,
i.e. if i have a rifle i don't hold it like a gun, and so on.
Anyone can help me?

#1
04/16/2006 (3:13 am)
I believe the best way to accomplish this is with blend sequences overlayed for your different types of weapons. At least I hope it is, since that's what I plan on doing eventually. Not sure if anyone else has already done something like this and how they worked it in.
#2
04/16/2006 (4:40 am)
If you're talking about different holding positions then you need to specify 'arm threads'. This lets a character hold different weapons in a different position. E.g. select a pistol and one hand is used, machine gun and two hands and so on.

This is setup in the model and a tiny bit in script.

In your weapon.cs script you'll need something like this...
function WeaponImage::onMount(%this, %obj, %slot)
{
// Images assume a false ammo state on load. We need to
// set the state according to the current inventory.
...
...

   if (%this.armthread $= "")
   %obj.setArmThread(lookms);
   else
   %obj.setArmThread(%this.armThread);
}
and in each individual weapon script, ie rifle.cs...
datablock ShapeBaseImageData(rifleImage)
{
   // Basic Item properties
...
...

   armThread = "looknw";

Then all you have to do is create the arm thread in your model and you're set.
#3
04/16/2006 (5:49 am)
Thx for your help, now it's clear.
#4
04/16/2006 (7:50 am)
...and make certain they're Blend type animation sequences[for any look*], or they may not sync up correctly inside the engine to what you see in the modelling program.