Projectile isn't firing under player animation (Solved, thanks Steve)
by 000 · in Torque 3D Professional · 11/04/2012 (10:47 pm) · 8 replies
My player has a weapon that, when fired, the player should animate the attack on their body. The problem I'm running into is when SetActionThread is enabled to animate the player the projectile doesn't fire, when it isn't enabled then it does fire.
Hopefully this video will help describe my meaning:
This is the same weapon with both primary and alternative fires, for testing purposes they are firing the same projectile type. The primary fire has the SetActionThread to play the animation, the animation plays on attack but the projectile doesn't come out. The secondary fire does not have SetActionThread and fires just fine.
Any suggestions on where I should look to remedy this? Thanks guys! :)
Hopefully this video will help describe my meaning:
This is the same weapon with both primary and alternative fires, for testing purposes they are firing the same projectile type. The primary fire has the SetActionThread to play the animation, the animation plays on attack but the projectile doesn't come out. The secondary fire does not have SetActionThread and fires just fine.
Any suggestions on where I should look to remedy this? Thanks guys! :)
#2
On topic:
It would be nice if you would share some of your code, more specifically the snippet where the projectile is created.
11/05/2012 (1:27 am)
Off topic: Very nice model!On topic:
It would be nice if you would share some of your code, more specifically the snippet where the projectile is created.
#3
11/05/2012 (10:43 am)
Thanks for the love guys, right now it's a standard weapon setup with a SetActionThread to animate the player. I'll post the code up tonight.
#4
\art\datablocks\weapons\Ripper.cs
11/05/2012 (6:30 pm)
\game\scripts\server\Ripper.csfunction RipperImage::onFire(%this, %obj, %slot)
{
%obj.setActionThread("Aim");
}\art\datablocks\weapons\Ripper.cs
datablock ItemData(RipperClip)
{
// Mission editor category
category = "AmmoClip";
// Add the Ammo namespace as a parent. The ammo namespace provides
// common ammo related functions and hooks into the inventory system.
className = "AmmoClip";
// Basic Item properties
shapeFile = "art/shapes/weapons/blank/blank.DAE";
mass = 1;
elasticity = 0.2;
friction = 0.6;
// Dynamic properties defined by the scripts
pickUpName = "Ripper clip";
count = 1;
maxInventory = 1;
};
datablock ItemData(RipperAmmo)
{
// Mission editor category
category = "Ammo";
// Add the Ammo namespace as a parent. The ammo namespace provides
// common ammo related functions and hooks into the inventory system.
className = "Ammo";
// Basic Item properties
shapeFile = "art/shapes/weapons/blank/blank.DAE";
mass = 1;
elasticity = 0.2;
friction = 0.6;
// Dynamic properties defined by the scripts
pickUpName = "Ripper ammo";
maxInventory = 1;
clip = RipperClip;
};
datablock ItemData(Ripper)
{
category = "Weapon";
className = "Weapon";
shapeFile = "art/shapes/weapons/blank/blank.DAE";
mass = 12;
elasticity = 0.2;
friction = 0.6;
maxVelocity = "15.0";
pickUpName = "Ripper";
image = RipperImage;
description = "Ripper";
max[Ripper] = 1;
};
datablock ShapeBaseImageData(RipperImage)
{
shapeFile = "art/shapes/weapons/blank/blank.DAE";
mountPoint = 0;
eyeOffset = "0 0 0"; // 0.46=right/left 0.5=forward/backward, -0.5=up/down
className = "WeaponImage";
item = Ripper;
ammo = RipperAmmo;
clip = RipperClip;
projectile = FireBoltProjectile;
projectileType = Projectile;
projectileSpread = "0.005";
altProjectile = FlameBoltProjectile;
altprojectileType = Projectile;
altProjectileSpread = "0.005";
stateName[0] = "Activate";
stateTransitionOnTimeout[0] = "Ready";
stateTimeoutValue[0] = 0;
stateSequence[0] = "Activate";
stateSound[0] = DrawWeaponSound;
stateName[1] = "Ready";
stateTransitionOnTriggerDown[1] = "Fire";
stateTransitionOnAltTriggerDown[1] = "AltFire";
stateName[2] = "Fire";
stateTransitionOnTimeout[2] = "PostFire";
stateTimeoutValue[2] = 0.4;
stateAllowImageChange[2] = false;
stateScript[2] = "onFire";
stateSound[2] = meleeFireSound;
stateName[3] = "PostFire";
stateTransitionOnTimeout[3] = "Ready";
stateTimeoutValue[3] = 0;
stateAllowImageChange[3] = false;
stateName[4] = "AltFire";
stateTransitionOnTimeout[4] = "AltPostFire";
stateTimeoutValue[4] = 0.15;
stateAllowImageChange[4] = false;
stateScript[4] = "onAltFire";
stateSound[2] = meleeFireSound;
stateEmitter[4] = GunFireSmokeEmitter;
stateEmitterTime[4] = 0.025;
stateName[5] = "AltPostFire";
stateTransitionOnTimeout[5] = "Ready";
stateTimeoutValue[5] = 0;
stateAllowImageChange[5] = false;
};
#5
11/06/2012 (7:02 am)
Mack, there's no info about anything other than the animation in your custom weapon specific (Ripper) onFire function - which is overwriting the "all weapons" onFire function in scripts/server/weapon.cs. You need to copy that info which spawns the projectile over to your custom weapon specific (Ripper) onFire function.
#6
11/06/2012 (8:25 am)
Thanks Steve, I'll give it a shot tonight. B)
#7
spawning a projectile is shown in scripts/server/weapon.cs @ about line 162 in WeaponImage::onFire()....
11/07/2012 (3:16 pm)
@ Lukasspawning a projectile is shown in scripts/server/weapon.cs @ about line 162 in WeaponImage::onFire()....
#8
11/08/2012 (7:12 pm)
Thanks again Steve, it was indeed as you said.
Torque Owner Stefan Lundmark