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

Method Collide

Engine/lib/opcode/OPC_LSSCollider.cpp:89–145  ·  view source on GitHub ↗

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// * Generic collision query for generic OPCODE models. After the call, access the results: * - with GetContactStatus() * - with GetNbTouchedPrimitives() * - with GetTouchedPrimitives() * * \param cache

Source from the content-addressed store, hash-verified

87 */
88///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
89bool LSSCollider::Collide(LSSCache& cache, const LSS& lss, const Model& model, const Matrix4x4* worldl, const Matrix4x4* worldm)
90{
91 // Checkings
92 if(!Setup(&model)) return false;
93
94 // Init collision query
95 if(InitQuery(cache, lss, worldl, worldm)) return true;
96
97 if(!model.HasLeafNodes())
98 {
99 if(model.IsQuantized())
100 {
101 const AABBQuantizedNoLeafTree* Tree = (const AABBQuantizedNoLeafTree*)model.GetTree();
102
103 // Setup dequantization coeffs
104 mCenterCoeff = Tree->mCenterCoeff;
105 mExtentsCoeff = Tree->mExtentsCoeff;
106
107 // Perform collision query
108 if(SkipPrimitiveTests()) _CollideNoPrimitiveTest(Tree->GetNodes());
109 else _Collide(Tree->GetNodes());
110 }
111 else
112 {
113 const AABBNoLeafTree* Tree = (const AABBNoLeafTree*)model.GetTree();
114
115 // Perform collision query
116 if(SkipPrimitiveTests()) _CollideNoPrimitiveTest(Tree->GetNodes());
117 else _Collide(Tree->GetNodes());
118 }
119 }
120 else
121 {
122 if(model.IsQuantized())
123 {
124 const AABBQuantizedTree* Tree = (const AABBQuantizedTree*)model.GetTree();
125
126 // Setup dequantization coeffs
127 mCenterCoeff = Tree->mCenterCoeff;
128 mExtentsCoeff = Tree->mExtentsCoeff;
129
130 // Perform collision query
131 if(SkipPrimitiveTests()) _CollideNoPrimitiveTest(Tree->GetNodes());
132 else _Collide(Tree->GetNodes());
133 }
134 else
135 {
136 const AABBCollisionTree* Tree = (const AABBCollisionTree*)model.GetTree();
137
138 // Perform collision query
139 if(SkipPrimitiveTests()) _CollideNoPrimitiveTest(Tree->GetNodes());
140 else _Collide(Tree->GetNodes());
141 }
142 }
143
144 return true;
145}
146

Callers

nothing calls this directly

Calls 9

SkipPrimitiveTestsFunction · 0.85
FirstContactEnabledFunction · 0.85
TemporalCoherenceEnabledFunction · 0.85
GetContactStatusFunction · 0.85
GetNbTrianglesMethod · 0.80
GetTriangleIndexMethod · 0.80
SetupFunction · 0.70
InitQueryFunction · 0.70
ResetMethod · 0.45

Tested by

no test coverage detected