I'm currently converting the PhysX implementation to Bullet for my project but I have hit an issue. When I try to run world.StepSimulation(timeSinceLastFrame / 1000) I get an AccessViolationException. I have tried changing the objects added to the world to see if any of them were the issue but the error is always the same. I am using BulletSharp 2.8 SP1 (which I think is pretty much up to date with the current bullet release) and I am using c# which is different from the core bullet code but since there is no real forum for bulletsharp I thought I would try here. The world setup code is:
Code: Select all
CollisionConfiguration configuration = new DefaultCollisionConfiguration();
Dispatcher dispatcher = new CollisionDispatcher(configuration);
DbvtBroadphase broadphase = new DbvtBroadphase();
world = new DiscreteDynamicsWorld(dispatcher, broadphase, null, configuration);
world.Gravity = new Vector3(0, gravity, 0);
Code: Select all
ConvexShape capsule = new CapsuleShape(radius, modelHeight - radius * 2);
PairCachingGhostObject ghostObject = new PairCachingGhostObject();
Matrix4 worldTransform;
Matrix4.MakeTransform(characterNode.Position, Vector3.UnitScale, characterNode.Orientation, out worldTransform);
ghostObject.WorldTransform = worldTransform;
ghostObject.CollisionShape = capsule;
ghostObject.CollisionFlags = CollisionFlags.CharacterObject;
playerController = new KinematicCharacterController(ghostObject, capsule, 500f / scaleFactor);
world.AddCollisionObject(ghostObject, CollisionFilterGroups.CharacterFilter, CollisionFilterGroups.StaticFilter | CollisionFilterGroups.DefaultFilter);
world.AddAction(playerController);
Code: Select all
world.StepSimulation(timeSinceLastFrame / 1000);
Thanks,
Andrew.