Author Topic: What are radius impulses? Black holes? Forcefields? Time travel? Momentum?  (Read 2476 times)

Yeah, I believe it's Projectile::onExplode


I'm having a problem with textures and I'm pretty stumped. I have the mod's folder, with the script files inside it. Along with the .cs files I have a folder named Particles. For some reason, my emitters (which use those textures), are appearing as blank images. They are emitting in the correct pattern, so I believe it's just a problem with the particle. Here's my code (I only included one trio of datablocks, since the others are just copies with name changes. They all don't work). I copied it over from a previous mod, where the file structure was similar and the emitters worked.
function tag(%client, %emitter)
{
   if(%emitter $= "Time")
   {
      %client.player.mountImage(TimeTrailImage, $backslot);
   }
   else if(%emitter $= "Heal")
   {
      %client.player.mountImage(HealTrailImage, $backslot);
   }
   else if(%emitter $= "Luck")
   {
      %client.player.mountImage(LuckTrailImage, $backslot);
   }
   else if(%emitter $= "Speed")
   {
      %client.player.mountImage(SpeedTrailImage, $backslot);
   }
   else if(%emitter $= "Possess")
   {
      %client.player.mountImage(PossessionTrailImage, $backslot);
   }
}
//Time Travel
datablock ParticleData(TimeTrailParticle)
{
   dragCoefficient      = 0;
   gravityCoefficient   = 0.0;
   inheritedVelFactor   = 0.15;
   constantAcceleration = 0.0;
   lifetimeMS           = 1000;
   lifetimeVarianceMS   = 0;
   textureName          = "./Particles/timeTravel";
   colors[0]     = "0 0 0 1";
   sizes[0]      = 0.5;
   sizes[1]      = 0.6;
   times[0]      = 0.0;
   times[1]      = 1;
   useAlphaInv = false;
};
datablock ParticleEmitterData(TimeTrailEmitter)
{
  ejectionPeriodMS = 10;
   periodVarianceMS = 0;
   ejectionVelocity = 1;
   ejectionOffset   = 1;
   velocityVariance = 0;
   thetaMin         = 89.9;
   thetaMax         = 90.1;
   phiReferenceVel  = 0;
   phiVariance      = 360;
   overrideAdvance = false;
   particles = "TimeTrailParticle";
   uiName = "Time Trail";
};
datablock ShapeBaseImageData(TimeTrailImage)
{
   shapeFile = "base/data/shapes/empty.dts";
   emap = false;
   mountPoint = $backslot;
   stateName[0] = "Ready"; //This is first
   stateTransitionOnTimeout[0] = "loopStart"; //Name of state to go to next.
   stateTimeoutValue[0] = 0.1; //Seconds for it to go to the next part of the loop.

   stateName[1] = "loopStart"; //Name of the state
   stateTransitionOnTimeout[1] = "loopEnd"; //next state you go to
   stateTimeoutValue[1] = 0.1; //Seconds til the next part of the loop
   stateEmitter[1] = "TimeTrailEmitter"; //The emitted emitter datablock here.
   stateEmitterTime[1] = 1; //Time for the emitter to last, in seconds.

   stateName[2] = "loopEnd";
   stateWaitForTimeout[2] = 0;
   stateTransitionOnTimeout[2] = "loopStart";
   stateEmitterTime[2] = 1; //Emitter lifespan
   stateEmitter[2] = "TimeTrailEmitter";
   stateTimeoutValue[2] = 1;
};

It doesn't work evein if i don't use tag.

You cannot use ./ when specifying image location.
Use the whole path
"Add-Ons/myaddon/Particles/timeTravel"

Nope, didn't work. All of the images are indeed 128x128, direct edits of the default emote images. The file paths are correct, and I'm pretty stumped about what's causing it. They are .png files.

textureName          = "Add-Ons/Server_Powered/Particles/timeTravel";

Also, my previous add-on referred to images that way and it did indeed work, and is still working.
Edit: I got it to work, except I have no idea how.
« Last Edit: June 22, 2015, 11:25:53 PM by Johnny Blockhead »

On a Player, applyImpulse does the same as addVelocity. The 'origin point' isn't used at all.
On a Vehicle/Physics object, as well as velocity, the origin point is used to apply angular momentum based on the datablock's mass and the new velocity vector. This is why the Rocket Launcher can flip over vehicles, etc.

Torque 3D (future version of TGE) code
https://github.com/GarageGames/Torque3D/search?utf8=%E2%9C%93&q=applyImpulse&type=Code
Code: [Select]
void Rigid::applyImpulse(const Point3F &r, const Point3F &impulse)
{
   atRest = false;

   // Linear momentum and velocity
   linMomentum  += impulse;
   linVelocity.x = linMomentum.x * oneOverMass;
   linVelocity.y = linMomentum.y * oneOverMass;
   linVelocity.z = linMomentum.z * oneOverMass;

   // Rotational momentum and velocity
   Point3F tv;
   mCross(r,impulse,&tv);
   angMomentum += tv;
   invWorldInertia.mulV(angMomentum, &angVelocity);
}
Code: [Select]
void Player::applyImpulse(const Point3F&,const VectorF& vec)
{
AssertFatal( !mIsNaN( vec ), "Player::applyImpulse() - The vector is NaN!" );

   // Players ignore angular velocity
   VectorF vel;
   vel.x = vec.x / getMass();
   vel.y = vec.y / getMass();
   vel.z = vec.z / getMass();

   // Make sure the impulse isn't too big
   F32 len = vel.magnitudeSafe();
   if (len > sMaxImpulseVelocity)
   {
      Point3F excess = vel * ( 1.0f - (sMaxImpulseVelocity / len ) );
      vel -= excess;
   }

   setVelocity(mVelocity + vel);
}
(The origin point isn't given a name, so isn't used)

that makes sense then, I was curious why they were using applyImpulse instead of addVelocity
... but they're the same

so if you had a stationary jeep, applied a huge sideways impulse at the base, it should just start flipping while being launched sideways?
but with addvelocity it'd just rocket to the side?


that makes sense then, I was curious why they were using applyImpulse instead of addVelocity
... but they're the same
It's also worth noting that impulses factor in the mass of the object, whereas with velocity, you have to scale it manually. Impulses are more suited to explosions, knockback, and other kind of forces that would affect large objects less, whereas setting or adding velocity is more appropriate when you want precision or consistency, like a jump pad or grappling hook.


...Welcome the forget back?
pretty much

I kind of missed seeing that avatar