| 244 | |
| 245 | bool CWeaponMounted::Use(const Fvector& pos, const Fvector& dir, const Fvector& foot_pos) { return !Owner(); } |
| 246 | bool CWeaponMounted::attach_Actor(CGameObject* actor) |
| 247 | { |
| 248 | m_dAngle.set(0.0f, 0.0f); |
| 249 | CHolderCustom::attach_Actor(actor); |
| 250 | IKinematics* K = smart_cast<IKinematics*>(Visual()); |
| 251 | // убрать оружие из рук |
| 252 | // disable shell callback |
| 253 | m_pPhysicsShell->EnabledCallbacks(FALSE); |
| 254 | // enable actor rotate callback |
| 255 | CBoneInstance& biX = smart_cast<IKinematics*>(Visual())->LL_GetBoneInstance(rotate_x_bone); |
| 256 | biX.set_callback(bctCustom, BoneCallbackX, this); |
| 257 | CBoneInstance& biY = smart_cast<IKinematics*>(Visual())->LL_GetBoneInstance(rotate_y_bone); |
| 258 | biY.set_callback(bctCustom, BoneCallbackY, this); |
| 259 | // set actor to mounted position |
| 260 | const Fmatrix& A = K->LL_GetTransform(actor_bone); |
| 261 | Fvector ap; |
| 262 | XFORM().transform_tiny(ap, A.c); |
| 263 | Fmatrix AP; |
| 264 | AP.translate(ap); |
| 265 | if (OwnerActor()) |
| 266 | OwnerActor()->SetPhPosition(AP); |
| 267 | processing_activate(); |
| 268 | return true; |
| 269 | } |
| 270 | void CWeaponMounted::detach_Actor() |
| 271 | { |
| 272 | CHolderCustom::detach_Actor(); |
nothing calls this directly
no test coverage detected