T3D 1.2 - Turret uses Item's box-only collision; Code to use normal collision meshes
by Henry Todd · in Torque 3D Professional · 06/15/2012 (4:43 pm) · 0 replies
I'm not specifically calling this a bug since I don't know what the intended level of functionality for TurretShape is, but if you want to use Turrets beyond the deployable example you might want them to use full collision meshes. They're based on Item which uses a very simple bounding box only collision system.
To get them to use the collision meshes from their shapeFile like most other objects,
in T3D/turret/turretShape.h, add these function declarations to class TurretShape:
This doesn't seem to have any effect on the collision that TurretShape uses when it's moving (ie when you throw the example AITurretShape) only when other objects collide against it. So you can increase the complexity of the collision mesh for your turrets without impact performance when they're moving as Item-like dynamic objects.
To get them to use the collision meshes from their shapeFile like most other objects,
in T3D/turret/turretShape.h, add these function declarations to class TurretShape:
bool buildPolyList(PolyListContext context, AbstractPolyList* polyList, const Box3F &, const SphereF &); void buildConvex(const Box3F& box, Convex* convex);then in T3D/turret/turretShape.cpp, add these wherever you like:
bool TurretShape::buildPolyList(PolyListContext context, AbstractPolyList* polyList, const Box3F& box, const SphereF& sphere)
{
return ShapeBase::buildPolyList(context, polyList,box,sphere);
}
void TurretShape::buildConvex(const Box3F& box, Convex* convex)
{
ShapeBase::buildConvex(box, convex);
}This doesn't seem to have any effect on the collision that TurretShape uses when it's moving (ie when you throw the example AITurretShape) only when other objects collide against it. So you can increase the complexity of the collision mesh for your turrets without impact performance when they're moving as Item-like dynamic objects.
About the author