[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 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/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/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 - chipmunk collision for falling HERO effect

chipmunk collision for falling HERO effect

Official forum for the .

chipmunk collision for falling HERO effect

Postby sunflower » Tue Apr 13, 2010 10:21 am

HI,


I have developing one simple game for iphone using chipmunk and cocos2d in which my HERO is falling from top of the building. And to give falling effect i am using "ScaleTo" Action on sprite. Now, I want to detect the collision with moving object under the building. I am using chipmunk for collision detection. I have attached shape to both objects ( HERO and Moving object). But the problem is because HERO (which is falling down) and moving object sometimes gets into same x,y coordinate while ball is falling so chipmunk detects collision multiple times. I want collision to be detected once HERO reaches to bottom of building.
or what i want is when ScaleTo action finished than only, chipmunk should detect collision or execute collision logic.

I tried using BOOL flag which i am setting on ScaleTo callback and check that flag on collision (if its set than only perform action) but still chipmunk detect collision at-least twice.

I want to know that am I doing something wrong or is there any easier way to do show that HERO is falling and when it reaches bottom of the building it detects collision with other object.

Please help me on this. I am stuck with this. I would really appreciate.

Thanks
Sunflower
Last edited by sunflower on Tue Apr 13, 2010 11:34 am, edited 1 time in total.
sunflower
 
Posts: 13
Joined: Wed Jan 20, 2010 12:54 pm

Re: chipmunk collision for falling HERO effect

Postby slembcke » Tue Apr 13, 2010 10:27 am

I guess it depends on which version of Chipmunk you are using. Chipmunk 4.x only had a single collision callback that was called every frame that things were touching. Chipmunk 5.x has a much broader set of collision events including a callback that is called only when objects first start touching.
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: chipmunk collision for falling HERO effect

Postby sunflower » Tue Apr 13, 2010 10:38 am

I am using 5.x. I guess you don't understand my question.

The game has top view (landscape) so you see everything from top ( like palne) and you see that HERO is standing on the building and there is moving object at the ground so i want the jump that hero on that moving object. but in reality when hero jump on that object both are in same X, Y cordinates. so chipmunk detects the collision and it detects multiple times until HERO reaches the ground/bottom and i remove hero from screen.

So, what i want that once it should detect collision only when HERO reaches ground.

I hope that makes you understand the question.

thanks
sunflower
sunflower
 
Posts: 13
Joined: Wed Jan 20, 2010 12:54 pm

Re: chipmunk collision for falling HERO effect

Postby slembcke » Tue Apr 13, 2010 12:07 pm

So the objects overlap in x and y, but you want Chipmunk to ignore the collision until they have the same z? Chipmunk is strictly a 2D physics engine, so it doesn't know anything about z values though you can give it clues.

Little Big Planet for the PS3 looks as though it also has strictly 2D physics, but has layers for the collisions. You could use the Chipmunk shape's layers property to fake the 3D in this way as well. Only set the bit for the layer on your hero when his z value is in a certain range.
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: chipmunk collision for falling HERO effect

Postby sunflower » Tue Apr 13, 2010 12:57 pm

Hi,

Thanks for quick response. Yes go that right.

I have no idea about cpLayer. I tried to look into it but couldn't find any documentation. Do you know any sample code or documentation about getting understanding of shape's layer?

i really appreciate your help.

Thanks
Sunflower
sunflower
 
Posts: 13
Joined: Wed Jan 20, 2010 12:54 pm

Re: chipmunk collision for falling HERO effect

Postby slembcke » Tue Apr 13, 2010 1:37 pm

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: chipmunk collision for falling HERO effect

Postby sunflower » Wed Apr 14, 2010 3:14 pm

HI,

I tried to read through wiki page but still i am confused how to use the layer for it. I would really appreciate if you can give me some more information about and how i can implement in my case.

I am stuck with it.

Thanks
Sunflower
sunflower
 
Posts: 13
Joined: Wed Jan 20, 2010 12:54 pm

Re: chipmunk collision for falling HERO effect

Postby Tam Toucan » Wed Apr 14, 2010 6:20 pm

User avatar
Tam Toucan
 
Posts: 141
Joined: Tue Jun 23, 2009 4:26 pm

Re: chipmunk collision for falling HERO effect

Postby sunflower » Fri Apr 16, 2010 10:06 am

Thanks Tam for taking time and posting reply. I really appreciate it.
You understand correct. Let me make is some clear for you.
I am using Cocos2d and chipmunk. I am achieve falling effect using Cocos2d Scale-to Action. So it looks like HERO is going down. So before i do Scale-to i set bool to FALSE and when this Action finished i set bool to TRUE and remove that HERO from screen and set bool again to FALSE and in between chipmunk detects the collision twice. What i am thinking is it might be because of frame-rate, which is is 1/60 so before I HERO remove from screen and set bool to False collision get called twice.

Let me know if that makes sense to you. I can post code if you want.

I really appreciate your help.

Thanks
Sunflower
sunflower
 
Posts: 13
Joined: Wed Jan 20, 2010 12:54 pm

Re: chipmunk collision for falling HERO effect

Postby Tam Toucan » Fri Apr 16, 2010 10:54 am

Yeah I think some code would be handy. I'll post a bunch of stuff to show what kind of info I'm looking for.

First. Let's see if I'm clear on the sceanrio. The game is top down. The Hero is ontop of a building (say a square). When they faill off the top of the building (move off the square) you use scaleTo to reduce the size of the sprite as they fall. Moving along the ground there is some object (say a square net). If at the end of the scaleTo action they are colliding with the moving object then you want to do something (say, not kill the player).

What I don't understand is your description of the bool. You say you set the bool to true when the action finishes (so do mean you set it in the update method when the t param is 1? You remove the hero, does that effect the chipmunk object (e.g. data member points to something that's gone)? Then you set it to false (when?) and in-between (need to know what code is run "in-between"). Also how is the bool begin used?

Here's what I thought you would be doing. To ensure collisions between the hero and the moving object are ignored until the scaleTo action has finished (hero has hit the ground) the hero as a bool "hitGround" which is only set to true when the scaleTo action finishes. The collision handler for the hero and the moving object checks this bool and ignores the collision unless true.
User avatar
Tam Toucan
 
Posts: 141
Joined: Tue Jun 23, 2009 4:26 pm

Next

Return to Chipmunk2D Physics

Who is online

Users browsing this forum: No registered users and 4 guests

cron