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

Function CollideIntoGroup

ogsr_engine/xrGame/Physics.cpp:88–274  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

86}
87
88IC static int CollideIntoGroup(dGeomID o1, dGeomID o2, dJointGroupID jointGroup, CPHIsland* world, const int& MAX_CONTACTS)
89{
90 constexpr int RS = 800 + 10;
91 constexpr int N = RS;
92
93 static dContact contacts[RS]{};
94 int collided_contacts = 0;
95 // get the contacts up to a maximum of N contacts
96
97 if (!o1 || !o2)
98 return 0;
99
100 VERIFY(&contacts[0].geom);
101 int n = dCollide(o1, o2, N, &contacts[0].geom, sizeof(dContact));
102
103 if (n > N - 1)
104 n = N - 1;
105
106 int i;
107
108 for (i = 0; i < n; ++i)
109 {
110 dContact& c = contacts[i];
111 dContactGeom& cgeom = c.geom;
112 dSurfaceParameters& surface = c.surface;
113 dGeomID g1 = cgeom.g1;
114 dGeomID g2 = cgeom.g2;
115
116 bool pushing_neg = false;
117 bool do_collide = true;
118
119 dxGeomUserData* usr_data_1 = NULL;
120 dxGeomUserData* usr_data_2 = NULL;
121 u16 material_idx_1 = 0;
122 u16 material_idx_2 = 0;
123
124 surface.mu = 1.f; // 5000.f;
125 surface.soft_erp = 1.f;
126 surface.soft_cfm = 1.f;
127 surface.bounce = 0.01f; // 0.1f;
128 surface.bounce_vel = 1.5f; // 0.005f;
129 usr_data_1 = retrieveGeomUserData(g1);
130 usr_data_2 = retrieveGeomUserData(g2);
131 ///////////////////////////////////////////////////////////////////////////////////////////////////
132 if (usr_data_2)
133 material_idx_2 = usr_data_2->material;
134
135 if (usr_data_1)
136 material_idx_1 = usr_data_1->material;
137
138 bool is_tri_1 = dTriListClass == dGeomGetClass(g1);
139 bool is_tri_2 = dTriListClass == dGeomGetClass(g2);
140
141 if (!is_tri_2 && !is_tri_1)
142 surface.mode = 0;
143
144 if (is_tri_1)
145 material_idx_1 = (u16)surface.mode;

Callers 2

NearCallbackFunction · 0.85
CollideStaticFunction · 0.85

Calls 14

dCollideFunction · 0.85
dGeomGetClassFunction · 0.85
dGeomGetBodyFunction · 0.85
DBG_DrawContactFunction · 0.85
dJointCreateContactFunction · 0.85
dJointAttachFunction · 0.85
IsRayMotionMethod · 0.80
CallMethod · 0.80
ConnectJointMethod · 0.80
maxFunction · 0.50
minFunction · 0.50

Tested by

no test coverage detected