Exemplo n.º 1
0
 public DynamicsWorld(IDispatcher dispatcher, IBroadphaseInterface broadphase, ICollisionConfiguration collisionConfiguration)
     : base(dispatcher, broadphase, collisionConfiguration)
 {
     InternalTickCallback = null;
     InternalPreTickCallback = null;
     m_worldUserInfo = null;
 }
Exemplo n.º 2
0
		///this btDiscreteDynamicsWorld constructor gets created objects from the user, and will not delete those
		public DiscreteDynamicsWorld(IDispatcher dispatcher, IBroadphaseInterface pairCache, IConstraintSolver constraintSolver, ICollisionConfiguration collisionConfiguration)
			: base(dispatcher, pairCache, collisionConfiguration)
		{
			m_ownsIslandManager = true;
			m_constraints = new ObjectArray<TypedConstraint>();
			m_actions = new List<IActionInterface>();
			m_nonStaticRigidBodies = new ObjectArray<RigidBody>();
			m_islandManager = new SimulationIslandManager();
			m_constraintSolver = constraintSolver;

			Gravity = new Vector3(0, -10, 0);
			m_localTime = 1f / 60f;
			m_profileTimings = 0;
			m_synchronizeAllMotionStates = false;

			if (m_constraintSolver == null)
			{
				m_constraintSolver = new SequentialImpulseConstraintSolver();
				m_ownsConstraintSolver = true;
			}
			else
			{
				m_ownsConstraintSolver = false;
			}
		}
Exemplo n.º 3
0
		public DynamicsWorld(IDispatcher dispatcher,IBroadphaseInterface broadphase,ICollisionConfiguration collisionConfiguration)
		:base(dispatcher,broadphase,collisionConfiguration)
		{
            m_internalTickCallback = null;
            m_worldUserInfo = null;
            m_solverInfo = new ContactSolverInfo();
		}
Exemplo n.º 4
0
 //this constructor doesn't own the dispatcher and paircache/broadphase
 public CollisionWorld(IDispatcher dispatcher, IBroadphaseInterface broadphasePairCache, ICollisionConfiguration collisionConfiguration)
 {
     m_dispatcher1 = dispatcher;
     m_broadphasePairCache = broadphasePairCache;
     m_collisionObjects = new ObjectArray<CollisionObject>();
     m_dispatchInfo = new DispatcherInfo();
     m_forceUpdateAllAabbs = true;
 }
		///this btSimpleDynamicsWorld constructor creates dispatcher, broadphase pairCache and constraintSolver
		public SimpleDynamicsWorld(IDispatcher dispatcher, IBroadphaseInterface pairCache, IConstraintSolver constraintSolver, ICollisionConfiguration collisionConfiguration)
			: base(dispatcher, pairCache, collisionConfiguration)
		{
			m_constraintSolver = constraintSolver;
			m_ownsConstraintSolver = false;
			IndexedVector3 gravity = new IndexedVector3(0, 0, -10f);
			SetGravity(ref gravity);

		}
Exemplo n.º 6
0
 public CollisionWorld(IDispatcher dispatcher, IBroadphaseInterface pairCache, ICollisionConfiguration collisionConfiguration)
 {
     m_dispatcher1 = dispatcher;
     m_broadphasePairCache = pairCache;
     m_debugDrawer = null;
     m_forceUpdateAllAabbs = true;
     //メモリ確保系?
     //m_stackAlloc = collisionConfiguration->getStackAllocator();
     //m_dispatchInfo.m_stackAllocator = m_stackAlloc;
 }
Exemplo n.º 7
0
        public BulletXNAPhysicsComponent(Game game, ICollisionConfiguration collisionConf, IConstraintSolver solver, Vector3 gravity)
            : base(game)
        {
            CollisionDispatcher Dispatcher = new CollisionDispatcher(collisionConf);

            IndexedVector3       worldMin   = new IndexedVector3(-1000, -1000, -1000);
            IndexedVector3       worldMax   = -worldMin;
            IBroadphaseInterface broadphase = new AxisSweep3Internal(ref worldMin, ref worldMax, 0xfffe, 0xffff, 16384, null, false);

            //broadphase = new DbvtBroadphase();


            World = new DiscreteDynamicsWorld(Dispatcher, broadphase, solver, collisionConf);
            IndexedVector3 iv3Gravity = new IndexedVector3(gravity.X, gravity.Y, gravity.Z);

            World.SetGravity(ref iv3Gravity);
        }
Exemplo n.º 8
0
        public CollisionDispatcher(ICollisionConfiguration collisionConfiguration)
        {
            m_collisionConfiguration = collisionConfiguration;
            m_dispatcherFlags = DispatcherFlags.CD_USE_RELATIVE_CONTACT_BREAKING_THRESHOLD;
            SetNearCallback(new DefaultNearCallback());

            const int maxTypes = (int)BroadphaseNativeTypes.MAX_BROADPHASE_COLLISION_TYPES;
            m_doubleDispatch = new CollisionAlgorithmCreateFunc[maxTypes, maxTypes];
            for (int i = 0; i < maxTypes; i++)
            {
                for (int j = 0; j < maxTypes; j++)
                {
                    m_doubleDispatch[i, j] = m_collisionConfiguration.GetCollisionAlgorithmCreateFunc((BroadphaseNativeTypes)i, (BroadphaseNativeTypes)j);
                    Debug.Assert(m_doubleDispatch[i, j] != null);
                }
            }
        }
Exemplo n.º 9
0
        public CollisionDispatcher(ICollisionConfiguration collisionConfiguration)
        {
            m_collisionConfiguration = collisionConfiguration;
            m_dispatcherFlags        = DispatcherFlags.CD_USE_RELATIVE_CONTACT_BREAKING_THRESHOLD;
            SetNearCallback(new DefaultNearCallback());

            const int maxTypes = (int)BroadphaseNativeTypes.MAX_BROADPHASE_COLLISION_TYPES;

            m_doubleDispatch = new CollisionAlgorithmCreateFunc[maxTypes, maxTypes];
            for (int i = 0; i < maxTypes; i++)
            {
                for (int j = 0; j < maxTypes; j++)
                {
                    m_doubleDispatch[i, j] = m_collisionConfiguration.GetCollisionAlgorithmCreateFunc((BroadphaseNativeTypes)i, (BroadphaseNativeTypes)j);
                    Debug.Assert(m_doubleDispatch[i, j] != null);
                }
            }
        }
Exemplo n.º 10
0
        public CollisionDispatcher(ICollisionConfiguration collisionConfiguration)
        {
            m_dispatcherFlags = DispatcherFlags.CD_USE_RELATIVE_CONTACT_BREAKING_THRESHOLD;
            m_collisionConfiguration = collisionConfiguration;
            m_neerCallback = DefaultNearCallback;

#if false
            m_collisionAlgorithmPoolAllocator = collisionConfiguration.getCollisionAlgorithmPool();
            m_persistentManifoldPoolAllocator = collisionConfiguration.getPersistentManifoldPool();
#endif
            m_doubleDispatch = new CollisionAlgorithmCreateFunc[(int)BroadphaseNativeTypes.MAX_BROADPHASE_COLLISION_TYPES, (int)BroadphaseNativeTypes.MAX_BROADPHASE_COLLISION_TYPES];
            for (BroadphaseNativeTypes i = BroadphaseNativeTypes.BOX_SHAPE_PROXYTYPE; i < BroadphaseNativeTypes.MAX_BROADPHASE_COLLISION_TYPES; i++)
            {
                for (BroadphaseNativeTypes j = BroadphaseNativeTypes.BOX_SHAPE_PROXYTYPE; j < BroadphaseNativeTypes.MAX_BROADPHASE_COLLISION_TYPES; j++)
                {
                    m_doubleDispatch[(int)i, (int)j] = m_collisionConfiguration.getCollisionAlgorithmCreateFunc(i, j);
                    if (m_doubleDispatch[(int)i, (int)j] == null)
                        throw new BulletException();
                }
            }
        }
Exemplo n.º 11
0
 public DynamicsWorld(IDispatcher dispatcher, IBroadphaseInterface broadphase, ICollisionConfiguration collisionConfiguration)
     : base(dispatcher, broadphase, collisionConfiguration)
 {
     m_internalTickCallback = null;
     m_worldUserInfo        = null;
     m_solverInfo           = new ContactSolverInfo();
 }
Exemplo n.º 12
0
 public void SetCollisionConfiguration(ICollisionConfiguration config)
 {
     m_collisionConfiguration = config;
 }
Exemplo n.º 13
0
 public void SetCollisionConfiguration(ICollisionConfiguration config)
 {
     m_collisionConfiguration = config;
 }
Exemplo n.º 14
0
 public BulletXNAPhysicsComponent(Game game, ICollisionConfiguration collisionConf, Vector3 gravity)
     : this(game, new DefaultCollisionConfiguration(), new SequentialImpulseConstraintSolver(), gravity)
 {
 }
Exemplo n.º 15
0
 public ContinuousDynamicsWorld(IDispatcher dispatcher, IBroadphaseInterface pairCache, IConstraintSolver constraintSolver, ICollisionConfiguration collisionConfiguration)
     : base(dispatcher, pairCache, constraintSolver, collisionConfiguration)
 {
 }
Exemplo n.º 16
0
        ///this btDiscreteDynamicsWorld constructor gets created objects from the user, and will not delete those
        public DiscreteDynamicsWorld(IDispatcher dispatcher, IBroadphaseInterface pairCache, IConstraintSolver constraintSolver, ICollisionConfiguration collisionConfiguration)
            : base(dispatcher, pairCache, collisionConfiguration)
        {
            m_ownsIslandManager        = true;
            m_constraints              = new ObjectArray <TypedConstraint>();
            m_sortedConstraints        = new ObjectArray <TypedConstraint>();
            m_islandSortPredicate      = new SortConstraintOnIslandPredicate();
            m_islandQuickSortPredicate = new QuickSortConstraintOnIslandPredicate();
            m_actions = new List <IActionInterface>();
            m_nonStaticRigidBodies = new ObjectArray <RigidBody>();
            m_islandManager        = new SimulationIslandManager();
            m_constraintSolver     = constraintSolver;

            IndexedVector3 gravity = new IndexedVector3(0, -10, 0);

            SetGravity(ref gravity);
            m_localTime                  = 0f;
            m_profileTimings             = 0;
            m_synchronizeAllMotionStates = false;

            if (m_constraintSolver == null)
            {
                m_constraintSolver     = new SequentialImpulseConstraintSolver();
                m_ownsConstraintSolver = true;
            }
            else
            {
                m_ownsConstraintSolver = false;
            }
        }
Exemplo n.º 17
0
        ///this btSimpleDynamicsWorld constructor creates dispatcher, broadphase pairCache and constraintSolver
        public SimpleDynamicsWorld(IDispatcher dispatcher, IBroadphaseInterface pairCache, IConstraintSolver constraintSolver, ICollisionConfiguration collisionConfiguration)
            : base(dispatcher, pairCache, collisionConfiguration)
        {
            m_constraintSolver     = constraintSolver;
            m_ownsConstraintSolver = false;
            IndexedVector3 gravity = new IndexedVector3(0, 0, -10f);

            SetGravity(ref gravity);
        }
Exemplo n.º 18
0
        /// <summary>
        /// 物理ワールドの初期化
        /// </summary>
        public void init(CollisionDispatcher d, IBroadphaseInterface b, IConstraintSolver s, ICollisionConfiguration c)
        {
            // Construct physics objects
            CoreDescription coreDesc = new CoreDescription();
            UserOutput      output   = new UserOutput();

            this.Core = new Core(coreDesc, output);

            Core core = this.Core;

            // デバッグ描画用の設定
            core.SetParameter(PhysicsParameter.VisualizationScale, 2.0f);
            core.SetParameter(PhysicsParameter.VisualizeForceFields, true);
            core.SetParameter(PhysicsParameter.VisualizeCollisionShapes, true);
            core.SetParameter(PhysicsParameter.VisualizeJointLimits, true);

            /*
             * core.SetParameter(PhysicsParameter.VisualizeJointLocalAxes, true);
             * //core.SetParameter(PhysicsParameter.VisualizeJointWorldAxes, true);
             *          core.SetParameter(PhysicsParameter.VisualizeClothMesh, true);
             *          core.SetParameter(PhysicsParameter.VisualizeFluidPosition, true);
             *          core.SetParameter(PhysicsParameter.VisualizeFluidEmitters, false); // Slows down rendering a bit too much
             *          core.SetParameter(PhysicsParameter.VisualizeSoftBodyMesh, true);
             */

            // シーンの設定
            SceneDescription sceneDesc = new SceneDescription()
            {
                //SimulationType = SimulationType.Hardware,
                Gravity            = new Vector3(0, -9.81f, 0),
                GroundPlaneEnabled = true
            };

            this.scene = core.CreateScene(sceneDesc);

            HardwareVersion ver     = Core.HardwareVersion;
            SimulationType  simType = this.scene.SimulationType;

            // Connect to the remote debugger if it's there
            //core.Foundation.RemoteDebugger.Connect("localhost");
        }
Exemplo n.º 19
0
        //this constructor doesn't own the dispatcher and paircache/broadphase
        public CollisionWorld(IDispatcher dispatcher, IBroadphaseInterface broadphasePairCache, ICollisionConfiguration collisionConfiguration)
        {
            m_dispatcher1 = dispatcher;
            m_broadphasePairCache = broadphasePairCache;
            m_collisionObjects = new ObjectArray<CollisionObject>();
            m_dispatchInfo = new DispatcherInfo();
            m_forceUpdateAllAabbs = true;
            WorldSettings.Params = new WorldData.ParamData();
            WorldSettings.Params.VoronoiSimplexSolverPool = new PooledType<VoronoiSimplexSolver>();
            WorldSettings.Params.SubSimplexConvexCastPool = new PooledType<SubSimplexConvexCast>();
            WorldSettings.Params.ManifoldPointPool = new PooledType<ManifoldPoint>();
            WorldSettings.Params.CastResultPool = new PooledType<CastResult>();
            WorldSettings.Params.SphereShapePool = new PooledType<SphereShape>();
            WorldSettings.Params.DbvtNodePool = new PooledType<DbvtNode>();
            WorldSettings.Params.SingleRayCallbackPool = new PooledType<SingleRayCallback>();
            WorldSettings.Params.SubSimplexClosestResultPool = new PooledType<SubSimplexClosestResult>();
            WorldSettings.Params.GjkPairDetectorPool = new PooledType<GjkPairDetector>();
            WorldSettings.Params.DbvtTreeColliderPool = new PooledType<DbvtTreeCollider>();
            WorldSettings.Params.SingleSweepCallbackPool = new PooledType<SingleSweepCallback>();
            WorldSettings.Params.BroadphaseRayTesterPool = new PooledType<BroadphaseRayTester>();
            WorldSettings.Params.ClosestNotMeConvexResultCallbackPool = new PooledType<ClosestNotMeConvexResultCallback>();
            WorldSettings.Params.GjkEpaPenetrationDepthSolverPool = new PooledType<GjkEpaPenetrationDepthSolver>();
            WorldSettings.Params.ContinuousConvexCollisionPool = new PooledType<ContinuousConvexCollision>();
            WorldSettings.Params.DbvtStackDataBlockPool = new PooledType<DbvtStackDataBlock>();

            WorldSettings.Params.BoxBoxCollisionAlgorithmPool = new PooledType<BoxBoxCollisionAlgorithm>();
            WorldSettings.Params.CompoundCollisionAlgorithmPool = new PooledType<CompoundCollisionAlgorithm>();
            WorldSettings.Params.ConvexConcaveCollisionAlgorithmPool = new PooledType<ConvexConcaveCollisionAlgorithm>();
            WorldSettings.Params.ConvexConvexAlgorithmPool = new PooledType<ConvexConvexAlgorithm>();
            WorldSettings.Params.ConvexPlaneAlgorithmPool = new PooledType<ConvexPlaneCollisionAlgorithm>();
            WorldSettings.Params.SphereBoxCollisionAlgorithmPool = new PooledType<SphereBoxCollisionAlgorithm>();
            WorldSettings.Params.SphereSphereCollisionAlgorithmPool = new PooledType<SphereSphereCollisionAlgorithm>();
            WorldSettings.Params.SphereTriangleCollisionAlgorithmPool = new PooledType<SphereTriangleCollisionAlgorithm>();
            WorldSettings.Params.GImpactCollisionAlgorithmPool = new PooledType<GImpactCollisionAlgorithm>();
            WorldSettings.Params.GjkEpaSolver2MinkowskiDiffPool = new PooledType<GjkEpaSolver2MinkowskiDiff>();
            WorldSettings.Params.PersistentManifoldPool = new PooledType<PersistentManifold>();
            WorldSettings.Params.ManifoldResultPool = new PooledType<ManifoldResult>();
            WorldSettings.Params.GJKPool = new PooledType<GJK>();
            WorldSettings.Params.GIM_ShapeRetrieverPool = new PooledType<GIM_ShapeRetriever>();
            WorldSettings.Params.TriangleShapePool = new PooledType<TriangleShape>();
            WorldSettings.Params.SphereTriangleDetectorPool = new PooledType<SphereTriangleDetector>();
            WorldSettings.Params.CompoundLeafCallbackPool = new PooledType<CompoundLeafCallback>();
            WorldSettings.Params.GjkConvexCastPool = new PooledType<GjkConvexCast>();
            WorldSettings.Params.LocalTriangleSphereCastCallbackPool = new PooledType<LocalTriangleSphereCastCallback>();
            WorldSettings.Params.BridgeTriangleRaycastCallbackPool = new PooledType<BridgeTriangleRaycastCallback>();
            WorldSettings.Params.BridgeTriangleConcaveRaycastCallbackPool = new PooledType<BridgeTriangleConcaveRaycastCallback>();
            WorldSettings.Params.BridgeTriangleConvexcastCallbackPool = new PooledType<BridgeTriangleConvexcastCallback>();
            WorldSettings.Params.MyNodeOverlapCallbackPool = new PooledType<MyNodeOverlapCallback>();
            WorldSettings.Params.ClosestRayResultCallbackPool = new PooledType<ClosestRayResultCallback>();
            WorldSettings.Params.DebugDrawcallbackPool = new PooledType<BulletXNA.DebugDrawcallback>();
            
        }
Exemplo n.º 20
0
 public CollisionDispatcher(ICollisionConfiguration config)
 {
 }