Projectiles Don't Fire from MuzzlePoint (Solution)
by Jesse Allen · in Torque 3D Professional · 10/31/2014 (9:10 am) · 4 replies
I have noticed that, despite the server/weapon.cs claiming that projectiles should originate at a weapon's muzzlepoint, projectiles appear to fire from the Player's face(in 3rd Person). In weapon.cs:
But this isn't working right. I'm noticing this especially since I've been working in sideview. It's blatantly obvious that the MuzzlePoint isn't coming into play at all. Projectiles fire out from the Player's eye. It's really obvious using weapons like the Lurker Grenade Launcher, but it's pretty noticeable with all weapons.
Anyone have any suggestions on how to actually make the projectiles originate at the weapon's MuzzlePoint node?
// Create the projectile object
%p = new (%this.projectileType)()
{
dataBlock = %this.projectile;
initialVelocity = %muzzleVelocity;
initialPosition = %obj.getMuzzlePoint(%slot);
sourceObject = %obj;
sourceSlot = %slot;
client = %obj.client;
sourceClass = %obj.getClassName();
};But this isn't working right. I'm noticing this especially since I've been working in sideview. It's blatantly obvious that the MuzzlePoint isn't coming into play at all. Projectiles fire out from the Player's eye. It's really obvious using weapons like the Lurker Grenade Launcher, but it's pretty noticeable with all weapons.
Anyone have any suggestions on how to actually make the projectiles originate at the weapon's MuzzlePoint node?
About the author
Skilled Artist and Musician. Intermediate Torque Developer.
#2
I dug through the ShapeBase.cpp source file, and noticed that there was mention in the comments about a setting that isn't present in the datablock files: 'correctMuzzleVectorTP'
So I added correctMuzzleVectorTP = false; to the weapon datablock and it fixes 'most' of the firing issues. The Lurker Grenade Launcher still shoots out of the Player's face though, lol.
10/31/2014 (9:25 am)
Yep Richard, I sure did. Here's what I did manage to dig up though just now:I dug through the ShapeBase.cpp source file, and noticed that there was mention in the comments about a setting that isn't present in the datablock files: 'correctMuzzleVectorTP'
So I added correctMuzzleVectorTP = false; to the weapon datablock and it fixes 'most' of the firing issues. The Lurker Grenade Launcher still shoots out of the Player's face though, lol.
#3
It's the same gosh-darned problem I ran into before with 3rd Person aiming. Something really should be changed about this (a check if we're in first or 3rd person)...
So anyways, in the weapon datablocks, by default you'll see this at the very top of the datablock:
What you have to do is comment out the firstPerson shape file altogether or for some reason Torque doesn't care if you are in thirdPerson or not. Do this:
Really should be some sort of check taking place since I've ran across this at least a couple times now. I'd also suggest setting the other stuff up for third person as discussed above.
10/31/2014 (10:02 am)
Alright, I fixed it...It's the same gosh-darned problem I ran into before with 3rd Person aiming. Something really should be changed about this (a check if we're in first or 3rd person)...
So anyways, in the weapon datablocks, by default you'll see this at the very top of the datablock:
datablock ShapeBaseImageData(LurkerGrenadeLauncherImage)
{
// Basic Item properties
shapeFile = "art/shapes/weapons/Lurker/TP_Lurker.DAE";
shapeFileFP = "art/shapes/weapons/Lurker/FP_Lurker.DAE";
emap = true;
...
}What you have to do is comment out the firstPerson shape file altogether or for some reason Torque doesn't care if you are in thirdPerson or not. Do this:
datablock ShapeBaseImageData(LurkerGrenadeLauncherImage)
{
// Basic Item properties
shapeFile = "art/shapes/weapons/Lurker/TP_Lurker.DAE";
// -Jesse -Leave my 3rd Person view alone!
// shapeFileFP = "art/shapes/weapons/Lurker/FP_Lurker.DAE";
emap = true;
...
}Really should be some sort of check taking place since I've ran across this at least a couple times now. I'd also suggest setting the other stuff up for third person as discussed above.
#4
10/31/2014 (11:19 am)
Huh, so if it has a first person model it gets all confused. Sweet.
Torque Owner Richard Ranft
Roostertail Games