| 341 | } |
| 342 | |
| 343 | void collide_camera(CCameraBase& camera, float _viewport_near, CPhysicsShellHolder* l_actor, bool on_ladder) |
| 344 | { |
| 345 | ZoneScoped; |
| 346 | |
| 347 | // CPhysicsShellHolder* l_actor = smart_cast<CPhysicsShellHolder*>( Level().CurrentEntity() ); |
| 348 | VERIFY(l_actor); |
| 349 | update_current_entity_camera_collision(l_actor); |
| 350 | Fvector box_size; |
| 351 | Fmatrix xform; |
| 352 | get_camera_box(box_size, xform, camera, _viewport_near); |
| 353 | CPhysicsShell* shell = actor_camera_shell; |
| 354 | VERIFY(shell); |
| 355 | CPhysicsElement* roote = shell->get_ElementByStoreOrder(0); |
| 356 | VERIFY(roote); |
| 357 | CODEGeom* root_geom = roote->geometry(0); |
| 358 | VERIFY(root_geom); |
| 359 | CBoxGeom* box = smart_cast<CBoxGeom*>(root_geom); |
| 360 | VERIFY(box); |
| 361 | Fvector old_box_size; |
| 362 | Fmatrix old_form; |
| 363 | get_old_camera_box(old_box_size, old_form, roote, box); |
| 364 | if (clamp_change(old_form, xform, EPS, EPS, EPS, EPS) && Fvector().sub(old_box_size, box_size).magnitude() < EPS) |
| 365 | return; |
| 366 | |
| 367 | //static Fvector cam_vDirection = {0.f, 0.f, 0.f}; |
| 368 | //static Fvector cam_vPosition = {0.f, 0.f, 0.f}; |
| 369 | //static Fvector collided_vPosition = camera.vPosition; |
| 370 | //static bool collided = false; |
| 371 | //float cam_diff = Fvector().sub(cam_vPosition, camera.vPosition).magnitude(); |
| 372 | //float cam_ddiff = Fvector().sub(cam_vDirection, camera.vDirection).magnitude(); |
| 373 | //bool cam_moved = !fis_zero(cam_diff, 0.01f) || !fis_zero(cam_ddiff, 0.001f); |
| 374 | //if (collided && !cam_moved) |
| 375 | //{ |
| 376 | // camera.vPosition = collided_vPosition; |
| 377 | // return; |
| 378 | //} |
| 379 | //else if (!cam_moved) |
| 380 | //{ |
| 381 | // return; |
| 382 | //} |
| 383 | //cam_vDirection = camera.vDirection; |
| 384 | //cam_vPosition = camera.vPosition; |
| 385 | //collided = false; |
| 386 | |
| 387 | if (on_ladder) |
| 388 | return; |
| 389 | |
| 390 | set_camera_collision(box_size, xform, roote, box); |
| 391 | |
| 392 | /* |
| 393 | #ifdef DEBUG |
| 394 | if( dbg_draw_camera_collision ) |
| 395 | { |
| 396 | debug_output().DBG_DrawMatrix( Fmatrix().translate( xform.c ), 1 ); |
| 397 | shell->dbg_draw_geometry( 1, D3DCOLOR_XRGB(0, 0, 255 ) ); |
| 398 | } |
| 399 | #endif |
| 400 | */ |
no test coverage detected