Game Development Community

[Help] - Raycast not finding rigid shapes

by Nicolai Dutka · in Torque Game Engine Advanced · 10/15/2009 (3:09 pm) · 4 replies

The following code IS finding my static shapes, but won't find rigid shapes....

function rayChecker(){
    %distance = 1.65; // Distance in front of eyePoint
    %start = $player.getEyePoint();
    %vector = $player.getEyeVector();
    %vectorN = VectorNormalize(%vector);
    %vectorS = VectorScale(%vectorN,%distance);
    %end = VectorAdd(%vectorS,%start);
    
    %target = ContainerRayCast(%start,%end,$TypeMasks::StaticShapeObjectType | $TypeMasks::RigidShapeObjectType);

echo("Found this object: " @ %target);
}

moveMap.bindCmd(keyboard,e,"rayChecker();","");

#1
10/15/2009 (3:28 pm)
RigidShapeObjectType does not exist.
#2
10/15/2009 (3:32 pm)
Ok, thanks! So... what would I use?
#3
10/15/2009 (3:33 pm)
VehicleObjectType
#4
10/15/2009 (4:07 pm)
as Picasso mentions for RigidShapes they are implemented as VehicleObjectTypes you can find them out by looking at the C++ source code for a class hunt for the definition of mTypeMask in the constructor function.

For example of RigidShapes:

mTypeMask |= VehicleObjectType;

also all the typemasks are defined in T3D/gameFunctions.cpp so you can see which ones exist there

Con::setIntVariable("$TypeMasks::StaticObjectType",         StaticObjectType);
   Con::setIntVariable("$TypeMasks::EnvironmentObjectType",    EnvironmentObjectType);
   Con::setIntVariable("$TypeMasks::AtlasObjectType",          AtlasObjectType);
   Con::setIntVariable("$TypeMasks::TerrainObjectType",        TerrainObjectType);
   Con::setIntVariable("$TypeMasks::InteriorObjectType",       InteriorObjectType);
   Con::setIntVariable("$TypeMasks::WaterObjectType",          WaterObjectType);
   Con::setIntVariable("$TypeMasks::TriggerObjectType",        TriggerObjectType);
   Con::setIntVariable("$TypeMasks::MarkerObjectType",         MarkerObjectType);
   Con::setIntVariable("$TypeMasks::GameBaseObjectType",       GameBaseObjectType);
   Con::setIntVariable("$TypeMasks::ShapeBaseObjectType",      ShapeBaseObjectType);
   Con::setIntVariable("$TypeMasks::CameraObjectType",         CameraObjectType);
   Con::setIntVariable("$TypeMasks::StaticShapeObjectType",    StaticShapeObjectType);
   Con::setIntVariable("$TypeMasks::PlayerObjectType",         PlayerObjectType);
   Con::setIntVariable("$TypeMasks::ItemObjectType",           ItemObjectType);
   Con::setIntVariable("$TypeMasks::VehicleObjectType",        VehicleObjectType);
   Con::setIntVariable("$TypeMasks::VehicleBlockerObjectType", VehicleBlockerObjectType);
   Con::setIntVariable("$TypeMasks::ProjectileObjectType",     ProjectileObjectType);
   Con::setIntVariable("$TypeMasks::ExplosionObjectType",      ExplosionObjectType);
   Con::setIntVariable("$TypeMasks::CorpseObjectType",         CorpseObjectType);
   Con::setIntVariable("$TypeMasks::DebrisObjectType",         DebrisObjectType);
   Con::setIntVariable("$TypeMasks::PhysicalZoneObjectType",   PhysicalZoneObjectType);
   Con::setIntVariable("$TypeMasks::StaticTSObjectType",       StaticTSObjectType);
   Con::setIntVariable("$TypeMasks::StaticRenderedObjectType", StaticRenderedObjectType);
   Con::setIntVariable("$TypeMasks::DamagableItemObjectType",  DamagableItemObjectType);