Posted: Thu May 10, 2007 9:10 am
I'm planning to release a public alpha in June.
It will be announced here.
It will be announced here.
wow nice... i will test it in any days...KleMiX wrote:First alpha is released
Code: Select all
private void shootBox(Vector3 destination)
{
...
CollisionShape boxShape = new BoxShape(Vector3.One);
RigidBody body = CreateRigidBody(mass, startTransform, boxShape);
...
}
Code: Select all
private void shootBox(Vector3 destination)
{
...
CollisionShape sphereShape = new SphereShape(1);
Vector3 halfExtents = new Vector3(1, 1, 2);
CollisionShape leftBoxShape = new BoxShape(halfExtents);
CompoundShape compoundShape = new CompoundShape();
compoundShape.AddChildShape(Matrix.Identity, sphereShape);
compoundShape.AddChildShape(Matrix.Identity, leftBoxShape);
RigidBody body = CreateRigidBody(mass, startTransform, compoundShape);
...
}
Code: Select all
public CompoundCollisionAlgorithm(CollisionAlgorithmConstructionInfo collisionAlgorithmConstructionInfo, CollisionObject bodyA,CollisionObject bodyB, bool isSwapped) : base(collisionAlgorithmConstructionInfo)
{
//Begin
_isSwapped = isSwapped;
CollisionObject collisionObject = isSwapped ? bodyB : bodyA;
CollisionObject otherObject = isSwapped ? bodyA : bodyB;
_childCollisionAlgorithms = new List<CollisionAlgorithm>(childrenNumber);
for (index = 0; index < childrenNumber; index++)
{
CollisionShape childShape = compoundShape.GetChildShape(index);
CollisionShape orgShape = collisionObject.CollisionShape;
collisionObject.CollisionShape = childShape;
_childCollisionAlgorithms[index] = collisionAlgorithmConstructionInfo.Dispatcher.FindAlgorithm(collisionObject, otherObject);
collisionObject.CollisionShape = orgShape;
}
}
Code: Select all
_childCollisionAlgorithms[index] = collisionAlgorithmConstructionInfo.Dispatcher.FindAlgorithm(collisionObject, otherObject);
Code: Select all
_childCollisionAlgorithms.Add(collisionAlgorithmConstructionInfo.Dispatcher.FindAlgorithm(collisionObject, otherObject));
Code: Select all
public override void ProcessCollision(CollisionObject bodyA, CollisionObject bodyB, DispatcherInfo dispatchInfo, ManifoldResult resultOut)
{
//Begin
CollisionObject collisionObject = _isSwapped ? bodyB : bodyB;
CollisionObject otherObject = _isSwapped ? bodyA : bodyB;
...
//Debug.Assert(collisionObject.getCollisionShape().isCompound());
BulletDebug.Assert(collisionObject.CollisionShape.IsCompound);
CompoundShape compoundShape = (CompoundShape)collisionObject.CollisionShape;
int childrenNumber = _childCollisionAlgorithms.Count;
for (int i = 0; i < childrenNumber; i++)
{
CompoundShape childShape = compoundShape.GetChildShape(i) as CompoundShape;
Matrix orgTransform = collisionObject.WorldTransform;
CollisionShape orgShape = collisionObject.CollisionShape;
Matrix childTransform = compoundShape.GetChildTransform(i);
Matrix newChildWorld = orgTransform * childTransform;
collisionObject.WorldTransform = newChildWorld;
collisionObject.CollisionShape = childShape;
_childCollisionAlgorithms[i].ProcessCollision(collisionObject, otherObject, dispatchInfo, resultOut);
collisionObject.CollisionShape = orgShape;
collisionObject.WorldTransform = orgTransform;
}
}
Code: Select all
CollisionObject collisionObject = _isSwapped ? bodyB : bodyA;
Code: Select all
CollisionShape childShape = compoundShape.GetChildShape(i) as CollisionShape;
Code: Select all
public override void ProcessCollision(CollisionObject bodyA, CollisionObject bodyB,DispatcherInfo dispatchInfo, ManifoldResult resultOut)
{
//Begin
CollisionObject collisionObject = _isSwapped ? bodyB : bodyA;
CollisionObject otherObject = _isSwapped ? bodyA : bodyB;
...
//Debug.Assert(collisionObject.getCollisionShape().isCompound());
BulletDebug.Assert(collisionObject.CollisionShape.IsCompound);
CompoundShape compoundShape = (CompoundShape)collisionObject.CollisionShape;
int childrenNumber = _childCollisionAlgorithms.Count;
for (int i = 0; i < childrenNumber; i++)
{
CollisionShape childShape = compoundShape.GetChildShape(i) as CollisionShape;
Matrix orgTransform = collisionObject.WorldTransform;
CollisionShape orgShape = collisionObject.CollisionShape;
Matrix childTransform = compoundShape.GetChildTransform(i);
Matrix newChildWorld = orgTransform * childTransform;
collisionObject.WorldTransform = newChildWorld;
collisionObject.CollisionShape = childShape;
_childCollisionAlgorithms[i].ProcessCollision(collisionObject, otherObject, dispatchInfo, resultOut);
collisionObject.CollisionShape = orgShape;
collisionObject.WorldTransform = orgTransform;
}
}