コード例 #1
0
        /// <summary>
        /// Called when [motion].
        /// </summary>
        /// <param name="rbo">The rbo.</param>
        /// <param name="step">The step.</param>
        public void OnMotion(AppCode.Physics.MyRigidBody rbo, float step)
        {
            Debug.Assert(this.Entity.Physics == this, "Fatal resorce inconsistancy! Now is time to implement real engine resource management.");

            if (this.NoResponse)
            {
                return;
            }

            this.Entity.SetWorldMatrix(this.rigidBody.Matrix, this);
        }
コード例 #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MyPhysicsBody"/> class.
        /// </summary>
        /// <param name="entity">The entity.</param>
        public MyPhysicsBody(MyEntity entity, float mass, RigidBodyFlag flags)
        {
            Debug.Assert(entity != null);

            this.m_enabled = false;
            this.Entity    = entity;

            MyPhysicsObjects physobj = AppCode.Physics.MyPhysics.physicsSystem.GetPhysicsObjects();
            MyRigidBodyDesc  rboDesc = physobj.GetRigidBodyDesc();

            rboDesc.SetToDefault();
            rboDesc.m_Mass   = mass;
            rboDesc.m_Matrix = entity.WorldMatrix;
            rboDesc.m_Flags |= flags;

            this.rigidBody            = physobj.CreateRigidBody(rboDesc);
            this.rigidBody.m_UserData = this;
        }
コード例 #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MyPhysicsBody"/> class.
        /// </summary>
        /// <param name="entity">The entity.</param>
        public MyPhysicsBody(MyEntity entity, float mass, RigidBodyFlag flags)
        {
            Debug.Assert(entity != null);

            this.m_enabled = false;
            this.Entity = entity;

            MyPhysicsObjects physobj = AppCode.Physics.MyPhysics.physicsSystem.GetPhysicsObjects();
            MyRigidBodyDesc rboDesc = physobj.GetRigidBodyDesc();

            rboDesc.SetToDefault();
            rboDesc.m_Mass = mass;
            rboDesc.m_Matrix = entity.WorldMatrix;
            rboDesc.m_Flags |= flags;

            this.rigidBody = physobj.CreateRigidBody(rboDesc);
            this.rigidBody.m_UserData = this;
        }