Page 1 of 1

How to create customized bound with in space?

Posted: Thu Feb 28, 2013 8:59 pm
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?

Re: How to create customized bound with in space?

Posted: Thu Feb 28, 2013 10:11 pm
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.

Re: How to create customized bound with in space?

Posted: Fri Mar 01, 2013 12:29 am
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!