Engine Freeze On Impulse
by Eric Soyon · in Torque 3D Beginner · 08/10/2010 (12:43 am) · 7 replies
Hi all,
I am having trouble with a grenade object I am trying to create. It applies an impulse of 2000 to objects in an area. When this impulse is applied to an object such as a weapon or a heath kit the engine freezes. I am using a demo version of Torque 3D I haven't modified much at all. Any ideas?
I am having trouble with a grenade object I am trying to create. It applies an impulse of 2000 to objects in an area. When this impulse is applied to an object such as a weapon or a heath kit the engine freezes. I am using a demo version of Torque 3D I haven't modified much at all. Any ideas?
About the author
#2
08/18/2010 (7:36 pm)
In scripts/server/radiusDamage.cs, change line 49 to thisif (%impulse && %targetObject.getClassName() !$= "Item")This makes items like weapons and health kits not be affected by impulses. Although it makes the game not so realistic, it runs a lot faster and doesn't crash.
#3
08/19/2010 (5:35 am)
Also note that in T3D 1.1 we've changed maxVelocity to default to 25 or so instead of -1 to keep this from occuring by default.
#4
08/19/2010 (4:56 pm)
Quote:It applies an impulse of 2000 to objects in an area.You realize that is an impulse of 2000 meters per second. If the effect you want is to make the items disapear you can probably do that in a better way.
#5
I had reported several times in the past that in ratios of mass to impulse of 1:5 or greater that the Item class had severe lockdown and excessive results regardless as when compared to other object types of similar mass being impulsed. But maybe the unbounded velocity was causing that?
Perhaps it would be a further improvement to factor an objects mass into the equation before applying the impulse in radiusDamage?
08/19/2010 (5:49 pm)
2000 is actually the long-held stock areaImpulse setting for projectiles in Torque history, see the old Crossbow (TGE) or Swarmgun(TGEa) so that is nothing new ;)I had reported several times in the past that in ratios of mass to impulse of 1:5 or greater that the Item class had severe lockdown and excessive results regardless as when compared to other object types of similar mass being impulsed. But maybe the unbounded velocity was causing that?
Perhaps it would be a further improvement to factor an objects mass into the equation before applying the impulse in radiusDamage?
#6
// Apply the impulse
if (%impulse)
{
%impulseVec = VectorSub(%targetObject.getWorldBoxCenter(), %position);
%impulseVec = VectorNormalize(%impulseVec);
if (%targetObject.getClassName() $= "Item")
%impulseVec = VectorScale(%impulseVec, (%targetObject.getDataBlock().mass * 0.01) * %impulse * %distScale);
else
%impulseVec = VectorScale(%impulseVec, %impulse * %distScale);
//%impulseVec = VectorScale(%impulseVec, (640 / %targetObject.getDataBlock().mass));
%targetObject.applyImpulse(%position, %impulseVec);
}
08/22/2010 (3:20 am)
Fixed it by changing radiusDamage to this// Apply the impulse
if (%impulse)
{
%impulseVec = VectorSub(%targetObject.getWorldBoxCenter(), %position);
%impulseVec = VectorNormalize(%impulseVec);
if (%targetObject.getClassName() $= "Item")
%impulseVec = VectorScale(%impulseVec, (%targetObject.getDataBlock().mass * 0.01) * %impulse * %distScale);
else
%impulseVec = VectorScale(%impulseVec, %impulse * %distScale);
//%impulseVec = VectorScale(%impulseVec, (640 / %targetObject.getDataBlock().mass));
%targetObject.applyImpulse(%position, %impulseVec);
}
#7
08/22/2010 (4:05 am)
That works too I guess.
Associate Chris Robertson
datablock ItemData(HealthKitSmall) { category = "Health"; className = "HealthPatch"; shapeFile = "art/shapes/items/kit/healthkit.dts"; maxVelocity = "15.0"; ... };