How to create customized bound with in space?

Official forum for the Chipmunk2D Physics Library.
Post Reply
royhpr
Posts: 5
Joined: Thu Feb 28, 2013 8:37 pm
Contact:

How to create customized bound with in space?

Post by royhpr »

Hi,

Please help me with this weir problem. I'm working on a iPad 5.1 project. The interface of my project is: a pallet (UIView) at the top of screen and a GameArea (ScrollView) below pallet. Inside GameArea, there are one ground (UIImageView) and one BackGround (UIImageView). Inside pallet, there are a few small items which you can drag it from pallet to GameArea. What I want to do is simulate a physics world in the GameArea only. Means, any item in the GameArea can have a gravity and it's bounced up when it collides with ground.

I have done everything step by step in the simple objective-chipmunk tutorial (http://chipmunk-physics.net/tutorials/S ... eChipmunk/). I tried to do something like this:

Code: Select all

space = [[ChipmunkSpace alloc] init];
	CGRect spaceBounds = CGRectMake(0, 60, 1024, 300);
	[space addBounds:spaceBounds thickness:10.0f elasticity:1.0f friction:1.0f layers:CP_ALL_LAYERS group:CP_NO_GROUP collisionType:borderType];
	space.gravity = cpvmult(cpv(0.0, 1.0), 100.0f);
Where, spaceBounds is a variable I use to set the space bound. But this didn't work at all. My question is what is the meaning of [space addBounds]? Is there any way I can set up my own walls in a iPad screen?
User avatar
slembcke
Site Admin
Posts: 4166
Joined: Tue Aug 14, 2007 7:13 pm
Contact:

Re: How to create customized bound with in space?

Post by slembcke »

Err I guess I was your Stack Overflow post first. -> http://stackoverflow.com/questions/1514 ... e/15149766

Edit: Lol -> "Err I guess I was your Stack Overflow post first" Should have read "Err I guess I saw your Stack Overflow post first"

Be one with the post.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
royhpr
Posts: 5
Joined: Thu Feb 28, 2013 8:37 pm
Contact:

Re: How to create customized bound with in space?

Post by royhpr »

slembcke wrote:Err I guess I was your Stack Overflow post first. -> http://stackoverflow.com/questions/1514 ... e/15149766
Please refer to stackoverflow forum for my doubts. Thanks!
Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests