Ejemplo n.º 1
0
        private void StopStabilizingTargetedObject()
        {
            if (m_distanceJointObject != null)
            {
                m_distanceJointObject.Remove();
                m_distanceJoint.Remove();
                m_targetedObjectJoint.Remove();
            }

            var player = ScriptHelper.CastPlayer(TargetedObject);

            if (player != null)
            {
                player.AddCommand(new PlayerCommand(PlayerCommandType.StopStagger));
                player.SetInputEnabled(true);
            }

            m_pullJoint.SetTargetObject(null);

            if (TargetedObject != null)
            {
                if (Owner.IsBot)
                {
                    TargetedObject.SetCollisionFilter(m_oldCollisionFilter);
                }
                if (TargetedObject.GetCollisionFilter().CategoryBits == CategoryBits.DynamicG2)
                {
                    TargetedObject.TrackAsMissile(true); // must be called after updating CollisionFilter
                }
                TargetedObject.SetMass(m_oldMass);
                TargetedObject = null;
            }
            IsTargetedObjectStabilized = false;
        }
Ejemplo n.º 2
0
        private IObjectPullJoint CreatePullJointObject()
        {
            var pullJoint = (IObjectPullJoint)Game.CreateObject("PullJoint");

            if (TargetedObject != null)
            {
                TargetedObject.SetMass(.004f);
                pullJoint.SetWorldPosition(TargetedObject.GetWorldPosition());
                pullJoint.SetForce(ScriptHelper.IsPlayer(TargetedObject) ? 15 : 4); // IPlayer doesn't have mass, maybe a bit heavier than normal
                pullJoint.SetForcePerDistance(0);
            }

            pullJoint.SetTargetObject(TargetedObject);
            pullJoint.SetTargetObjectJoint(m_magnetJoint);

            return(pullJoint);
        }