What does correctmuzzlevector do?
by Sean H. · in Torque Game Engine · 08/30/2006 (8:28 am) · 11 replies
What does correctmuzzlevector = false mean? how would it be different if it were set to true?
this is what I am researching now. I am attempting to create a custom rig for a fps game. the main thing I am currently investigating is how to achieve a desired orientation for the weapon barrel and how a projectile knows to follow the viewpoint LOS. In most of the default weapon scripts I've seen, comments mention that this option forces the weapon to fire along the current viewpoint LOS, but since the weapon doesnt use the muzzlepoint for firing, its set to false. this is extremely confusing because every weapon DOES use getmuzzlepoint() for placing the projectile. so why isnt this set to true?
as far as I know there are 3 factors which determine the path a weapon-based projectile travels:
1. offset/eyeoffset
2. rotation of the "muzzle" node in relation to the rotation of the "mountpoint" node
3. "correctmuzzlevector" shapebaseimage property
I'm just not sure how these factors work with each other to create the determine the end result. are there any other factors which are involved? finally, given a particular custom rig, how can one be certain the projectile will travel from the weapon along the current LOS?
thanks in advance.
this is what I am researching now. I am attempting to create a custom rig for a fps game. the main thing I am currently investigating is how to achieve a desired orientation for the weapon barrel and how a projectile knows to follow the viewpoint LOS. In most of the default weapon scripts I've seen, comments mention that this option forces the weapon to fire along the current viewpoint LOS, but since the weapon doesnt use the muzzlepoint for firing, its set to false. this is extremely confusing because every weapon DOES use getmuzzlepoint() for placing the projectile. so why isnt this set to true?
as far as I know there are 3 factors which determine the path a weapon-based projectile travels:
1. offset/eyeoffset
2. rotation of the "muzzle" node in relation to the rotation of the "mountpoint" node
3. "correctmuzzlevector" shapebaseimage property
I'm just not sure how these factors work with each other to create the determine the end result. are there any other factors which are involved? finally, given a particular custom rig, how can one be certain the projectile will travel from the weapon along the current LOS?
thanks in advance.
#2
so how would one define a shapebaseimage projectile which DOES NOT travel along the LOS? if correctMuzzleVector is set to true, will the path the projectile takes depend solely on the rotation of the muzzlepoint node?
08/30/2006 (10:38 am)
Thanks Tim. I'm still a bit confused though. The reason I'm confused is because in the onFire() script, it looks like the projectile is being spawned from the muzzlepoint. so if I'm understanding correctly, if you set correctMuzzleVector to false, then the muzzlepoint for the weapon is determined based on the values set for eyeoffset, but if correctMuzzlevector is set to true, the projectile is spawned from the position of the actual muzzle node defined for the weapon model. is this correct?so how would one define a shapebaseimage projectile which DOES NOT travel along the LOS? if correctMuzzleVector is set to true, will the path the projectile takes depend solely on the rotation of the muzzlepoint node?
#3
It basically effects the return of getMuzzleVector if it's set to true.
08/30/2006 (11:04 am)
The projectile is (should) always be spawned from the muzzle point, correctMuzzleVector has nothing to do with that. What I think it does is try to munge the getMuzzleVector calculation to fire more accurately where you are looking, instead of just where the muzzleVector of the weapon is actually pointing, which you may or may not want, depending on how your weapon is setup.It basically effects the return of getMuzzleVector if it's set to true.
#4
"instead of just where the muzzleVector of the weapon is actually pointing"
from what you're saying since this setting is always false, this is how torque weapons are usually set up, using just where the actual muzzleVector is pointing. i wonder why this option is never used in the weapon scripts...
08/30/2006 (11:41 am)
Paul thats sorta the impression I got reading the comments in the script. "instead of just where the muzzleVector of the weapon is actually pointing"
from what you're saying since this setting is always false, this is how torque weapons are usually set up, using just where the actual muzzleVector is pointing. i wonder why this option is never used in the weapon scripts...
#5
08/30/2006 (11:49 am)
I believe if you use eyeOffset, the weapon (and it's muzzleVector) will probably be aligned to the point where using correctMuzzleVector is irrelevant. I think it comes more into play if you were not using eyeOffset and the muzzleVector is going to be derived from where the weapon is actually placed on the player. I'm not totally sure if getMuzzleVector cares about eyeOffset or not though. I just recall setting this option to true seemed to have no effect when I was doing Realm Wars mods way back when.
#6
Edit: I'm all confused now. :(
08/30/2006 (1:56 pm)
So if there's no eyeoffset, then the getMuzzleVector will use the default muzzlepoint vector and node orientation, otherwise if there is a defined eyeoffset, then the same muzzlepoint is used for the starting point of the projectile, correctMuzzleVector will make it automatically aligns itself to the LOS?Edit: I'm all confused now. :(
#7
08/30/2006 (2:07 pm)
Ok so generally speaking, correctMuzzlevector should only be true if the weapon does NOT use an eyeoffset?
#8
08/30/2006 (2:51 pm)
That's my guess. Try playing with it and seeing what echoing getMuzzleVector returns in different cases.
#9
From the C++ source this causes the engine to:
// Modify muzzle if needed to aim at whatever is straight in front of eye. Let the
// caller know if we actually modified the result.
The only valid setting would be "correctMuzzleVector = False;"
This will tell the engine to shoot the projectile along the path defined by the MuzzleVector.
Or to put it in english... you can shoot at something you aren't looking at.
08/30/2006 (2:56 pm)
CorrectMuzzleVector is TRUE by default. From the C++ source this causes the engine to:
// Modify muzzle if needed to aim at whatever is straight in front of eye. Let the
// caller know if we actually modified the result.
The only valid setting would be "correctMuzzleVector = False;"
This will tell the engine to shoot the projectile along the path defined by the MuzzleVector.
Or to put it in english... you can shoot at something you aren't looking at.
#10
also, considering that the weapon orientation and mounts are under the influence of "armthread" I can greatly appreciate the apparent amount of work that went into the default rig setup. it would seem extremely difficult to get a custom character and weapon setup which doesnt use correctmuzzlevector but still finds the LOS correctly.
now the only thing I dont understand is what eyeoffset is used for.
08/30/2006 (3:35 pm)
Ok that makes sense. still a bit of a mystery to me that the scripts dont use this by default...also, considering that the weapon orientation and mounts are under the influence of "armthread" I can greatly appreciate the apparent amount of work that went into the default rig setup. it would seem extremely difficult to get a custom character and weapon setup which doesnt use correctmuzzlevector but still finds the LOS correctly.
now the only thing I dont understand is what eyeoffset is used for.
#11
08/30/2006 (4:38 pm)
EyeOffset affects how you see the weapon in first person view. It's sort of a half done hack to give you a "first person version" of the weapon, by just changing where it renders for that client when in first person view. If you don't set an eyeOffset, then it will just show up where it is actually mounted on the player, which may or may not be in the viewport. The problem with the eyeOffset is, it's only offsetting the position of the weapon, so if you have renderFirstPerson set to true, or want any animations using hands, it's going to look weird and not work. It's okay for simple weapons and animations, but if you ever wanted to do more complex stuff, I would just avoid it entirely and make your animations and mounts to be visible from the camera like you want.
Torque Owner Tim Heldna
Will spawn the projectile from a node on the player model named eye.
Pending on how you are rendering your weapon, I.e. using an eyeOffset or not, will determine which is best to use.
- Tim