public PhysxPhysicObject(Scene scene, Geometry geometry, float mass, Matrix localTransformation, Matrix worldTransformation, Vector3 scale, MaterialDescription MaterialDescription)
 {            
     Scale = scale;
     rigidActor = scene.Physics.CreateRigidDynamic(worldTransformation.AsPhysX());            
     material = scene.Physics.CreateMaterial(MaterialDescription.StaticFriction, MaterialDescription.DynamicFriction, MaterialDescription.Bounciness);            
     var boxShape = rigidActor.CreateShape(geometry, material, localTransformation.AsPhysX());                                                
     rigidActor.SetMassAndUpdateInertia(mass);                        
 }
        public PhysxPhysicObject(Scene scene, Geometry geometry, float mass, Matrix localTransformation, Matrix worldTransformation, Vector3 scale, MaterialDescription MaterialDescription)
        {
            Scale      = scale;
            rigidActor = scene.Physics.CreateRigidDynamic(worldTransformation.AsPhysX());
            material   = scene.Physics.CreateMaterial(MaterialDescription.StaticFriction, MaterialDescription.DynamicFriction, MaterialDescription.Bounciness);
            var boxShape = rigidActor.CreateShape(geometry, material, localTransformation.AsPhysX());

            rigidActor.SetMassAndUpdateInertia(mass);
        }
Beispiel #3
0
        public void CreateBox(Scene.Entity3D ent)
        {
            Scene.Bounds bb = ent.Bounds;
            ID = PhysicsManager.py.CreateRigidDynamic();

            BoxGeometry ge = new BoxGeometry(bb.W / 2, bb.H / 2, bb.D / 2);

            //            Shape = ID.CreateShape ( ge, Mat );
            ID.LinearVelocity = new System.Numerics.Vector3(0, 0, 0);
            Shape             = RigidActorExt.CreateExclusiveShape(ID, ge, Mat);



            //Pose = ID.GlobalPose;
            var   wm  = ent.WorldNoScale;
            float m11 = wm.M11;
            float m12 = wm.M12;
            float m13 = wm.M13;
            float m14 = wm.M14;

            float m21 = wm.M21;
            float m22 = wm.M22;
            float m23 = wm.M23;
            float m24 = wm.M24;

            float m31 = wm.M31;
            float m32 = wm.M32;
            float m33 = wm.M33;
            float m34 = wm.M34;

            float m41 = wm.M41;
            float m42 = wm.M42;
            float m43 = wm.M43;
            float m44 = wm.M44;

            System.Numerics.Matrix4x4 tm = new System.Numerics.Matrix4x4(m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44);

            ID.GlobalPose = tm;

            ID.SetMassAndUpdateInertia(3);

            Physics.PhysicsManager.Scene.AddActor(ID);
        }