Projectiles not colliding with StaticShapes
by Gibby · in Torque 3D Professional · 01/28/2014 (5:00 pm) · 8 replies
Greets all:
I recently discovered this issue after scripting some StaticShapes. When I shoot at the shape with the Lurker or any other weapon, the projectile goes through the shape without colliding with it. As a test, I placed the same model next to it as TSSStatic and the projectiles collide with it correctly, so I'm sure it's not the model.
Here's the datablocks:
Shape:
Mission:
I seem to have this issue with any other models I use as a StaticShape.
Stumped on this one, any ideas?
I recently discovered this issue after scripting some StaticShapes. When I shoot at the shape with the Lurker or any other weapon, the projectile goes through the shape without colliding with it. As a test, I placed the same model next to it as TSSStatic and the projectiles collide with it correctly, so I'm sure it's not the model.
Here's the datablocks:
Shape:
datablock StaticShapeData( alienEggPlant )
{
class = "alienEgg";
category = "StaticShape";
shapeFile = "art/shapes/flora/StrangeFlower/StrangeFlower.dts";
maxDamage = 100;
glowSkin = "StrangeFlower_TEXT_EFX";
glow = 0;
};Mission:
new StaticShape() {
isAIControlled = "0";
dataBlock = "alienEggPlant";
position = "-15.756 71.9687 260.282";
rotation = "1 0 0 0";
scale = "1 1 1";
canSave = "1";
canSaveDynamicFields = "1";
};
new TSStatic() {
shapeName = "art/shapes/flora/StrangeFlower/StrangeFlower.dts";
playAmbient = "1";
meshCulling = "0";
originSort = "0";
collisionType = "Collision Mesh";
decalType = "Collision Mesh";
allowPlayerStep = "1";
renderNormals = "0";
forceDetail = "-1";
position = "-49.7571 56.5805 258.912";
rotation = "1 0 0 0";
scale = "1 1 1";
canSave = "1";
canSaveDynamicFields = "1";
};I seem to have this issue with any other models I use as a StaticShape.
Stumped on this one, any ideas?
#2
I am not seeing anything wrong with the scripts. Are you certain there is a proper collision mesh associated with the model? Try selecting 'visible mesh' as the collision type and see if that works. If it does, then I am betting there is a problem with the collision mesh or the detail stack in the model.
Ron
01/29/2014 (2:56 am)
Gibby, I am not seeing anything wrong with the scripts. Are you certain there is a proper collision mesh associated with the model? Try selecting 'visible mesh' as the collision type and see if that works. If it does, then I am betting there is a problem with the collision mesh or the detail stack in the model.
Ron
#3
Nope, no physX
@Ron:
I'm certain the collision is correct. I can't walk through the model with a player but bullets go straight through. As a control experiment, I imported it into TGE and it works fine, projectiles collide with it. I found this same issue with stock 1.2 as well as 3.5 MIT...
FWIW they were rigged with DoIT!, and have correct Torque Bounds/collision... collision works on the TSStatic just fine, whether in collision mesh or visible mesh. I wasn't aware you could have the collision/visible option on a StaticShape. What mystifies me is that they work fine as TSStatics but not StaticShape.
01/29/2014 (6:12 am)
@AF:Nope, no physX
@Ron:
I'm certain the collision is correct. I can't walk through the model with a player but bullets go straight through. As a control experiment, I imported it into TGE and it works fine, projectiles collide with it. I found this same issue with stock 1.2 as well as 3.5 MIT...
FWIW they were rigged with DoIT!, and have correct Torque Bounds/collision... collision works on the TSStatic just fine, whether in collision mesh or visible mesh. I wasn't aware you could have the collision/visible option on a StaticShape. What mystifies me is that they work fine as TSStatics but not StaticShape.
#4
01/29/2014 (9:29 am)
In one of the projectile source files there is a list of what they can collide with. I don't think I saw staticshapes on that list, so you may have to add them in.
#5
then in projectile.h
..so it seems it should collide with a StaticShape.
01/29/2014 (10:04 am)
@alphaslime: That's what I looked into as well, but in projectile.cppIMPLEMENT_CALLBACK( ProjectileData, onCollision, void, ( Projectile* proj, SceneObject* col, F32 fade, Point3F pos, Point3F normal ),
( proj, col, fade, pos, normal ),
"@brief Called when a projectile collides with another object.\n\n"
"This function is only called on server objects."
"@param proj The projectile colliding with SceneObject col.\n"
"@param col The SceneObject hit by the projectile.\n"
"@param fade The current fadeValue of the projectile, affects its visibility.\n"
"@param pos The position of the collision.\n"
"@param normal The normal of the collision.\n"
"@see Projectile\n"
);
const U32 Projectile::csmStaticCollisionMask = TerrainObjectType | StaticShapeObjectType;
const U32 Projectile::csmDynamicCollisionMask = PlayerObjectType | VehicleObjectType;
const U32 Projectile::csmDamageableMask = Projectile::csmDynamicCollisionMask;
U32 Projectile::smProjectileWarpTicks = 5;then in projectile.h
protected: static const U32 csmStaticCollisionMask; static const U32 csmDynamicCollisionMask; static const U32 csmDamageableMask; static U32 smProjectileWarpTicks;
..so it seems it should collide with a StaticShape.
#6
01/30/2014 (8:43 am)
After further research, I found that if I open the shape in the shape editor, strip off the collision mesh and generate a new one in the TSShapeConstructor, bullets collide with it. Problem is the shape editor will only allow me to implement a big square box for a collision shape, which looks incredibly stupid when a decal sticks to it. I still don't understand why the models' inherent collision can work for everything else but projectiles...
#7
Obj hierarchy: http://take.ms/E9UiC
07/02/2014 (6:33 am)
I have the same situation as Gobby has described in previos post.Obj hierarchy: http://take.ms/E9UiC
#8
Your MAX setup looks correct. Unfortunately I still haven't found a cure for this issue...
07/02/2014 (7:27 am)
Sergii:Your MAX setup looks correct. Unfortunately I still haven't found a cure for this issue...
Torque Owner A F
Default Studio Name
StaticShape objects will not be added to the list of collectible objects if so.