[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4762: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3897)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4764: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3897)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4765: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3897)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4766: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3897)
Chipmunk Physics • View topic - "Disabling" ChipmunkShape collision when touched?

"Disabling" ChipmunkShape collision when touched?

Official forum for the .

"Disabling" ChipmunkShape collision when touched?

Postby neigaard » Tue Sep 18, 2012 4:25 am

I have some ChipmunkShape's that act as platforms where different ChipmunkObject's can "land" on. I am using the brilliant ChipmunkMultiGrab to be able to move those objects around, but for some of those platforms (most of them but not all of them) I want to be able to drag the objects right through them as if they did not exist, so they should stop existing but only for the objects that are being dragged, and as soon as I let go of the object they should interact as normal.

Is there a way to do this? I was thinking about using different collision types and changing those types for the dragged object runtime, but will that work and how? Can I get a notification on the objects that are dragged or do I have to find that my self?

Thank you
Søren
neigaard
 
Posts: 36
Joined: Tue Oct 25, 2011 7:38 am

Re: "Disabling" ChipmunkShape collision when touched?

Postby slembcke » Tue Sep 18, 2012 9:42 am

Hmm. So the best way to do it might be to switch out the shape's collision type with one that has a begin callback that returns FALSE. That way any object that it's colliding with when it is dragged it will continue to pass through. If you drag it halfway through another shape and release it, it won't suddenly pop out. If you don't care about the popping, you can set the layers bitmask to 0, then it won't collide with anything.

In order to do that, you'll need to know when your shape is grabbed or released in order to change the collision type or layers. I'll whip up a change quick this morning that will let you do that. Actually somebody else asked to have a similar feature implemented a couple weeks ago and I totally forgot about it. :-\ Oops. I'll have to dig through my email and see if I can find them.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
User avatar
slembcke
Site Admin
 
Posts: 4164
Joined: Tue Aug 14, 2007 7:13 pm

Re: "Disabling" ChipmunkShape collision when touched?

Postby neigaard » Tue Sep 18, 2012 12:39 pm

That sounds great! Look forward to the change that will let me know when a object is grabbed/released :)

Thank you
Søren
neigaard
 
Posts: 36
Joined: Tue Oct 25, 2011 7:38 am

Re: "Disabling" ChipmunkShape collision when touched?

Postby neigaard » Fri Sep 21, 2012 2:26 am

slembcke have you had time to whip up a change for me?

Thank you
Søren
neigaard
 
Posts: 36
Joined: Tue Oct 25, 2011 7:38 am

Re: "Disabling" ChipmunkShape collision when touched?

Postby slembcke » Fri Sep 21, 2012 12:16 pm

No I haven't done it yet, sorry. This has been sort of a bad week for me. Starting it right now though.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
User avatar
slembcke
Site Admin
 
Posts: 4164
Joined: Tue Aug 14, 2007 7:13 pm

Re: "Disabling" ChipmunkShape collision when touched?

Postby slembcke » Fri Sep 21, 2012 1:15 pm

I pushed the changes to the ChipmunkPro git repository. There are instructions to check it out on the downloads page if you need them. http://chipmunk-physics.net/downloads.php

What I changed is that the beginLocation:, updateLocation: and endLocation: methods all return a ChipmunkGrab object if the touch is tracking a grabbed shape. From the ChipmunkGrab, you can get the latest touch location, the grabbed shape and I also added a user data pointer for anything else you might want to track along with the touch.

So for you, if beginLocation: returns a grab, change the collision info on that shape (maybe cache the original data using the ChipmunkGrab.data pointer if it's not constant), then when endLocation: returns a grab, reset it.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
User avatar
slembcke
Site Admin
 
Posts: 4164
Joined: Tue Aug 14, 2007 7:13 pm

Re: "Disabling" ChipmunkShape collision when touched?

Postby neigaard » Tue Sep 25, 2012 4:00 am

I get a error when trying to fetch from the git repository for Chipmunk Pro, I get the following error:

error: The requested URL returned error: 401 (curl_result = 22, http_code = 401, sha1 = 0ca4d05c64f5775c35b95c2c3eb696b1164983f8)
error: Unable to find 0ca4d05c64f5775c35b95c2c3eb696b1164983f8 under http://chipmunkPro014@chipmunk-physics. ... unkPro.git
Cannot obtain needed object 0ca4d05c64f5775c35b95c2c3eb696b1164983f8
while processing commit 528d4e0611829cf7a2d29bb6a1a8e463c44adbdd.
error: Fetch failed.

I am using this command:
git clone --recursive http://MyUser@chipmunk-physics.net/rele ... unkPro.git

Thank you
Søren
neigaard
 
Posts: 36
Joined: Tue Oct 25, 2011 7:38 am

Re: "Disabling" ChipmunkShape collision when touched?

Postby slembcke » Tue Sep 25, 2012 4:59 am

An HTTP 401 status is an authentication error. Are you sure you entered the login information correctly including replacing the "MyUser" placeholder?
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
User avatar
slembcke
Site Admin
 
Posts: 4164
Joined: Tue Aug 14, 2007 7:13 pm

Re: "Disabling" ChipmunkShape collision when touched?

Postby neigaard » Mon Oct 08, 2012 7:51 am

I have been away from this for a while, but Im on it again :)

When you say I should switch out the shape's collision type with one that has a begin callback that returns FALSE, then how should I do that? Simply create a NSObject with a method named "begin" that returns FALSE?

And the other method you talk about, set the layers bitmask to 0, what layer is that?

Thank you
Søren
neigaard
 
Posts: 36
Joined: Tue Oct 25, 2011 7:38 am

Re: "Disabling" ChipmunkShape collision when touched?

Postby neigaard » Wed Oct 10, 2012 2:02 am

neigaard
 
Posts: 36
Joined: Tue Oct 25, 2011 7:38 am

Next

Return to Chipmunk2D Physics

Who is online

Users browsing this forum: No registered users and 2 guests