Author Topic: Mounted emitter converging on player eye vector/ground intersect  (Read 2647 times)

Latest update here

Bit of a strange problem. I have a jetpack which is being mounted to the Backslot of the player. There are two emitters. For some reason, the direction of the emitters is snapping forward based on the player's distance from the ground

http://i.imgur.com/saveTGl.gif
http://i.imgur.com/W9gzsY0.gif

You can hopefully see from above that there is a specific height whereby it stops happening. You'll notice I'm leaning a bit forward in the shots too, if you stand up completely straight it doesn't seem to happen. I thought it might be when there's a downward velocity, but it doesn't happen past a certain height at all.

I've tried repositioning the emitter nodes on the model but it doesn't make a difference (either in location or direction).

Has anyone encountered this before or have any idea what might be causing it?


Edit: Not sure of this is worth noting, but this also happens with Demian's Jetpack tool

« Last Edit: November 01, 2015, 04:13:02 PM by Darryl McKoy »

My first thought is that it might be to do with
Code: [Select]
jetGroundDistance = "3.914";in the player datablock? Try setting to 0 and see if anything changes.
« Last Edit: October 31, 2015, 08:52:43 AM by Jervan »

Nup no change unfortunately

Here's the code I'm using
Code: [Select]
$CWPlayers::triggerSlot = 2;

datablock PlayerData(PlayerCloneTrooperJet : PlayerStandardArmor) {
uiName = "Clone Jet Trooper";

minJetEnergy = 1;
jetEnergyDrain = 2;
canJet = 1;
showEnergyBar = true;

jetEmitter = "";
jetGroundEmitter = "";
jetGroundDistance = "0";
};

datablock ShapeBaseImageData(CloneJetChestImage) {
shapeFile = "./Models/CloneJetpackChest.dts";
emap = true;
mountPoint = 2;
offset = "0 0 0";
eyeOffset = "0 0 10";
rotation = eulerToMatrix("0 0 0");
scale = "1 1 1";
doColorShift = false;

stateName[0] = "Activate";
stateTimeoutValue[0] = 0.1;
stateTransitionOnTimeout[0] = "Ready";

stateName[1] = "Ready";
stateAllowImageChange[1] = true;
stateTransitionOnLoaded[1] = "Fire";
stateTransitionOnNotLoaded[1] = "Ready";

stateName[2] = "Fire";
stateScript[2] = "checkEnergyLevel";
stateAllowImageChange[2] = true;
stateEmitterNode[2] = emitterPoint;
stateEmitterTime[2] = 0.15;
stateEmitter[2] = CW_jetPackEmitter;
stateTimeoutValue[2] = 0.05;
stateTransitionOnNotLoaded[2] = "Ready";
stateTransitionOnTimeout[2] = "Fire2";

stateName[3] = "Fire2";
stateScript[3] = "checkEnergyLevel";
stateAllowImageChange[3] = true;
stateEmitterNode[3] = emitterPoint2;
stateEmitterTime[3] = 0.15;
stateEmitter[3] = CW_jetPackEmitter;
stateTimeoutValue[3] = 0.05;
stateTransitionOnNotLoaded[3] = "Ready";
stateTransitionOnTimeout[3] = "Fire";
};

package CWJetPackage {
//Credit to Demian, Daenth, Moppy, McTwist and Port (Demian's jetpack tool)
function Armor::onTrigger(%datablock,%player,%slot,%val) {

//Armor::onTrigger is called whenever a player jumps, jets, crouches, etc.
//Each of these actions is assigned to a particular slot.
//The jet slot is 4 and because this function is called when a variety of actions are performed, we want to make sure the jet action triggered this function.
if(%slot == 4)
{
//%val is a boolean stating whether or not action is occurring or not.
//If %val is 1 then jets are on.
if(%val && %player.getEnergyLevel() > 0)
{

if(%player.getMountedImage($CWPlayers::triggerSlot) == nameToID(JangoJetChestImage) || %player.getMountedImage($CWPlayers::triggerSlot) == nameToID(CloneJetChestImage))
{
%player.setImageLoaded($CWPlayers::triggerSlot,1); //Slot is 2 ($BackSlot), and we are setting the ammo to 1 so it has ammo.
}
}
//If %val is 0 then jets are not on.
else
{
if(%player.getMountedImage($CWPlayers::triggerSlot) == nameToID(JangoJetChestImage) || %player.getMountedImage($CWPlayers::triggerSlot) == nameToID(CloneJetChestImage))
{
%player.setImageLoaded($CWPlayers::triggerSlot,0); //Slot is 2 ($BackSlot), and we are setting the ammo to 0 so it has no ammo.
}
}
}
return Parent::onTrigger(%datablock,%player,%slot,%val);
}
}; activatePackage(CWJetPackage);

datablock ParticleData(CW_jetPackParticle) {
textureName = "base/data/particles/dot";
animateTexture = false;
useInvAlpha = false;

lifetimeMS = 135;
lifetimeVarianceMS = 0;

spinSpeed = 0.0;
spinRandomMin = 0.0;
spinRandomMax = 0.0;

inheritedVelFactor = 1.0;
dragCoefficient = 0.0;
gravityCoefficient = 0.0;
windCoefficient = 0.0;
constantAcceleration = 0.0;

colors[0] = "0.0 0.0 1.0 1.0";
colors[1] = "1.0 0.5 0.0 1.0";
colors[2] = "1.0 0.0 0.0 0.0";
colors[3] = "1.0 1.0 1.0 1.0";

sizes[0] = "0.365";
sizes[1] = "0.38";
sizes[2] = "0.0";
sizes[3] = "0.0";

times[0] = "0.0";
times[1] = "0.2";
times[2] = "1.0";
times[3] = "1.0";
};

datablock ParticleEmitterData(CW_jetPackEmitter) {
className = "ParticleEmitterData";

uiName = "Jetpack Fire";
particles = CW_jetPackParticle;

lifetimeMS = 0;
lifetimeVarianceMS = 0;

ejectionOffset = 0.0;
ejectionPeriodMS = 6.0;
periodVarianceMS = 0.0;
ejectionVelocity = 6.5;
velocityVariance = 1.0;

orientParticles = false;
orientOnVelocity = true;

phiReferenceVel = 0.0;
phiVariance = 0.0;
thetaMin = 0.0;
thetaMax = 0.0;

useEmitterColors = false;
useEmitterSizes = false;

overrideAdvance = false;
doFalloff = true;
doDetail = true;
};
« Last Edit: October 31, 2015, 09:06:50 AM by Darryl McKoy »

Maybe it can't be 0, try 999?
Getting into unknown territory here but maybe try putting
Code: [Select]
upResistFactor = "0";
horizResistFactor = "0";

Not sure if that effects jet emitters or not

Code: (CW_jetPackEmitter) [Select]
doFalloff = true;
doDetail = true;
I've never seen these before, what if you remove them, or just doFalloff?

Code: [Select]
orientOnVelocity = true;this also seems related, try making it false

edit: no need, orientParticles is false so this line isn't even needed unless you set orientparticles to true
« Last Edit: October 31, 2015, 06:12:21 PM by QuadStorm »

Code: [Select]
orientOnVelocity = true;this also seems related, try making it false

I think that just rotates the particle's texture in whatever direction the emitter is spewing it so that the particles face the same direction

No dice on any of them. I tried to edit almost every variable in the emitter's datablock before posting here (I should have put that in the OP sorry)

I don't think it can be related to the standard jet settings either because I'm not using the jet emitters, I'm using emitters attached to my mounted image.

Edit: gotta head off to bed now, I'll test anything you guys post in the morning
« Last Edit: October 31, 2015, 09:20:22 AM by Darryl McKoy »

At this point I'd try a different method. What about using the jetEmitter and taking the emitter out of the image? You get a ground emitter that way too. Then the only problem is mounting the emitter to the pack instead of the feet which seems like there'd be a more definite solution to.. Not that I know how to do it, anyone any clues?

What about using orientParticles = true; and/or overrideAdvance = true;?

What about using orientParticles = true; and/or overrideAdvance = true;?
Neither seem to do anything related to this

At this point I'd try a different method. What about using the jetEmitter and taking the emitter out of the image? You get a ground emitter that way too. Then the only problem is mounting the emitter to the pack instead of the feet which seems like there'd be a more definite solution to.. Not that I know how to do it, anyone any clues?
I had a look into it before I went with the mounted image route, and I couldn't figure out how the jet emitters are actually mounted to the player

It definitely seems like it should be the jetGroundDistance which is causing it, but I've had no luck with changing the value..


Edit: Same thing happens with playerJetEmitter instead of using my own emitter. So that rules out the emitter as the problem I guess (because it doesn't happen with the default jet).

Edit2: The player's pitch is definitely also somehow a factor:
« Last Edit: October 31, 2015, 07:40:21 PM by Darryl McKoy »

I think I might actually know what is causing it, but I don't know how to fix it. I've been having a look at weapons which use emitters, and I noticed the same thing happening with the Pyro Gun

It's a bit more subtle (I replaced the particle so it's easier to see):

See how the particles are drifting towards the player's eye vector where it's colliding with the ground? I think that's exactly what is happening with my jetpack. It explains why the more you lean forward, the higher you have to be for the particles to be straight. It also explains why the jetpack particles don't go weird when you look at a pitch above the horizon.

But yeah, I just don't know how to fix it..

Edit: I've tried both:
   accuFire = false;
   correctMuzzleVector = false;
with no luck
« Last Edit: November 01, 2015, 04:08:18 PM by Darryl McKoy »

I've encountered this before, but have never been able to fix it. From my understanding its 99% reliant on the theta and phi reference values.
Code: [Select]
phiReferenceVal
phiVariance
thetaMin
thetaMax

Try loving around with these values under the particle emitter

Either that or the particles are automatically snapping towards the crosshair hitscan. This is more evident in the flamethrower test you presented

I tried the theta and phi attributes but it's not them. I'm 99% sure now that it's something to do with the eye vector.

It sounds like it's related to correctMuzzleVector on the ShapeBaseImageData
Quote
Boolean value specifying that the muzzle vector should be
calculated from the players eyeVector, not from the muzzleVector of
the image.
..except that changing that value isn't affecting the emission direction. I had a look at the result of getMuzzleVector and the muzzle vector doesn't appear to be changing when the player is looking at the ground.