Ejemplo n.º 1
0
 public abstract Vector3 GetInvInertiaDiagLocal(BulletBody obj);
Ejemplo n.º 2
0
 public abstract int GetNumConstraintRefs(BulletBody obj);
Ejemplo n.º 3
0
 // =====================================================================================
 // Debugging
 public virtual void DumpRigidBody(BulletWorld sim, BulletBody collisionObject)
 {
 }
Ejemplo n.º 4
0
 public abstract bool IsInWorld(BulletWorld world, BulletBody obj);
Ejemplo n.º 5
0
 public abstract void RemoveConstraintRef(BulletBody obj, BulletConstraint constrain);
Ejemplo n.º 6
0
 public abstract bool WantsSleeping(BulletBody obj);
Ejemplo n.º 7
0
 public abstract void SetAngularFactorV(BulletBody obj, Vector3 factor);
Ejemplo n.º 8
0
 // Apply impulse to the object's torque. Force is scaled by object's mass.
 public abstract void ApplyTorqueImpulse(BulletBody obj, Vector3 imp);
Ejemplo n.º 9
0
 // Apply impulse at the point given. For is scaled by object's mass and effects both linear and angular forces.
 public abstract void ApplyImpulse(BulletBody obj, Vector3 imp, Vector3 pos);
Ejemplo n.º 10
0
 // Apply force at the given point. Will add torque to the object.
 public abstract void ApplyForce(BulletBody obj, Vector3 force, Vector3 pos);
Ejemplo n.º 11
0
 // Apply impulse to the object. Same as "ApplycentralForce" but force scaled by object's mass.
 public abstract void ApplyCentralImpulse(BulletBody obj, Vector3 imp);
Ejemplo n.º 12
0
 public abstract void ApplyTorque(BulletBody obj, Vector3 torque);
Ejemplo n.º 13
0
 public abstract void SetSleepingThresholds(BulletBody obj, float lin_threshold, float ang_threshold);
Ejemplo n.º 14
0
 public abstract void SetInvInertiaDiagLocal(BulletBody obj, Vector3 inert);
Ejemplo n.º 15
0
 public abstract void Translate(BulletBody obj, Vector3 trans);
Ejemplo n.º 16
0
 public abstract void ClearAllForces(BulletBody obj);
Ejemplo n.º 17
0
 public abstract void UpdateDeactivation(BulletBody obj, float timeStep);
Ejemplo n.º 18
0
 public abstract void UpdateInertiaTensor(BulletBody obj);
Ejemplo n.º 19
0
 public abstract void SetAngularFactor(BulletBody obj, float factor);
Ejemplo n.º 20
0
 public abstract Vector3 GetLinearVelocity(BulletBody obj);
Ejemplo n.º 21
0
 public abstract Vector3 GetAngularFactor(BulletBody obj);
Ejemplo n.º 22
0
 public abstract Vector3 GetAngularVelocity(BulletBody obj);
Ejemplo n.º 23
0
 public abstract void AddConstraintRef(BulletBody obj, BulletConstraint constrain);
Ejemplo n.º 24
0
 public abstract void SetLinearVelocity(BulletBody obj, Vector3 val);
Ejemplo n.º 25
0
 public abstract BulletConstraint GetConstraintRef(BulletBody obj, int index);
Ejemplo n.º 26
0
 public abstract void SetAngularVelocity(BulletBody obj, Vector3 angularVelocity);
Ejemplo n.º 27
0
 public abstract bool SetCollisionGroupMask(BulletBody body, UInt32 filter, UInt32 mask);
Ejemplo n.º 28
0
 public abstract Vector3 GetVelocityInLocalPoint(BulletBody obj, Vector3 pos);
Ejemplo n.º 29
0
        // Create terrain mesh from a heightmap.
        public BSTerrainMesh(BSScene physicsScene, Vector3 regionBase, uint id, float[] initialMap,
                             Vector3 minCoords, Vector3 maxCoords)
            : base(physicsScene, regionBase, id)
        {
            int indicesCount;

            int[] indices;
            int   verticesCount;

            float[] vertices;

            m_savedHeightMap = initialMap;

            m_sizeX = (int)(maxCoords.X - minCoords.X);
            m_sizeY = (int)(maxCoords.Y - minCoords.Y);

            bool meshCreationSuccess = false;

            if (BSParam.TerrainMeshMagnification == 1)
            {
                // If a magnification of one, use the old routine that is tried and true.
                meshCreationSuccess = BSTerrainMesh.ConvertHeightmapToMesh(PhysicsScene,
                                                                           initialMap, m_sizeX, m_sizeY, // input size
                                                                           Vector3.Zero,                 // base for mesh
                                                                           out indicesCount, out indices, out verticesCount, out vertices);
            }
            else
            {
                // Other magnifications use the newer routine
                meshCreationSuccess = BSTerrainMesh.ConvertHeightmapToMesh2(PhysicsScene,
                                                                            initialMap, m_sizeX, m_sizeY, // input size
                                                                            BSParam.TerrainMeshMagnification,
                                                                            physicsScene.TerrainManager.WorldMax,
                                                                            Vector3.Zero, // base for mesh
                                                                            out indicesCount, out indices, out verticesCount, out vertices);
            }
            if (!meshCreationSuccess)
            {
                // DISASTER!!
                PhysicsScene.DetailLog("{0},BSTerrainMesh.create,failedConversionOfHeightmap,id={1}", BSScene.DetailLogZero, ID);
                PhysicsScene.Logger.ErrorFormat("{0} Failed conversion of heightmap to mesh! base={1}", LogHeader, TerrainBase);
                // Something is very messed up and a crash is in our future.
                return;
            }

            PhysicsScene.DetailLog("{0},BSTerrainMesh.create,meshed,id={1},indices={2},indSz={3},vertices={4},vertSz={5}",
                                   BSScene.DetailLogZero, ID, indicesCount, indices.Length, verticesCount, vertices.Length);

            m_terrainShape = PhysicsScene.PE.CreateMeshShape(PhysicsScene.World, indicesCount, indices, verticesCount, vertices);
            if (!m_terrainShape.HasPhysicalShape)
            {
                // DISASTER!!
                PhysicsScene.DetailLog("{0},BSTerrainMesh.create,failedCreationOfShape,id={1}", BSScene.DetailLogZero, ID);
                PhysicsScene.Logger.ErrorFormat("{0} Failed creation of terrain mesh! base={1}", LogHeader, TerrainBase);
                // Something is very messed up and a crash is in our future.
                return;
            }

            Vector3    pos = regionBase;
            Quaternion rot = Quaternion.Identity;

            m_terrainBody = PhysicsScene.PE.CreateBodyWithDefaultMotionState(m_terrainShape, ID, pos, rot);
            if (!m_terrainBody.HasPhysicalBody)
            {
                // DISASTER!!
                PhysicsScene.Logger.ErrorFormat("{0} Failed creation of terrain body! base={1}", LogHeader, TerrainBase);
                // Something is very messed up and a crash is in our future.
                return;
            }
            physicsScene.PE.SetShapeCollisionMargin(m_terrainShape, BSParam.TerrainCollisionMargin);

            // Set current terrain attributes
            PhysicsScene.PE.SetFriction(m_terrainBody, BSParam.TerrainFriction);
            PhysicsScene.PE.SetHitFraction(m_terrainBody, BSParam.TerrainHitFraction);
            PhysicsScene.PE.SetRestitution(m_terrainBody, BSParam.TerrainRestitution);
            PhysicsScene.PE.SetContactProcessingThreshold(m_terrainBody, BSParam.TerrainContactProcessingThreshold);
            PhysicsScene.PE.SetCollisionFlags(m_terrainBody, CollisionFlags.CF_STATIC_OBJECT);

            // Static objects are not very massive.
            PhysicsScene.PE.SetMassProps(m_terrainBody, 0f, Vector3.Zero);

            // Put the new terrain to the world of physical objects
            PhysicsScene.PE.AddObjectToWorld(PhysicsScene.World, m_terrainBody);

            // Redo its bounding box now that it is in the world
            PhysicsScene.PE.UpdateSingleAabb(PhysicsScene.World, m_terrainBody);

            m_terrainBody.collisionType = CollisionType.Terrain;
            m_terrainBody.ApplyCollisionMask(PhysicsScene);

            if (BSParam.UseSingleSidedMeshes)
            {
                PhysicsScene.DetailLog("{0},BSTerrainMesh.settingCustomMaterial,id={1}", BSScene.DetailLogZero, id);
                PhysicsScene.PE.AddToCollisionFlags(m_terrainBody, CollisionFlags.CF_CUSTOM_MATERIAL_CALLBACK);
            }

            // Make it so the terrain will not move or be considered for movement.
            PhysicsScene.PE.ForceActivationState(m_terrainBody, ActivationState.DISABLE_SIMULATION);
        }
Ejemplo n.º 30
0
 public abstract Vector3 GetTotalTorque(BulletBody obj);