static Collisions() { collisionConfig = new DefaultCollisionConfiguration(); collisionDispatcher = new CollisionDispatcher(collisionConfig); broadphase = new DbvtBroadphase(); colWorld = new DiscreteDynamicsWorld(collisionDispatcher, broadphase, null, collisionConfig); colWorld.Gravity = new BulletSharp.Math.Vector3(0, 0, 0); HardCollisionAction = null; SoftCollisionAction = null; //Prepare simulation parameters, try 25 steps to see the ball mid air // var simulationIterations = 125; // var simulationTimestep = 1f / 60f; // //Step through the desired amount of simulation ticks // for (var i = 0; i < simulationIterations; i++) // { // Update(simulationTimestep); // } balls = new List <BallInfo>(); boxes = new List <BoxInfo>(); }
private void _worker_DoWork(object sender, DoWorkEventArgs e) { var conf = new DefaultCollisionConfiguration(); var dispatcher = new CollisionDispatcher(conf); var broadphase = new DbvtBroadphase(); var Solver = new SequentialImpulseConstraintSolver(); //var Solver = new MultiBodyConstraintSolver(); world = new DiscreteDynamicsWorld(dispatcher, broadphase, Solver, conf); world.Gravity = new Vector3(0, 0, 0); world.SolverInfo.NumIterations = 120; world.SolverInfo.SolverMode = SolverModes.RandomizeOrder; world.DispatchInfo.UseContinuous = true; CreateParticles(); CreateWalls(); SetupDoubleSlit(); while (_worker.CancellationPending == false) { world.StepSimulation(1.0f / 60.0f); for (int i = 0; i < Photons.Count; i++) { RigidBody r = Photons[i]; r.ApplyCentralImpulse(new Vector3(5, 0, 0)); } } }
protected override void OnInitializePhysics() { shootBoxInitialSpeed = 4000; // collision configuration contains default setup for memory, collision setup CollisionConf = new DefaultCollisionConfiguration(); Dispatcher = new CollisionDispatcher(CollisionConf); //Dispatcher.RegisterCollisionCreateFunc(BroadphaseNativeType.BoxShape, BroadphaseNativeType.BoxShape, // CollisionConf.GetCollisionAlgorithmCreateFunc(BroadphaseNativeType.ConvexShape, BroadphaseNativeType.ConvexShape)); Broadphase = new DbvtBroadphase(); // the default constraint solver Solver = new SequentialImpulseConstraintSolver(); World = new DiscreteDynamicsWorld(Dispatcher, Broadphase, Solver, CollisionConf); World.SolverInfo.SolverMode |= SolverModes.Use2FrictionDirections | SolverModes.RandomizeOrder; //World.SolverInfo.SplitImpulse = 0; World.SolverInfo.NumIterations = 20; World.DispatchInfo.UseContinuous = ccdMode; World.Gravity = new Vector3(0, -10, 0); CreateGround(); CreateBoxStack(); }
public DistanceDemoSimulation() { CollisionConfiguration = new DefaultCollisionConfiguration(); Dispatcher = new CollisionDispatcher(CollisionConfiguration); Broadphase = new DbvtBroadphase(); World = new DiscreteDynamicsWorld(Dispatcher, Broadphase, null, CollisionConfiguration); CreateGround(); Vector3[] rotatingPoints = { new Vector3(1, 0, 0), new Vector3(0, 1, 0), new Vector3(0, 0, 1) }; _rotatingShape = new ConvexHullShape(rotatingPoints); _rotatingBody = PhysicsHelper.CreateStaticBody(_rotBodyPosition, _rotatingShape, World); _rotatingBody.CollisionFlags |= CollisionFlags.KinematicObject; _rotatingBody.ActivationState = ActivationState.DisableDeactivation; Vector3[] staticPoints = { new Vector3(1, 0, 0), new Vector3(0, 1, 0), new Vector3(0, 0, 1), new Vector3(0, 0, -1), new Vector3(-1, -1, 0) }; _staticShape = new ConvexHullShape(staticPoints); Matrix staticBodyPosition = Matrix.Translation(0, 5, 0); _staticBody = PhysicsHelper.CreateStaticBody(staticBodyPosition, _staticShape, World); }
public Box2DDemoSimulation() { CollisionConfiguration = new DefaultCollisionConfiguration(); // Use the default collision dispatcher. For parallel processing you can use a diffent dispatcher. Dispatcher = new CollisionDispatcher(CollisionConfiguration); _simplexSolver = new VoronoiSimplexSolver(); _penetrationDepthSolver = new MinkowskiPenetrationDepthSolver(); _convexAlgo2D = new Convex2DConvex2DAlgorithm.CreateFunc(_simplexSolver, _penetrationDepthSolver); _boxAlgo2D = new Box2DBox2DCollisionAlgorithm.CreateFunc(); Dispatcher.RegisterCollisionCreateFunc(BroadphaseNativeType.Convex2DShape, BroadphaseNativeType.Convex2DShape, _convexAlgo2D); Dispatcher.RegisterCollisionCreateFunc(BroadphaseNativeType.Box2DShape, BroadphaseNativeType.Convex2DShape, _convexAlgo2D); Dispatcher.RegisterCollisionCreateFunc(BroadphaseNativeType.Convex2DShape, BroadphaseNativeType.Box2DShape, _convexAlgo2D); Dispatcher.RegisterCollisionCreateFunc(BroadphaseNativeType.Box2DShape, BroadphaseNativeType.Box2DShape, _boxAlgo2D); Broadphase = new DbvtBroadphase(); World = new DiscreteDynamicsWorld(Dispatcher, Broadphase, null, CollisionConfiguration); CreateGround(); Create2dBodies(); }
protected override void OnInitializePhysics() { // collision configuration contains default setup for memory, collision setup CollisionConf = new DefaultCollisionConfiguration(); Dispatcher = new CollisionDispatcher(CollisionConf); Broadphase = new DbvtBroadphase(); Solver = new SequentialImpulseConstraintSolver(); World = new DiscreteDynamicsWorld(Dispatcher, Broadphase, Solver, CollisionConf); World.Gravity = Freelook.Up * -10.0f; var bspLoader = new BspLoader(); string[] args = Environment.GetCommandLineArgs(); if (args.Length == 1) { bspLoader.LoadBspFile(Path.Combine("data", "BspDemo.bsp")); } else { bspLoader.LoadBspFile(args[1]); } BspConverter bsp2Bullet = new BspToBulletConverter(this); bsp2Bullet.ConvertBsp(bspLoader, 0.1f); }
protected override void OnInitializePhysics() { // collision configuration contains default setup for memory, collision setup CollisionConf = new DefaultCollisionConfiguration(); // Use the default collision dispatcher. For parallel processing you can use a diffent dispatcher. Dispatcher = new CollisionDispatcher(CollisionConf); var simplex = new VoronoiSimplexSolver(); var pdSolver = new MinkowskiPenetrationDepthSolver(); var convexAlgo2D = new Convex2DConvex2DAlgorithm.CreateFunc(simplex, pdSolver); Dispatcher.RegisterCollisionCreateFunc(BroadphaseNativeType.Convex2DShape, BroadphaseNativeType.Convex2DShape, convexAlgo2D); Dispatcher.RegisterCollisionCreateFunc(BroadphaseNativeType.Box2DShape, BroadphaseNativeType.Convex2DShape, convexAlgo2D); Dispatcher.RegisterCollisionCreateFunc(BroadphaseNativeType.Convex2DShape, BroadphaseNativeType.Box2DShape, convexAlgo2D); Dispatcher.RegisterCollisionCreateFunc(BroadphaseNativeType.Box2DShape, BroadphaseNativeType.Box2DShape, new Box2DBox2DCollisionAlgorithm.CreateFunc()); Broadphase = new DbvtBroadphase(); // the default constraint solver. Solver = new SequentialImpulseConstraintSolver(); World = new DiscreteDynamicsWorld(Dispatcher, Broadphase, Solver, CollisionConf); World.Gravity = new Vector3(0, -10, 0); CreateGround(); Create2dBodies(); }
public override void InitializeDemo() { base.InitializeDemo(); SetCameraDistance(SCALING * 50f); //string filename = @"C:\users\man\bullett\xna-largemesh-output.txt"; //FileStream filestream = File.Open(filename, FileMode.Create, FileAccess.Write, FileShare.Read); //BulletGlobals.g_streamWriter = new StreamWriter(filestream); ///collision configuration contains default setup for memory, collision setup m_collisionConfiguration = new DefaultCollisionConfiguration(); ///use the default collision dispatcher. For parallel processing you can use a diffent dispatcher (see Extras/BulletMultiThreaded) m_dispatcher = new CollisionDispatcher(m_collisionConfiguration); m_broadphase = new DbvtBroadphase(); IOverlappingPairCache pairCache = null; //pairCache = new SortedOverlappingPairCache(); //m_broadphase = new SimpleBroadphase(10000, pairCache); ///the default constraint solver. For parallel processing you can use a different solver (see Extras/BulletMultiThreaded) SequentialImpulseConstraintSolver sol = new SequentialImpulseConstraintSolver(); m_constraintSolver = sol; m_dynamicsWorld = new DiscreteDynamicsWorld(m_dispatcher, m_broadphase, m_constraintSolver, m_collisionConfiguration); IndexedVector3 gravity = new IndexedVector3(0, -10, 0); m_dynamicsWorld.SetGravity(ref gravity); m_profileManager = new BasicProfileManager(); BulletGlobals.g_profileManager = m_profileManager; m_profileIterator = m_profileManager.getIterator(); ///create a few basic rigid bodies IndexedVector3 halfExtents = new IndexedVector3(50, 50, 50); //IndexedVector3 halfExtents = new IndexedVector3(10, 10, 10); //CollisionShape groundShape = new BoxShape(ref halfExtents); CollisionShape groundShape = new StaticPlaneShape(new IndexedVector3(0, 1, 0), 0); LocalCreateRigidBody(0f, IndexedMatrix.Identity, groundShape); //CollisionShape groundShape = BuildLargeMesh(); m_collisionShapes.Add(groundShape); CollisionShape sphereShape = new SphereShape(0.2f); int size = 16;// 5; // 16 for (int i = 0; i < size; ++i) { for (int j = 0; j < size; ++j) { IndexedMatrix m = IndexedMatrix.CreateTranslation(new IndexedVector3(i, 1, j)); RigidBody rb = LocalCreateRigidBody(1f, m, sphereShape); rb.SetActivationState(ActivationState.ISLAND_SLEEPING); } } ClientResetScene(); }
public ConstraintDemoSimulation() { CollisionConfiguration = new DefaultCollisionConfiguration(); Dispatcher = new CollisionDispatcher(CollisionConfiguration); Broadphase = new DbvtBroadphase(); World = new DiscreteDynamicsWorld(Dispatcher, Broadphase, null, CollisionConfiguration); CreateGround(); _cubeShape = new BoxShape(CubeHalfExtent); CreateGears(); CreateHingedBoxes(); CreateMotorHinge(); CreateMotorHinge2(); CreateSlider(); CreateD6Slider(); CreateDoor(); CreateGeneric6DofConstraint(); CreateConeTwist(); CreateUniversalConstraint(); CreateGeneric6DofSpringConstraint(); CreateHinge(); CreateHinge2(); }
public PhysicsEngine() { //CreateSchedulers(); //NextTaskScheduler(); using (var collisionConfigurationInfo = new DefaultCollisionConstructionInfo { DefaultMaxPersistentManifoldPoolSize = 800, DefaultMaxCollisionAlgorithmPoolSize = 800 }) { collisionConf = new DefaultCollisionConfiguration(collisionConfigurationInfo); }; dispatcher = new CollisionDispatcher(collisionConf); broadphase = new DbvtBroadphase(); var solver = new SequentialImpulseConstraintSolver(); //var Solver = new NncgConstraintSolver(); //DiscreteDynamicsWorldMultiThreaded(dispatcher, broadphase, Solver, collisionConf); World = new DiscreteDynamicsWorld(dispatcher, broadphase, solver, collisionConf); //dispatcher = new CollisionDispatcherMultiThreaded(collisionConf); //Solver = new ConstraintSolverPoolMultiThreaded(MaxThreadCount); //World = new DiscreteDynamicsWorldMultiThreaded(dispatcher, broadphase, Solver, null, collisionConf); //World.SolverInfo.SolverMode = SolverModes.Simd | SolverModes.UseWarmStarting; //World = new DiscreteDynamicsWorldMultiThreaded(dispatcher, broadphase, cspm, csM, collisionConf); //World.Gravity = new Vector3(0, 0f, 0); // CreateFloor(); //World.LatencyMotionStateInterpolation = false; //for character controllers broadphase.OverlappingPairCache.SetInternalGhostPairCallback(new GhostPairCallback()); World.DebugDrawer = new PhysicsDebugDraw(World); }
protected override void OnInitializePhysics() { CollisionConf = new DefaultCollisionConfiguration(); Dispatcher = new CollisionDispatcher(CollisionConf); Broadphase = new DbvtBroadphase(); World = new DiscreteDynamicsWorld(Dispatcher, Broadphase, null, CollisionConf); World.Gravity = new Vector3(0, -10, 0); CreateGround(); Vector3[] rotatingPoints = { new Vector3(1, 0, 0), new Vector3(0, 1, 0), new Vector3(0, 0, 1) }; _rotatingShape = new ConvexHullShape(rotatingPoints); _rotatingBody = LocalCreateRigidBody(0, _rotBodyPosition, _rotatingShape); _rotatingBody.CollisionFlags |= CollisionFlags.KinematicObject; _rotatingBody.ActivationState = ActivationState.DisableDeactivation; Vector3[] staticPoints = { new Vector3(1, 0, 0), new Vector3(0, 1, 0), new Vector3(0, 0, 1), new Vector3(0, 0, -1), new Vector3(-1, -1, 0) }; _staticShape = new ConvexHullShape(staticPoints); _staticBody = LocalCreateRigidBody(0, _staticBodyPosition, _staticShape); }
public Physics() { CLStuff.InitCL(); cloths = new Cloth[numFlags]; for (int flagIndex = 0; flagIndex < numFlags; ++flagIndex) { cloths[flagIndex] = new Cloth(); cloths[flagIndex].CreateBuffers(clothWidth, clothHeight); } gSolver = new OpenCLSoftBodySolver(CLStuff.commandQueue, CLStuff.cxMainContext); softBodyOutput = new SoftBodySolverOutputCLToCpu(); // collision configuration contains default setup for memory, collision setup CollisionConf = new SoftBodyRigidBodyCollisionConfiguration(); Dispatcher = new CollisionDispatcher(CollisionConf); Broadphase = new DbvtBroadphase(); Solver = new SequentialImpulseConstraintSolver(); World = new SoftRigidDynamicsWorld(Dispatcher, Broadphase, Solver, CollisionConf, gSolver); World.Gravity = new Vector3(0, -10, 0); // create the ground CollisionShape groundShape = new BoxShape(50, 50, 50); CollisionShapes.Add(groundShape); CollisionObject ground = LocalCreateRigidBody(0, Matrix.Translation(0, -60, 0), groundShape); ground.UserObject = "Ground"; SoftWorld.WorldInfo.AirDensity = 1.2f; SoftWorld.WorldInfo.WaterDensity = 0; SoftWorld.WorldInfo.WaterOffset = 0; SoftWorld.WorldInfo.WaterNormal = Vector3.Zero; SoftWorld.WorldInfo.Gravity = new Vector3(0, -10, 0); CreateFlag(clothWidth, clothHeight, out flags); // Create output buffer descriptions for ecah flag // These describe where the simulation should send output data to for (int flagIndex = 0; flagIndex < flags.Count; ++flagIndex) { // flags[flagIndex].WindVelocity = new Vector3(0, 0, 15.0f); // In this case we have a DX11 output buffer with a vertex at index 0, 8, 16 and so on as well as a normal at 3, 11, 19 etc. // Copies will be performed GPU-side directly into the output buffer CpuVertexBufferDescriptor vertexBufferDescriptor = new CpuVertexBufferDescriptor(cloths[flagIndex].CpuBuffer, 0, 8, 3, 8); cloths[flagIndex].VertexBufferDescriptor = vertexBufferDescriptor; } gSolver.Optimize(SoftWorld.SoftBodyArray); World.StepSimulation(1.0f / 60.0f, 0); }
protected override void OnInitializePhysics() { // collision configuration contains default setup for memory, collision setup CollisionConf = new DefaultCollisionConfiguration(); Dispatcher = new CollisionDispatcher(CollisionConf); Broadphase = new DbvtBroadphase(); Solver = new SequentialImpulseConstraintSolver(); World = new DiscreteDynamicsWorld(Dispatcher, Broadphase, Solver, CollisionConf); World.Gravity = Freelook.Up * -10.0f; BspLoader bspLoader = new BspLoader(); //string[] args = Environment.GetCommandLineArgs(); //if (args.Length == 1) //{ UnityEngine.TextAsset bytes = (UnityEngine.TextAsset)UnityEngine.Resources.Load("BspDemo"); System.IO.Stream byteStream = new System.IO.MemoryStream(bytes.bytes); bspLoader.LoadBspFile(byteStream); //} //else //{ // bspLoader.LoadBspFile(args[1]); //} BspConverter bsp2Bullet = new BspToBulletConverter(this); bsp2Bullet.ConvertBsp(bspLoader, 0.1f); }
public Physics() { // collision configuration contains default setup for memory, collision setup CollisionConf = new DefaultCollisionConfiguration(); Dispatcher = new CollisionDispatcher(CollisionConf); Broadphase = new DbvtBroadphase(); World = new DiscreteDynamicsWorld(Dispatcher, Broadphase, null, CollisionConf); World.Gravity = new Vector3(0, -10, 0); // create the ground CollisionShape groundShape = new BoxShape(50, 1, 50); CollisionShapes.Add(groundShape); CollisionObject ground = LocalCreateRigidBody(0, Matrix.Identity, groundShape); ground.UserObject = "Ground"; // create a few dynamic rigidbodies float mass = 1.0f; CollisionShape colShape = new BoxShape(1); CollisionShapes.Add(colShape); Vector3 localInertia = colShape.CalculateLocalInertia(mass); float start_x = StartPosX - ArraySizeX / 2; float start_y = StartPosY; float start_z = StartPosZ - ArraySizeZ / 2; int k, i, j; for (k = 0; k < ArraySizeY; k++) { for (i = 0; i < ArraySizeX; i++) { for (j = 0; j < ArraySizeZ; j++) { Matrix startTransform = Matrix.Translation( 2 * i + start_x, 2 * k + start_y, 2 * j + start_z ); // using motionstate is recommended, it provides interpolation capabilities // and only synchronizes 'active' objects DefaultMotionState myMotionState = new DefaultMotionState(startTransform); RigidBodyConstructionInfo rbInfo = new RigidBodyConstructionInfo(mass, myMotionState, colShape, localInertia); RigidBody body = new RigidBody(rbInfo); // make it drop from a height body.Translate(new Vector3(0, 20, 0)); World.AddRigidBody(body); } } } }
public void SetUp() { _conf = new DefaultCollisionConfiguration(); _dispatcher = new CollisionDispatcher(_conf); _broadphase = new DbvtBroadphase(); _solver = new SequentialImpulseConstraintSolver(); _world = new DiscreteDynamicsWorld(_dispatcher, _broadphase, _solver, _conf); }
protected override void Initialize() { base.Initialize(); // collision configuration contains default setup for memory, collision setup CollisionConf = new DefaultCollisionConfiguration(); Dispatcher = new CollisionDispatcher(CollisionConf); Broadphase = new DbvtBroadphase(); World = new DiscreteDynamicsWorld(Dispatcher, Broadphase, null, CollisionConf); World.Gravity = new Vector3(0, -10, 0); World.DebugDrawer = DebugDrawer; // create the ground _groundShape = new BoxShape(50, 1, 50); LoadModel("ground", _groundShape); CollisionShapes.Add(_groundShape); CollisionObject ground = LocalCreateRigidBody(0, Matrix.Identity, _groundShape); // create a few dynamic rigidbodies const float mass = 1.0f; _boxShape = new BoxShape(1); LoadModel("cube", _boxShape); CollisionShapes.Add(_boxShape); var rbInfo = new RigidBodyConstructionInfo(mass, null, _boxShape); rbInfo.LocalInertia = _boxShape.CalculateLocalInertia(mass); for (int k = 0; k < ArraySizeY; k++) { for (int i = 0; i < ArraySizeX; i++) { for (int j = 0; j < ArraySizeZ; j++) { Matrix startTransform = Matrix.CreateTranslation( _start + new Vector3(2 * i, 2 * k, 2 * j)); // using motionstate is recommended, it provides interpolation capabilities // and only synchronizes 'active' objects rbInfo.MotionState = new DefaultMotionState(startTransform); var body = new RigidBody(rbInfo); // make it drop from a height body.Translate(new Vector3(0, 20, 0)); World.AddRigidBody(body); } } } rbInfo.Dispose(); FreeLook.SetEyeTarget(ref _eye, ref _target); }
/// <summary> /// Creates the System with a default DiscreteDynamicsWorld /// </summary> public BulletPhysicsSystem() { CollisionConfiguration Config = new DefaultCollisionConfiguration(); Dispatcher Disp = new CollisionDispatcher(Config); BroadphaseInterface Interface = new DbvtBroadphase(); ConstraintSolver Solver = new SequentialImpulseConstraintSolver(); World = new DiscreteDynamicsWorld(Disp, Interface, Solver, Config); }
public void Create() { var bp = new DbvtBroadphase(); var conf = new DefaultCollisionConfiguration(); var dispatcher = new CollisionDispatcher(conf); var solver = new SequentialImpulseConstraintSolver(); world = new DiscreteDynamicsWorld(dispatcher, bp, solver, conf); }
public BulletPhysics() { collisionConf = new DefaultCollisionConfiguration(); dispatcher = new CollisionDispatcher(collisionConf); broadphase = new DbvtBroadphase(); physics_world = new DiscreteDynamicsWorld(dispatcher, broadphase, null, collisionConf); physics_world.Gravity = new Vector3(0, 0, -384); }
public PhysicsWorld() { collisionConf = new DefaultCollisionConfiguration(); btDispatcher = new CollisionDispatcher(collisionConf); broadphase = new DbvtBroadphase(); btWorld = new DiscreteDynamicsWorld(btDispatcher, broadphase, null, collisionConf); btWorld.Gravity = BM.Vector3.Zero; }
void SetupEmptyDynamicsWorld() { CollisionConf = new DefaultCollisionConfiguration(); Dispatcher = new CollisionDispatcher(CollisionConf); Broadphase = new DbvtBroadphase(); Solver = new SequentialImpulseConstraintSolver(); World = new DiscreteDynamicsWorld(Dispatcher, Broadphase, Solver, CollisionConf); World.Gravity = new Vector3(0, -10, 0); }
public override void InitializeDemo() { //string filename = @"C:\users\man\bullet\xna-motor-output.txt"; //FileStream filestream = File.Open(filename, FileMode.Create, FileAccess.Write, FileShare.Read); //BulletGlobals.g_streamWriter = new StreamWriter(filestream); m_Time = 0; m_fCyclePeriod = 2000.0f; // in milliseconds // new SIMD solver for joints clips accumulated impulse, so the new limits for the motor // should be (numberOfsolverIterations * oldLimits) // currently solver uses 10 iterations, so: m_fMuscleStrength = 0.5f; SetCameraDistance(5.0f); m_collisionConfiguration = new DefaultCollisionConfiguration(); m_dispatcher = new CollisionDispatcher(m_collisionConfiguration); m_broadphase = new DbvtBroadphase(); IOverlappingPairCache pairCache = null; m_broadphase = new SimpleBroadphase(1000, pairCache); SequentialImpulseConstraintSolver sol = new SequentialImpulseConstraintSolver(); m_constraintSolver = sol; m_dynamicsWorld = new DiscreteDynamicsWorld(m_dispatcher, m_broadphase, m_constraintSolver, m_collisionConfiguration); IndexedVector3 gravity = new IndexedVector3(0, -10, 0); m_dynamicsWorld.SetGravity(ref gravity); m_dynamicsWorld.SetInternalTickCallback(new MotorPreTickCallback(), this, true); // Setup a big ground box { CollisionShape groundShape = new BoxShape(new IndexedVector3(200.0f, 10.0f, 200.0f)); m_collisionShapes.Add(groundShape); IndexedMatrix groundTransform = IndexedMatrix.CreateTranslation(0, -10, 0); LocalCreateRigidBody(0f, ref groundTransform, groundShape); } // Spawn one ragdoll IndexedVector3 startOffset = new IndexedVector3(1, 0.5f, 0); SpawnTestRig(ref startOffset, false); startOffset = new IndexedVector3(-2, 0.5f, 0); SpawnTestRig(ref startOffset, true); ClientResetScene(); }
static void InitPhysics() { PhysConfig = new DefaultCollisionConfiguration(); PhysDispatcher = new CollisionDispatcher(PhysConfig); Broadphase = new DbvtBroadphase(); PhysWorld = new DiscreteDynamicsWorld(PhysDispatcher, Broadphase, null, PhysConfig); PhysWorld.Gravity = new Vector3(0, -9.81f, 0); }
public BasicDemoSimulation() { CollisionConfiguration = new DefaultCollisionConfiguration(); Dispatcher = new CollisionDispatcher(CollisionConfiguration); Broadphase = new DbvtBroadphase(); World = new DiscreteDynamicsWorld(Dispatcher, Broadphase, null, CollisionConfiguration); CreateGround(); CreateBoxes(); }
private void InitializePhysics() { _collisionConfiguration = new DefaultCollisionConfiguration(); _dispatcher = new CollisionDispatcher(_collisionConfiguration); _broadPhase = new DbvtBroadphase(); _world = new DiscreteDynamicsWorld(_dispatcher, _broadPhase, null, _collisionConfiguration) { Gravity = new Vector3(0, 0, -10) }; }
public UrdfDemoSimulation(string urdfFileName) { CollisionConfiguration = new DefaultCollisionConfiguration(); Dispatcher = new CollisionDispatcher(CollisionConfiguration); Broadphase = new DbvtBroadphase(); World = new DiscreteDynamicsWorld(Dispatcher, Broadphase, null, CollisionConfiguration); CreateGround(); LoadUrdf(urdfFileName); }
public Physics() { _Main = this; collisionConf = new DefaultCollisionConfiguration(); dispatcher = new CollisionDispatcher(collisionConf); broadphase = new DbvtBroadphase(); _World = new DiscreteDynamicsWorld(dispatcher, broadphase, null, collisionConf); _World.Gravity = new Vector3(0, -10, 0); }
public CollisionManager(Program debug) { var defaultCollisionConfiguration = new DefaultCollisionConfiguration(); var collisionDispatcher = new CollisionDispatcher(defaultCollisionConfiguration); var broadphase = new DbvtBroadphase(); this.World = new CollisionWorld(collisionDispatcher, broadphase, defaultCollisionConfiguration); if (debug != null) { this.World.DebugDrawer = new BulletDebugDrawer(debug); } }
public void InitializeWorld() { DbvtBroadphase broadphase = new DbvtBroadphase(); DefaultCollisionConfiguration conf = new DefaultCollisionConfiguration(); CollisionDispatcher dispacher = new CollisionDispatcher(conf); SequentialImpulseConstraintSolver solver = new SequentialImpulseConstraintSolver(); dynamicsWorld = new DiscreteDynamicsWorld(dispacher, broadphase, solver, conf); BulletSharp.Math.Vector3 gravity = new BulletSharp.Math.Vector3(0, -10, 0); dynamicsWorld.SetGravity(ref gravity); }
public BspDemoSimulation() { CollisionConfiguration = new DefaultCollisionConfiguration(); Dispatcher = new CollisionDispatcher(CollisionConfiguration); Broadphase = new DbvtBroadphase(); World = new DiscreteDynamicsWorld(Dispatcher, Broadphase, null, CollisionConfiguration); World.Gravity = Up * -10.0f; LoadBspFile(); }
//C#ではstackにclassのメモリを確保できず、XBoxでは毎フレームヒープにメモリを取るとGCが作動しフレームオチするため //このクラスをnewせずに使うルーチンを製作。 public static void Process(DbvtBroadphase pbp, DbvtNode na, DbvtNode nb) { if (na != nb) { DbvtProxy pa = (DbvtProxy)na.data; DbvtProxy pb = (DbvtProxy)nb.data; #if DBVT_BP_SORTPAIRS if(pa->m_uniqueId>pb->m_uniqueId) btSwap(pa,pb); #endif pbp.m_paircache.addOverlappingPair(pa, pb); ++pbp.m_newpairs; } }
public DbvtTreeCollider(DbvtBroadphase p) { pbp = p; }