Ejemplo n.º 1
0
        void Init(libTechCollisionShape Shape, float Mass = 10)
        {
            bool IsDynamic = Mass != 0;

            Vector3 LocalInertia = Vector3.Zero;

            if (IsDynamic)
            {
                Shape.CollisionShape.CalculateLocalInertia(Mass, out LocalInertia);
            }

            DefaultMotionState MotionState = new DefaultMotionState(Matrix4x4.Identity);
            RigidBody          Body        = null;

            using (RigidBodyConstructionInfo RBInfo = new RigidBodyConstructionInfo(Mass, MotionState, Shape.CollisionShape, LocalInertia))
                Body = new RigidBody(RBInfo);

            RigidBody            = Body;
            RigidBody.UserObject = this;

            IsStatic = Mass == 0;
        }
Ejemplo n.º 2
0
 public EntPhysics(libTechCollisionShape Shape, float Mass = 10)
 {
     Init(Shape, Mass);
 }