Bullet on XNA
-
- Posts: 19
- Joined: Tue Sep 19, 2006 6:38 pm
-
- Posts: 3
- Joined: Wed May 09, 2007 7:34 am
-
- Posts: 3
- Joined: Wed May 09, 2007 7:34 am
wow nice... i will test it in any days...KleMiX wrote:First alpha is released
-
- Posts: 1
- Joined: Fri Jul 13, 2007 4:06 pm
I'm not exactly sure where to post fixes to or issues with XNA Bullet so I'll put it here.
My name is Bob Schade and I've been working with Mike Skolones on an XNA game that uses the XNA Bullet SDK. We noticed that compounds were broken in the currently build and figured out what the fix is.
First of all, you can reproduce the problem by having the demo games shoot a compound rather than a box, so in DemoGame.cs, change these lines of code:
to this:
...so the user fires a compound object rather than a simple box. If you run the Constraint Demo and fire the compound object at one of the jointed boxes, you will get an "index out-of-range" in the CompoundCollisionAlgorithm() function in CompoundCollisionAlgorithm.cs.
The index out of range error occurs at this line:
You can't add to the List object with an assignment operator, you need to use the List's Add() function, so this line needs to be changed to this:
After you make this change, there are other errors in the ProcessCollision() function in CompoundCollisionAlgorithm.cs.
First "collisionObject" needs to be "bodyA" when "otherObject" is "bodyB".
Next the "childShape" needs to be a "CollisionShape", rather than a "CompoundShape".
So the whole thing should look like this:
This gets compounds working, at least so it doesn't crash. I'll let you know what else we find out about them.
All for now,
Bob
My name is Bob Schade and I've been working with Mike Skolones on an XNA game that uses the XNA Bullet SDK. We noticed that compounds were broken in the currently build and figured out what the fix is.
First of all, you can reproduce the problem by having the demo games shoot a compound rather than a box, so in DemoGame.cs, change these lines of code:
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;
}
}
All for now,
Bob
-
- Posts: 2
- Joined: Thu Sep 20, 2007 5:18 pm
Re: Bullet on XNA
Anyone knows when the vehicledemo will be ported to xna, with the implementation to the raycast and wheel class.
thx.
thx.
-
- Posts: 2
- Joined: Sun Nov 25, 2007 4:09 am
RaycastVehicle.cs ported
Number6, I noticed the same issues - wish I'd seen your post before I debugged them
osknoes, and everyone: I have finished a quick port of the Raycast Vehicle functionality (btRaycastVehicle.cpp/.h to RaycastVehicle.cs). Along the way I found a few bugs in XNA, including the compound collision objects mentioned above, and also some ray cast issues (not yet fixed). The ray cast bug is a bit of a showstopper for Raycast Vehicle, as it prevents you from using the Raycast Vehicle on rotated boxes (which leaves you with, well, flat surfaces). I have not yet been able to fix that bug, and have no current plans to, but all the best to anyone who tries to fix it, and please send me the fix!
You can download the patch here, apply it to the BulletX\Source\XnaDevRu.BulletX directory.
Patch includes several other bugfixes. You can download just the vehicle classes here, but if you do - be sure to apply the other fixes included in the .diff.
I have also submitted the fix to the xnadevru patch site. Someone else has posted the port for HeightFieldTerrainShape there, the two patches could be used in conjunction quite nicely, assuming the ray casts work with HeightFieldTerrainShape (I might give it a crack, and see how I go).
This code hasn't been rigorously tested, nor is there a test case provided (you will need to port your own from the bullet-2.53 VehicleDemo sample, fortunately this is fairly easy).
Good luck!
Cheers,
Will
osknoes, and everyone: I have finished a quick port of the Raycast Vehicle functionality (btRaycastVehicle.cpp/.h to RaycastVehicle.cs). Along the way I found a few bugs in XNA, including the compound collision objects mentioned above, and also some ray cast issues (not yet fixed). The ray cast bug is a bit of a showstopper for Raycast Vehicle, as it prevents you from using the Raycast Vehicle on rotated boxes (which leaves you with, well, flat surfaces). I have not yet been able to fix that bug, and have no current plans to, but all the best to anyone who tries to fix it, and please send me the fix!
You can download the patch here, apply it to the BulletX\Source\XnaDevRu.BulletX directory.
Patch includes several other bugfixes. You can download just the vehicle classes here, but if you do - be sure to apply the other fixes included in the .diff.
I have also submitted the fix to the xnadevru patch site. Someone else has posted the port for HeightFieldTerrainShape there, the two patches could be used in conjunction quite nicely, assuming the ray casts work with HeightFieldTerrainShape (I might give it a crack, and see how I go).
This code hasn't been rigorously tested, nor is there a test case provided (you will need to port your own from the bullet-2.53 VehicleDemo sample, fortunately this is fairly easy).
Good luck!
Cheers,
Will
-
- Posts: 3
- Joined: Fri Mar 21, 2008 4:04 pm
Re: Bullet on XNA
Hi,
Does anyone know if this project is still active? I went to their codeplex site and the last update was sometime 2007.
Thanks,
David
Does anyone know if this project is still active? I went to their codeplex site and the last update was sometime 2007.
Thanks,
David
-
- Posts: 225
- Joined: Wed Jan 07, 2009 11:43 am
- Location: London
Re: Bullet on XNA
Don't think it is, I've submitted a few patches to it but never seen any updates for ages apart from a comment about them working on a new project.
-
- Posts: 19
- Joined: Tue Sep 19, 2006 6:38 pm
Re: Bullet on XNA
Sorry, haven't time for the project.
But I've applied some patches and was making new version... I think I will release it in next few months...
But I've applied some patches and was making new version... I think I will release it in next few months...
-
- Posts: 1
- Joined: Mon Apr 20, 2009 12:52 pm
Re: Bullet on XNA
Hello All
New Here, so please be kind.
So the bullet 2.74 Bulletx is now in the Extras\obsolete folder
is this project dead or if there is a new version what is the name if has changed, or what info is there for it
also will the new version work with code that I create with the "current version"
Thanks
New Here, so please be kind.
So the bullet 2.74 Bulletx is now in the Extras\obsolete folder
is this project dead or if there is a new version what is the name if has changed, or what info is there for it
also will the new version work with code that I create with the "current version"
Thanks
-
- Posts: 25
- Joined: Wed Jan 23, 2008 11:28 am
Re: Bullet on XNA
Hello All.
Unfortunately BulletX seems died.
I'm not sure that game industry needs .NET Bullet port, so I want to know community opinion about this.
Reason to ask this is that I have much Bullet code ported on C# during a few last years, it was done for investigation, and it works. However big work should be done here to provide possibility to use it in XNA based games. And help from good people will be needed
Mostly due to ownership reasons I don't want to make this work inside BulletX project, but want to create new.
So, what is your opinion? Do we need this?
Unfortunately BulletX seems died.
I'm not sure that game industry needs .NET Bullet port, so I want to know community opinion about this.
Reason to ask this is that I have much Bullet code ported on C# during a few last years, it was done for investigation, and it works. However big work should be done here to provide possibility to use it in XNA based games. And help from good people will be needed
Mostly due to ownership reasons I don't want to make this work inside BulletX project, but want to create new.
So, what is your opinion? Do we need this?
-
- Posts: 72
- Joined: Wed Feb 24, 2010 9:49 pm
Re: Bullet on XNA
I'll be working on a wrapper for XNA and SlimDX:
https://code.google.com/p/bulletsharp/
The focus is on SlimDX for now, because that's what I need it for, so if you need examples for XNA, then you'll have to wait a bit or make your own, but the library itself is fully compatible with XNA.
Ihar3d, I think there's no reason to abandon your project if there's already a lot of work done. I'm sure if you make it a public project, then a lot of people will be willing to help out. If you pick a license such as MIT or BSD, then you can still apply your copyright on it and maintain ownership to a large extent. BulletX can be used as a reference as long as you don't copy-paste large portions of it to your own project.
https://code.google.com/p/bulletsharp/
The focus is on SlimDX for now, because that's what I need it for, so if you need examples for XNA, then you'll have to wait a bit or make your own, but the library itself is fully compatible with XNA.
Ihar3d, I think there's no reason to abandon your project if there's already a lot of work done. I'm sure if you make it a public project, then a lot of people will be willing to help out. If you pick a license such as MIT or BSD, then you can still apply your copyright on it and maintain ownership to a large extent. BulletX can be used as a reference as long as you don't copy-paste large portions of it to your own project.
-
- Posts: 8
- Joined: Wed Feb 09, 2011 5:48 pm
Re: Bullet on XNA
Hi guys,
How is Bullet's situation in XNA?
Any news? Any change?
How is Bullet's situation in XNA?
Any news? Any change?
-
- Posts: 72
- Joined: Wed Feb 24, 2010 9:49 pm
Re: Bullet on XNA
BulletSharp is pretty much done. There are some corner case uses that need testing or implementing, but otherwise it's totally usable and I've also optimized it quite a bit.
There's still just one basic XNA demo, because I don't care much about that target, but all of the functionality is available, so it shouldn't be a problem.
There are 12 working C# demos for SlimDX, which are reimplementations of Bullet's own demos. Those are the best resources for learning. I plan to make more.
Since BulletSharp is a wrapper for unmanaged code, then it won't work on the Xbox or Windows Phone 7. An up-to-date managed port of Bullet would be awesome and I hope someone will make one, although using the GPU for physics computation will probably be much harder then.
Anyway, I encourage you to try it out, post bug reports and do cool things with it
There's still just one basic XNA demo, because I don't care much about that target, but all of the functionality is available, so it shouldn't be a problem.
There are 12 working C# demos for SlimDX, which are reimplementations of Bullet's own demos. Those are the best resources for learning. I plan to make more.
Since BulletSharp is a wrapper for unmanaged code, then it won't work on the Xbox or Windows Phone 7. An up-to-date managed port of Bullet would be awesome and I hope someone will make one, although using the GPU for physics computation will probably be much harder then.
Anyway, I encourage you to try it out, post bug reports and do cool things with it