Spatial Queries

Official forum for the Chipmunk2D Physics Library.
Post Reply
goruka
Posts: 2
Joined: Fri Oct 24, 2008 4:31 pm
Contact:

Spatial Queries

Post by goruka »

Hi! Is there any way to do spatial queries in chipmunk? like.. send a polygon, circle, segmet, etc, and get the bodies touching them.. i need this to send "events" between objects in a game.
Also, is there otherwise any way to configure a shape added as only collision, to not be collidable but receive information
when some other object is touching it?

Thanks!
ker
Posts: 56
Joined: Tue Jul 15, 2008 4:13 am
Contact:

Re: Spatial Queries

Post by ker »

To your first question, I have no idea. I only know of point-requests, I guess it should work if you create a noncollision shape (with callback that returns false) and a body for a single step and remove it afterwards... but that's kinda annoying because it doesn't really allow you to do anything this very step.

The second question is fairly easy, you can create collision pair functions that return false for the given shapes. You might need to modify the default collision function for "any to x" collisions. If I remember correctly you can only do "x to y" collisions. (x and y beeing the types you defined)
User avatar
slembcke
Site Admin
Posts: 4166
Joined: Tue Aug 14, 2007 7:13 pm
Contact:

Re: Spatial Queries

Post by slembcke »

Yes, you are going to want to use a collision pair function. I don't have the API set up yet to do a spatial query based on anything other than points at the moment.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests