CMissile::Aim
function · objectlayer · primitive
- Address
0x61d230· 1255 bytes, up to0x61d716- Meaning
- Sets a missile's destination: the target point, a missed point past it, or the lead on a moving unit
- Confidence
- verified, proof one
- Finding
- objectlayer/missiles#aiming-and-leading
- Test
objectlayer::missile_target_intercept_difftest,objectlayer::missile_target_intercept_special_values_difftest,objectlayer::missile_target_intercept_curved_difftest,objectlayer::missile_target_intercept_curved_special_values_difftest
Finding: Aiming and leading in objectlayer: missiles
0x61d230 sets the destination. The aim point is the target's attachment, or its position raised
by 0.75 of +0x90·+0xbc. A missed missile flies half a second past the aim point, turned by a
random angle up to 3° about the horizontal axis across its path. A missile at a unit leads it: with
v half the target's velocity, capped first at the missile's speed s, and r the aim point
from the missile, it takes the least positive root of (|v|² − s²)t² + 2(v·r)t + |r|² = 0 and
aims at aim + v·t; with no positive root, a negative discriminant or a near-zero quadratic term
it aims at the point itself.
The derivation is in the doc.
Callers 2
- CMissile::Launch objectlayer
- CMissile::Advance objectlayer
Callees 9
- NTempest::CRandom::uint32 random
- SetVector3 spline
- DivideVector3 spline
- Vector3LengthSquared spline
- ClntObjMgrObjectPtr objectlayer
- CMovement::GetVelocity objectlayer
- CM2Model::HasAttachment models
- CM2Model::GetAttachmentPosition models
- BuildAxisRotation cmath
Calls and jumps by a bare address, from tables/calls.tsv.