Is there any API for query area in the world with a shape ?
for example, i use bullet in the server and use bullet's collision detection the find which objects would be seen by a client and i use an sphere to stand for a client's view.
how can i achieve this ?
thanks~
Is there any API for query area in the world with a shape ?
-
- Posts: 11
- Joined: Tue Apr 24, 2007 6:20 am
-
- Posts: 27
- Joined: Fri Apr 20, 2007 7:29 pm
- Location: Germany
-
- Posts: 11
- Joined: Tue Apr 24, 2007 6:20 am
-
- Posts: 27
- Joined: Fri Apr 20, 2007 7:29 pm
- Location: Germany
well i never tried this
you can take a look in OPAL's source code, there is a volume sensor implemented
link: http://ox.slug.louisville.edu/~o0lozi01 ... /Main_Page
you can take a look in OPAL's source code, there is a volume sensor implemented
link: http://ox.slug.louisville.edu/~o0lozi01 ... /Main_Page
-
- Site Admin
- Posts: 4221
- Joined: Sun Jun 26, 2005 6:43 pm
- Location: California, USA
There are several ways to do this within Bullet. The Blender game engine allows to do such 'collision sensors'.
Two ways:
- Add a rigidbody/collision object with collision shape and disable the collision response:
Then check for contact points with this rigidbody (see CollisionInterfaceDemo how to find contacts) or add a collision callback for this object.
- Do a convex cast, this lets you find the first time of impact when moving an object along a path. This is similar to a raycast, but instead of a ray you can use a convex object (like sphere, box, cylinder etc). There is not a good interface in the btCollisionWorld at the moment, but it would be a small change to turn the raycast into an 'object cast'.
A good demo how to do this is lacking indeed, it would be useful to add this.
Thanks,
Erwin
Two ways:
- Add a rigidbody/collision object with collision shape and disable the collision response:
Code: Select all
rbody->setCollisionFlags(rbody->getCollisionFlags() | btCollisionObject::CF_NO_CONTACT_RESPONSE);
- Do a convex cast, this lets you find the first time of impact when moving an object along a path. This is similar to a raycast, but instead of a ray you can use a convex object (like sphere, box, cylinder etc). There is not a good interface in the btCollisionWorld at the moment, but it would be a small change to turn the raycast into an 'object cast'.
A good demo how to do this is lacking indeed, it would be useful to add this.
Thanks,
Erwin
Last edited by Erwin Coumans on Sat Jun 02, 2007 2:33 pm, edited 1 time in total.
-
- Posts: 198
- Joined: Mon Sep 04, 2006 5:31 pm
- Location: Switzerland
I didn't know this works in Bullet ( maybe the version I have is too old :O ). So far I did my own collision detection to do AI testing. So this convex casting gives you all the informations I need for my AI routines?
- Time To Impact
- Impact Normal
- Collision Response Callback ( to check if something can collide with each other )
- Hit Face ( so what triangle I hit in a mesh if a mesh is hit )
- Time To Impact
- Impact Normal
- Collision Response Callback ( to check if something can collide with each other )
- Hit Face ( so what triangle I hit in a mesh if a mesh is hit )
-
- Site Admin
- Posts: 4221
- Joined: Sun Jun 26, 2005 6:43 pm
- Location: California, USA
Yes, this is all available in Bullet, but there is no easy interface for that. So for next version, I'll try to add a user-friendly interface for AI queries, with the following properties:I didn't know this works in Bullet ( maybe the version I have is too old :O ). So far I did my own collision detection to do AI testing. So this convex casting gives you all the informations I need for my AI routines?
Yes- Time To Impact
Yes- Impact Normal
Yes- Collision Response Callback ( to check if something can collide with each other )
Yes
- Hit Face ( so what triangle I hit in a mesh if a mesh is hit )
Hope this helps,
Erwin
-
- Posts: 198
- Joined: Mon Sep 04, 2006 5:31 pm
- Location: Switzerland