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

Function create_camera_shell

ogsr_engine/xrGame/ActorCameraCollision.cpp:144–188  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

142static const float actor_camera_hudge_mass_size = 10000000.f;
143
144CPhysicsShell* create_camera_shell(CPhysicsShellHolder* actor)
145{
146 VERIFY(actor);
147 // CGameObject *actor = smart_cast<CGameObject *>( Level().CurrentEntity() );
148 // VERIFY( Level().CurrentEntity() );
149 CPhysicsShell* shell = P_build_SimpleShell(actor, actor_camera_hudge_mass, true);
150 shell->bCopMode = true;
151 CPhysicsElement* roote = shell->get_ElementByStoreOrder(0);
152 // Fobb obb; obb.m_halfsize.set(0.5f,0.5f,0.5f); obb.m_rotate.identity();obb.m_translate.set(0,0,0);
153 Fcylinder cyl;
154 cyl.m_center.set(0, -0.6f, 0);
155 cyl.m_direction.set(0, 1, 0);
156 cyl.m_height = 1.6f;
157 cyl.m_radius = 0.5f;
158 // roote->add_Box(obb);
159 CODEGeom* character_test_geom = smart_cast<CODEGeom*>(xr_new<CCylinderGeom>(cyl));
160 character_test_geom->build(Fvector().set(0, 0, 0)); // roote->mass_Center()
161 VERIFY(smart_cast<CPHElement*>(roote));
162 CPHElement* eeroot = static_cast<CPHElement*>(roote);
163
164 character_test_geom->set_body(eeroot->get_body());
165 //character_test_geom->set_ref_object(smart_cast<CPhysicsShellHolder*>(actor));
166 character_test_geom->set_ref_object(actor);
167 CPHGeometryBits::set_ignore_static(*character_test_geom);
168 roote->add_geom(character_test_geom);
169 VERIFY(shell);
170 shell->set_ApplyByGravity(false);
171 shell->set_ObjectContactCallback(cammera_shell_collide_callback);
172 character_test_geom->set_obj_contact_cb(cammera_shell_character_collide_callback);
173 shell->set_ContactCallback(nullptr);
174 shell->set_CallbackData(smart_cast<CPHObject*>(shell));
175 dMass m;
176 dMassSetSphere(&m, 1, actor_camera_hudge_mass_size);
177 dMassAdjust(&m, actor_camera_hudge_mass);
178 shell->setEquelInertiaForEls(m);
179 VERIFY(roote);
180 roote->set_local_mass_center(Fvector().set(0, 0, 0));
181 VERIFY(roote->numberOfGeoms());
182 CODEGeom* root_geom = roote->geometry(0);
183 VERIFY(root_geom);
184 root_geom->set_local_form_bt(Fidentity);
185 shell->DisableCollision();
186 shell->Disable();
187 return shell;
188}
189
190const u16 cam_correction_steps_num = 10;
191

Calls 15

P_build_SimpleShellFunction · 0.85
dMassSetSphereFunction · 0.85
dMassAdjustFunction · 0.85
set_ref_objectMethod · 0.80
set_obj_contact_cbMethod · 0.80
setEquelInertiaForElsMethod · 0.80
set_local_mass_centerMethod · 0.80
set_local_form_btMethod · 0.80
DisableCollisionMethod · 0.80
setMethod · 0.45
buildMethod · 0.45

Tested by

no test coverage detected