Example #1
0
        public void StartManipulation(MyManipulationTool.MyState state, MyEntity otherEntity, Vector3D hitPosition, ref MatrixD ownerWorldHeadMatrix)
        {
            Debug.Assert(Sync.IsServer);
            if (!Sync.IsServer)
            {
                return;
            }

            StartManipulationMsg msg = new StartManipulationMsg();

            msg.EntityId             = m_entityId;
            msg.ToolState            = state;
            msg.OtherEntity          = otherEntity.EntityId;
            msg.HitPosition          = hitPosition;
            msg.OwnerWorldHeadMatrix = ownerWorldHeadMatrix;

            MyManipulationTool manipulationTool;

            if (MyEntities.TryGetEntityById(msg.EntityId, out manipulationTool))
            {
                bool manipulationStarted = manipulationTool.StartManipulation(state, otherEntity, hitPosition, ref ownerWorldHeadMatrix);
                if (manipulationStarted && manipulationTool.IsHoldingItem)
                {
                    MySession.Static.SyncLayer.SendMessageToAll(ref msg);
                }
            }
        }
        public void StartManipulation(MyManipulationTool.MyState state, MyEntity otherEntity, Vector3D hitPosition, ref MatrixD ownerWorldHeadMatrix)
        {
            StartManipulationMsg msg = new StartManipulationMsg();

            msg.EntityId             = m_entityId;
            msg.ToolState            = state;
            msg.OtherEntity          = otherEntity.EntityId;
            msg.HitPosition          = hitPosition;
            msg.OwnerWorldHeadMatrix = ownerWorldHeadMatrix;

            MySession.Static.SyncLayer.SendMessageToAllAndSelf(ref msg);
        }