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

Method Direction

ogsr_engine/xrGame/map_location.cpp:229–268  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

227}
228
229Fvector2 CMapLocation::Direction()
230{
231 if (IsUserDefined() || m_cached.m_updatedFrame == Device.dwFrame)
232 return m_cached.m_Direction;
233
234 Fvector2 res;
235 res.set(0.0f, 0.0f);
236
237 if (Level().CurrentViewEntity() && Level().CurrentViewEntity()->ID() == m_objectID)
238 {
239 res.set(Device.vCameraDirection.x, Device.vCameraDirection.z);
240 }
241 else
242 {
243 CObject* pObject = Level().Objects.net_Find(m_objectID);
244 if (!pObject)
245 res.set(0.0f, 0.0f);
246 else
247 {
248 const Fvector& op = pObject->Direction();
249 res.set(op.x, op.z);
250 }
251 }
252
253 if (m_flags.test(ePosToActor))
254 {
255 CObject* pObject = Level().Objects.net_Find(m_objectID);
256 if (pObject)
257 {
258 Fvector2 dcp, obj_pos;
259 dcp.set(Device.vCameraPosition.x, Device.vCameraPosition.z);
260 obj_pos.set(pObject->Position().x, pObject->Position().z);
261 res.sub(obj_pos, dcp);
262 res.normalize_safe();
263 }
264 }
265
266 m_cached.m_Direction = res;
267 return res;
268}
269
270shared_str CMapLocation::LevelName()
271{

Callers 15

activate_physic_shellMethod · 0.80
UpdateCLMethod · 0.80
get_viewport_geomFunction · 0.80
collide_cameraFunction · 0.80
g_ThrowPointParamsMethod · 0.80
g_fireParamsMethod · 0.80
CanTradeMethod · 0.80
GetCapturePositionMethod · 0.80
can_detectMethod · 0.80
calculate_angleMethod · 0.80
pitch_correctionMethod · 0.80
is_face_targetMethod · 0.80

Calls 5

PositionMethod · 0.80
setMethod · 0.45
testMethod · 0.45
subMethod · 0.45
normalize_safeMethod · 0.45

Tested by

no test coverage detected