AnchorPlacement
function · terrain · primitive
- Address
0x698110· 593 bytes, up to0x698360- Signature
void __fastcall (void *entity, float *position, float facing)- Meaning
- Rotates an entity's centred model box and snaps its x and y to the cell grid
- Confidence
- verified, proof one
- Finding
- terrain/doodads#placement-anchor-snap
- Test
terrain::ground_anchor_difftest
Finding: Placement anchor snap in terrain: doodad defs
0x698110(entity, position, facing) moves a position in x and y so that the turned box's maximum corner sits on a grid line of 4.1666665-unit cells. It takes the entity's box (a map object def's root box, else the model's bounding box), centres it on its own middle, turns it about z by the facing and adds the turned box's maximum corner m to the position, giving v. For x and y it takes n = round((v + 4.1666665)·0.24 − 0.5) and stores position − (v − n·4.1666665). z is unchanged.
The derivation is in the doc.
Callers 2
- CWorld::CreateMapEntity terrain
- CWorld::SetEntityTransform terrain
Callees 6
- SplatVector3 loadingscreen
- SetVector3 spline
- CMapObj::GetBoundingBox models
- TransformBox unassigned
- CM2Model::GetBoundingBox models
- RotateMatrix cmath
Calls and jumps by a bare address, from tables/calls.tsv.