mirror of
https://github.com/brues-code/ClassicAPI.git
synced 2026-11-16 16:10:36 +00:00
Three ClassicAPI extensions on the actor: - GetAttachmentPosition(attachmentID) calls the engine's CM2Model::GetAttachmentPosition (0x00712D50). It takes the attachment's offset through its bone matrix and then through the scene matrix (+0xDC, the inverse of the view the bones were built under). The result is in the space of the root's base matrix, which is the space of SetPosition. The engine does not check the id, and a missing id (lookup 0xFFFF) reads past the attachment table. So the method checks HasAttachment (0x00712CB0) first. It also needs every model in the parent chain to be loaded, because the call waits for the file and animates the parents first (EnsureAnimated, 0x00714000). - AttachToActor(parent, attachmentID) hangs the actor on any attachment through CM2Model::Attach (0x00712F70). It works like AttachToMount without the seat animation. An id that the parent does not have hangs the child at the parent's origin, which is the unresolved-index path of EnsureAnimated. - DetachFromActor() takes the actor off its parent (CM2Model::Detach, 0x00713020). EnsureAnimated recurses through the parent chain, so an attach cycle never ends. M2::CanAttach now refuses a cycle for both AttachToActor and AttachToMount. HasAttachment moves into M2.h, and VisualKit uses it.