Mounted particle effects on shape crashing editor
by Jeff Loveless · in Torque Game Engine · 04/12/2007 (2:45 pm) · 24 replies
(edit) This code is working, more or less to its intended purpose, i get a nice firey blast coming from the nice firey rock i made i'll post a video showing it and then the crash I'm seeking help with :)
Ok, no need to be secretive of this code I'm using a big of a variation of the mounted particle effects resource, here www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=8156 just changed to automaticly mount the emmiter upon creation. It would be a nice addition to that resource except for the fact that its causing the missions to crash
the problem I'm having, is that as soon as I add the shape the mission editor crashes, or if i have one in a mission and load it, as soon as I open the mission editor it crashes back to the main menu with that message saying you've been disconnected you may not have the propper art/etc
the only clue I'm getting from looking at the console is..
preactivate
preactivate
Connection error: Invalid packet from server..
creator/editor/EditorGui.cs (878): Unable to find object: '' attempting to call function 'open'
preactivate
preactivate
alot of 'preactivate' messages...
anyway here is the code I'm using in its entirety
//--------------scripted particle emmiting shapes--------------------------//
function mountedFissureImage::shootParticles(%this, %obj, %slot)
{
echo("preactivate");
%obj.setImageTrigger(1,false);
%projectile = %this.projectile;
%muzzleVector = %obj.getMuzzleVector(%slot);
%objectVelocity = %obj.getVelocity();
%muzzleVelocity = VectorAdd(
VectorScale(%muzzleVector, %projectile.muzzleVelocity),
VectorScale(%objectVelocity, %projectile.velInheritFactor));
%p = new (%this.projectileType)() {
dataBlock = %projectile;
initialVelocity = %muzzleVelocity;
initialPosition = %obj.getMuzzlePoint(%slot);
sourceObject = %obj;
sourceSlot = %slot;
client = %obj.client;
};
MissionCleanup.add(%p);
return %p;
}
datablock StaticShapeData(HGFissureStaticShape)
{
category = "Misc";
className = "Fissure";
shapeFile = "~/data/shapes/HG/HG-Fissure2.dts";
maxInv[mountedImage] = 10;
maxInv[mountedImageAmmo] = 50;
};
function Fissure::onAdd(%this,%obj)
{
%obj.mountImage(mountedFissureImage,1);
}
function Fissure::onRemove(%this, %obj)
{
%obj.unmountImage(1);
}
function Fissure::onNewDataBlock(%this,%obj)
{
}
datablock ParticleData(fissureParticle)
{
textureName = "~/data/shapes/particles/fifi";
dragCoefficient = 0.0;
gravityCoefficient = -0.3; // rises slowly
inheritedVelFactor = 0.00;
lifetimeMS = 750;
lifetimeVarianceMS = 250;
useInvAlpha = false;
spinRandomMin = -30.0;
spinRandomMax = 30.0;
colors[0] = "0.8 0.6 0.0 0.1";
colors[1] = "0.8 0.6 0.0 0.1";
colors[2] = "0.0 0.0 0.0 0.0";
sizes[0] = 1.0;
sizes[1] = 1.0;
sizes[2] = 5.0;
times[0] = 0.0;
times[1] = 0.5;
times[2] = 1.0;
};
datablock ParticleEmitterData(fissureEmitter)
{
ejectionPeriodMS = 50;
periodVarianceMS = 0;
ejectionVelocity = 0.0;
velocityVariance = 0.0;
thetaMin = 0.0;
thetaMax = 90.0;
particles = fissureParticle;
};
//------continued next------------//
Ok, no need to be secretive of this code I'm using a big of a variation of the mounted particle effects resource, here www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=8156 just changed to automaticly mount the emmiter upon creation. It would be a nice addition to that resource except for the fact that its causing the missions to crash
the problem I'm having, is that as soon as I add the shape the mission editor crashes, or if i have one in a mission and load it, as soon as I open the mission editor it crashes back to the main menu with that message saying you've been disconnected you may not have the propper art/etc
the only clue I'm getting from looking at the console is..
preactivate
preactivate
Connection error: Invalid packet from server..
creator/editor/EditorGui.cs (878): Unable to find object: '' attempting to call function 'open'
preactivate
preactivate
alot of 'preactivate' messages...
anyway here is the code I'm using in its entirety
//--------------scripted particle emmiting shapes--------------------------//
function mountedFissureImage::shootParticles(%this, %obj, %slot)
{
echo("preactivate");
%obj.setImageTrigger(1,false);
%projectile = %this.projectile;
%muzzleVector = %obj.getMuzzleVector(%slot);
%objectVelocity = %obj.getVelocity();
%muzzleVelocity = VectorAdd(
VectorScale(%muzzleVector, %projectile.muzzleVelocity),
VectorScale(%objectVelocity, %projectile.velInheritFactor));
%p = new (%this.projectileType)() {
dataBlock = %projectile;
initialVelocity = %muzzleVelocity;
initialPosition = %obj.getMuzzlePoint(%slot);
sourceObject = %obj;
sourceSlot = %slot;
client = %obj.client;
};
MissionCleanup.add(%p);
return %p;
}
datablock StaticShapeData(HGFissureStaticShape)
{
category = "Misc";
className = "Fissure";
shapeFile = "~/data/shapes/HG/HG-Fissure2.dts";
maxInv[mountedImage] = 10;
maxInv[mountedImageAmmo] = 50;
};
function Fissure::onAdd(%this,%obj)
{
%obj.mountImage(mountedFissureImage,1);
}
function Fissure::onRemove(%this, %obj)
{
%obj.unmountImage(1);
}
function Fissure::onNewDataBlock(%this,%obj)
{
}
datablock ParticleData(fissureParticle)
{
textureName = "~/data/shapes/particles/fifi";
dragCoefficient = 0.0;
gravityCoefficient = -0.3; // rises slowly
inheritedVelFactor = 0.00;
lifetimeMS = 750;
lifetimeVarianceMS = 250;
useInvAlpha = false;
spinRandomMin = -30.0;
spinRandomMax = 30.0;
colors[0] = "0.8 0.6 0.0 0.1";
colors[1] = "0.8 0.6 0.0 0.1";
colors[2] = "0.0 0.0 0.0 0.0";
sizes[0] = 1.0;
sizes[1] = 1.0;
sizes[2] = 5.0;
times[0] = 0.0;
times[1] = 0.5;
times[2] = 1.0;
};
datablock ParticleEmitterData(fissureEmitter)
{
ejectionPeriodMS = 50;
periodVarianceMS = 0;
ejectionVelocity = 0.0;
velocityVariance = 0.0;
thetaMin = 0.0;
thetaMax = 90.0;
particles = fissureParticle;
};
//------continued next------------//
#22
Your examples were cool too, they showed good examples of your concept.
05/26/2007 (7:06 pm)
Caylo, those particle effect trix you sent me are kicking butt. Now my 'fissures' not only have fire spewing from them when the mission loads, but it hurts you if you try to walk through it. X) Your examples were cool too, they showed good examples of your concept.
#23
05/27/2007 (3:12 am)
Thank you. Its nice to know they are useful.
#24
05/27/2007 (11:39 pm)
Hey Caylo, can I get those tricks? Do you have 'em posted somewhere?
Torque 3D Owner Jeff Loveless
//-----------------------------------------------------------------------------
//Scripted Fissure with particle emmiter
//-----------------------------------------------------------------------------
datablock StaticShapeData(HGFissureStaticShape)
{
category = "Misc";
className = "hgFissure";
shapeFile = "~/data/shapes/HG/HgFissure2.dts";
};
datablock ParticleData(fissureParticle)
{
textureName = "~/data/shapes/particles/fifi";
dragCoefficient = 0.0;
gravityCoefficient = -0.3; // rises slowly
inheritedVelFactor = 0.00;
lifetimeMS = 1000;
lifetimeVarianceMS = 50;
useInvAlpha = false;
spinRandomMin = -30.0;
spinRandomMax = 30.0;
colors[0] = "0.8 0.6 0 0.1";
colors[1] = "0.8 0.6 0 0.1";
colors[2] = "0 0 0 0";
sizes[0] = 1.0;
sizes[1] = 1.0;
sizes[2] = 5.0;
times[0] = 0.0;
times[1] = 0.5;
times[2] = 1.0;
};
datablock ParticleEmitterData(fissureEmitter)
{
ejectionPeriodMS = 80;
periodVarianceMS = 0;
ejectionVelocity = 0.0;
velocityVariance = 0.0;
thetaMin = 0.0;
thetaMax = 90.0;
particles = fissureParticle;
};
datablock ParticleEmitterNodeData(fissureEmitterNode)
{
timeMultiple = 5;
};
function hgFissure::onAdd(%this,%obj)
{
CueFissureEffect(%obj.getTransform());
}
function hgFissure::onRemove(%this, %obj)
{
}
function hgFissure::onNewDataBlock(%this,%obj)
{
}
function CueFissureEffect(%pos){
%obj = new ParticleEmitterNode()
{
position = %pos;
rotation = "0 0 1 100";
scale = "1 1 1";
dataBlock = "fissureEmitterNode"; //fissureEmitterNode?
emitter = "fissureEmitter";
velocity = "1";
};
}