MCPcopy Create free account
hub / github.com/OGSR/OGSR-Engine / ObjectContactCallback

Method ObjectContactCallback

ogsr_engine/xrGame/CustomRocket.cpp:178–277  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

176//////////////////////////////////////////////////////////////////////////
177
178void CCustomRocket::ObjectContactCallback(bool& do_colide, bool bo1, dContact& c, SGameMtl* material_1, SGameMtl* material_2)
179{
180 do_colide = false;
181
182 dxGeomUserData* l_pUD1 = retrieveGeomUserData(c.geom.g1);
183 dxGeomUserData* l_pUD2 = retrieveGeomUserData(c.geom.g2);
184
185 const SGameMtl* material;
186 CCustomRocket* l_this = l_pUD1 ? smart_cast<CCustomRocket*>(l_pUD1->ph_ref_object) : NULL;
187 Fvector vUp;
188 if (!l_this)
189 {
190 l_this = l_pUD2 ? smart_cast<CCustomRocket*>(l_pUD2->ph_ref_object) : NULL;
191 vUp.invert(*(Fvector*)&c.geom.normal);
192
193 // if(dGeomGetClass(c.geom.g1)==dTriListClass)
194 // material=GMLib.GetMaterialByIdx((u16)c.surface.mode);
195 // else
196 // material=GMLib.GetMaterialByIdx(l_pUD2->material);
197 material = material_1;
198 }
199 else
200 {
201 vUp.set(*(Fvector*)&c.geom.normal);
202
203 // if(dGeomGetClass(c.geom.g2)==dTriListClass)
204 // material=GMLib.GetMaterialByIdx((u16)c.surface.mode);
205 // else
206 // material=GMLib.GetMaterialByIdx(l_pUD1->material);
207 material = material_2;
208 }
209 VERIFY(material);
210 if (material->Flags.is(SGameMtl::flPassable))
211 return;
212
213 if (!l_this || l_this->m_contact.contact)
214 return;
215
216 CGameObject* l_pOwner = l_pUD1 ? smart_cast<CGameObject*>(l_pUD1->ph_ref_object) : NULL;
217 if (!l_pOwner || l_pOwner == (CGameObject*)l_this)
218 l_pOwner = l_pUD2 ? smart_cast<CGameObject*>(l_pUD2->ph_ref_object) : NULL;
219
220 if (!l_pOwner || l_pOwner != l_this->m_pOwner)
221 {
222 if (l_this->m_pOwner)
223 {
224 Fvector l_pos;
225 l_pos.set(l_this->Position());
226#ifdef DEBUG
227 bool corrected_pos = false;
228#endif
229 if (!l_pUD1 || !l_pUD2)
230 {
231 dGeomID g = NULL;
232 dxGeomUserData*& l_pUD = l_pUD1 ? l_pUD1 : l_pUD2;
233 if (l_pUD1)
234 g = c.geom.g1;
235 else

Callers

nothing calls this directly

Calls 15

CalculateTriangleFunction · 0.85
DBG_DrawPointFunction · 0.85
isMethod · 0.80
PositionMethod · 0.80
DisableCollisionMethod · 0.80
_validFunction · 0.50
invertMethod · 0.45
setMethod · 0.45
PHGetLinearVellMethod · 0.45
square_magnitudeMethod · 0.45
normalizeMethod · 0.45
dotproductMethod · 0.45

Tested by

no test coverage detected