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

Method SetTarget

ogsr_engine/xrGame/searchlight.cpp:205–221  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

203}
204
205void CProjector::SetTarget(const Fvector& target_pos)
206{
207 float th, tp;
208 Fvector().sub(target_pos, Position()).getHP(th, tp);
209
210 float delta_h;
211 delta_h = angle_difference(th, _start.yaw);
212
213 if (angle_normalize_signed(th - _start.yaw) > 0)
214 delta_h = -delta_h;
215 clamp(delta_h, -PI_DIV_2, PI_DIV_2);
216
217 _target.yaw = angle_normalize(_start.yaw + delta_h);
218
219 clamp(tp, -PI_DIV_2, PI_DIV_2);
220 _target.pitch = tp;
221}
222
223Fvector CProjector::GetCurrentDirection() { return (Fvector().setHP(_current.yaw, _current.pitch)); }
224

Callers

nothing calls this directly

Calls 6

angle_differenceFunction · 0.85
angle_normalize_signedFunction · 0.85
clampFunction · 0.85
angle_normalizeFunction · 0.85
getHPMethod · 0.80
subMethod · 0.45

Tested by

no test coverage detected