I am trying to make the edges of my window collidable, rather than having my shape drop through the floor on creation.
When I was looking through the demos on the site, I saw this line of code that was ment to define the bounds of the space:
[_space addBounds:CGRectMake(130, 139, 767, 1500) thickness:20 elasticity:1.0 friction:1.0 layers:PhysicsEdgeLayers group:CP_NO_GROUP collisionType:nil];
I think that this assigns collidable borders around the space, thus enclosing it.
Due to some minor knowledge in Objective-C, I know that addBounds is a method for space that allows to create the space border.
However, when looking through the ruby bindings for chipmunk, I was not able to find the AddBounds method.
Furthermore, in a related problem, I could not find the cpShapeSetFriction ruby equivilant.
Were can I find these methods, and If I can't, are there any alternatives?
For those who are wondering, There are no ruby bindings for the
addBounds
method.I got around this by creating four static segment shapes that made up the borders of my window.
Here are the segments you need to create the bounds.
Don't forget to add them to the space with
@space.add_static_shape(THE_SEGMENT)
Shape friction in ruby can be set with:
shape.u = 0.1 #Shape friciton of 0.1