MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / collideBox

Method collideBox

Engine/source/scene/sceneContainer.cpp:1136–1165  ·  view source on GitHub ↗

collide with the objects projected object box

Source from the content-addressed store, hash-verified

1134
1135// collide with the objects projected object box
1136bool SceneContainer::collideBox(const Point3F &start, const Point3F &end, U32 mask, RayInfo * info)
1137{
1138 AssertFatal( info->userData == NULL, "SceneContainer::collideBox - RayInfo->userData cannot be used here!" );
1139
1140 F32 currentT = 2;
1141 for (Link* itr = mStart.mNext; itr != &mEnd; itr = itr->mNext)
1142 {
1143 SceneObject* ptr = static_cast<SceneObject*>(itr);
1144 if (ptr->getTypeMask() & mask && !ptr->mCollisionCount)
1145 {
1146 Point3F xformedStart, xformedEnd;
1147 ptr->mWorldToObj.mulP(start, &xformedStart);
1148 ptr->mWorldToObj.mulP(end, &xformedEnd);
1149 xformedStart.convolveInverse(ptr->mObjScale);
1150 xformedEnd.convolveInverse(ptr->mObjScale);
1151
1152 RayInfo ri;
1153 if(ptr->collideBox(xformedStart, xformedEnd, &ri))
1154 {
1155 if(ri.t < currentT)
1156 {
1157 *info = ri;
1158 info->point.interpolate(start, end, info->t);
1159 currentT = ri.t;
1160 }
1161 }
1162 }
1163 }
1164 return currentT != 2;
1165}
1166
1167//-----------------------------------------------------------------------------
1168

Callers

nothing calls this directly

Calls 4

getTypeMaskMethod · 0.80
mulPMethod · 0.80
convolveInverseMethod · 0.45
interpolateMethod · 0.45

Tested by

no test coverage detected