Hi,
I'm developing a simple 3D soccer game with Ogre using OgreBullet wrapper. Now I'm trying to carry out the goals. I don't really know how to get collisions only where the wood is. To be honest, I don't have a good idea of how to implement the goals. Split it into 3 different meshes and hardcode their positions? I think there must be a much better solution.
I write this here because I wrote it in the OgreBullet forums with no answer for long time(http://www.ogre3d.org/addonforums/viewt ... 12&t=29680).
I need some clues please.
Thanks in advance
Simple soccer goal
-
- Site Admin
- Posts: 4221
- Joined: Sun Jun 26, 2005 6:43 pm
- Location: California, USA
Re: Simple soccer goal
One way is to approximate the goal posts using several cylinders (btCylinderShape) or convex hulls (btConvexHullShape). You could simulate the net using btSoftBody.
Are you using a 3d authoring tool, such as Maya or Blender? If so, you can assign the collision shapes and export a .bullet file, and use the btBulletWorldImporter to load it.
To detect if/where the ball hits the goal posts, you can use a contact added callback, or simply iterate over all contacts after the simulation is done.
For a contact callback example see Bullet/Demos/MultiMaterialDemo.
Are you using a 3d authoring tool, such as Maya or Blender? If so, you can assign the collision shapes and export a .bullet file, and use the btBulletWorldImporter to load it.
To detect if/where the ball hits the goal posts, you can use a contact added callback, or simply iterate over all contacts after the simulation is done.
For a contact callback example see Bullet/Demos/MultiMaterialDemo.
Code: Select all
static bool CustomMaterialCombinerCallback(btManifoldPoint& cp, const btCollisionObjectWrapper* colObj0Wrap,int partId0,int index0,const btCollisionObjectWrapper* colObj1Wrap,int partId1,int index1)
{
//handle the collision here
}
int main(...)
{
gContactAddedCallback = CustomMaterialCombinerCallback;
//enable contact callback
staticBody->setCollisionFlags(staticBody->getCollisionFlags() | btCollisionObject::CF_CUSTOM_MATERIAL_CALLBACK);
}
-
- Posts: 5
- Joined: Tue Oct 30, 2012 6:50 pm
Re: Simple soccer goal
Firstly thanks for the answer.
I'll start with the shape before having into account the collisions.
I'm using Blender. I didn't know anything about btBulletWorldImporter but it seems to be amazing.
I haven't found too much doc about it so I need some help:
- I just create the goal (without nets yet) in blender as one piece and following your youtube video I finally assign its collision bound to ConvexHull. But how to obtain the .bullet file from blender? I cannot find it anywhere.
Regards
I'll start with the shape before having into account the collisions.
I'm using Blender. I didn't know anything about btBulletWorldImporter but it seems to be amazing.
I haven't found too much doc about it so I need some help:
- I just create the goal (without nets yet) in blender as one piece and following your youtube video I finally assign its collision bound to ConvexHull. But how to obtain the .bullet file from blender? I cannot find it anywhere.
Regards
-
- Posts: 5
- Joined: Tue Oct 30, 2012 6:50 pm
Re: Simple soccer goal
I finally managed to export it... Ill post if any new doubt.
-
- Posts: 5
- Joined: Tue Oct 30, 2012 6:50 pm
Re: Simple soccer goal
Hi, I finished a simple goal (attached) in blender as a convex hull in order to test the physics export.
When I load it on Bullet Physics Editor I get what you can see in the attached screenshot.
Where is the problem?
Thanks in advance
When I load it on Bullet Physics Editor I get what you can see in the attached screenshot.
Where is the problem?
Thanks in advance
You do not have the required permissions to view the files attached to this post.