Пример #1
0
 public abstract Vector3 GetInvInertiaDiagLocal(BulletBody obj);
Пример #2
0
 public abstract int GetNumConstraintRefs(BulletBody obj);
Пример #3
0
 // =====================================================================================
 // Debugging
 public virtual void DumpRigidBody(BulletWorld sim, BulletBody collisionObject)
 {
 }
Пример #4
0
 public abstract bool IsInWorld(BulletWorld world, BulletBody obj);
Пример #5
0
 public abstract void RemoveConstraintRef(BulletBody obj, BulletConstraint constrain);
Пример #6
0
 public abstract bool WantsSleeping(BulletBody obj);
Пример #7
0
 public abstract void SetAngularFactorV(BulletBody obj, Vector3 factor);
Пример #8
0
 // Apply impulse to the object's torque. Force is scaled by object's mass.
 public abstract void ApplyTorqueImpulse(BulletBody obj, Vector3 imp);
Пример #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);
Пример #10
0
 // Apply force at the given point. Will add torque to the object.
 public abstract void ApplyForce(BulletBody obj, Vector3 force, Vector3 pos);
Пример #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);
Пример #12
0
 public abstract void ApplyTorque(BulletBody obj, Vector3 torque);
Пример #13
0
 public abstract void SetSleepingThresholds(BulletBody obj, float lin_threshold, float ang_threshold);
Пример #14
0
 public abstract void SetInvInertiaDiagLocal(BulletBody obj, Vector3 inert);
Пример #15
0
 public abstract void Translate(BulletBody obj, Vector3 trans);
Пример #16
0
 public abstract void ClearAllForces(BulletBody obj);
Пример #17
0
 public abstract void UpdateDeactivation(BulletBody obj, float timeStep);
Пример #18
0
 public abstract void UpdateInertiaTensor(BulletBody obj);
Пример #19
0
 public abstract void SetAngularFactor(BulletBody obj, float factor);
Пример #20
0
 public abstract Vector3 GetLinearVelocity(BulletBody obj);
Пример #21
0
 public abstract Vector3 GetAngularFactor(BulletBody obj);
Пример #22
0
 public abstract Vector3 GetAngularVelocity(BulletBody obj);
Пример #23
0
 public abstract void AddConstraintRef(BulletBody obj, BulletConstraint constrain);
Пример #24
0
 public abstract void SetLinearVelocity(BulletBody obj, Vector3 val);
Пример #25
0
 public abstract BulletConstraint GetConstraintRef(BulletBody obj, int index);
Пример #26
0
 public abstract void SetAngularVelocity(BulletBody obj, Vector3 angularVelocity);
Пример #27
0
 public abstract bool SetCollisionGroupMask(BulletBody body, UInt32 filter, UInt32 mask);
Пример #28
0
 public abstract Vector3 GetVelocityInLocalPoint(BulletBody obj, Vector3 pos);
Пример #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);
        }
Пример #30
0
 public abstract Vector3 GetTotalTorque(BulletBody obj);