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

Method isObjectVisible

ogsr_engine/xrGame/CarInput.cpp:279–311  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

277#include "visual_memory_manager.h"
278
279bool CCar::isObjectVisible(CScriptGameObject* O_)
280{
281 if (m_memory)
282 {
283 return m_memory->visual().visible_now(&O_->object());
284 }
285 else
286 {
287 if (!O_)
288 {
289 Msg("Attempt to call CCar::isObjectVisible method wihth passed NULL parameter");
290 return false;
291 }
292 CObject* O = &O_->object();
293 Fvector dir_to_object;
294 Fvector to_point;
295 O->Center(to_point);
296
297 Fvector from_point;
298 Center(from_point);
299
300 if (HasWeapon())
301 {
302 from_point.y = XFORM().c.y + m_car_weapon->_height();
303 }
304
305 dir_to_object.sub(to_point, from_point).normalize_safe();
306 float ray_length = from_point.distance_to(to_point);
307
308 BOOL res = Level().ObjectSpace.RayTest(from_point, dir_to_object, ray_length, collide::rqtStatic, NULL, NULL);
309 return (0 == res);
310 }
311}
312
313bool CCar::HasWeapon() { return (m_car_weapon != NULL); }
314

Callers

nothing calls this directly

Calls 11

MsgFunction · 0.85
XFORMFunction · 0.85
visible_nowMethod · 0.80
_heightMethod · 0.80
RayTestMethod · 0.80
visualMethod · 0.45
objectMethod · 0.45
CenterMethod · 0.45
normalize_safeMethod · 0.45
subMethod · 0.45
distance_toMethod · 0.45

Tested by

no test coverage detected