Helo,
I am using chipmunk as a physics engine in my game. The problem is I now want to free all the children and then the space itself, so I can create a new space for the new level. I tried this:
cpSpaceFreeChildren(space);
cpSpaceFree(space);
But it does not work and fails in:
cpHashSetReject(cpHashSet *set, cpHashSetRejectFunc ...
How I can use this function
Im try but there are error or warning
setupchipmunk(){
........
}
update(){
if(touch==true){
cpBodyApplyForce(body1,cpv(val1,val2),cpv(val3,val4));
}
}
when touch begin in console I found this error
warning: Ignored unknown object module at 0x0 with type 0x5dd334
warning: Couldn't find minimal sy...
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include "/home/satyajit/Chipmunk-5.2.0/include/chipmunk/chipmunk.h"
#include "drawSpace.h"
#include "ChipmunkDemo.h"
cpSpace *space;
cpBody *staticBody;
int i;
static void
update(int ticks)
{
int steps = 3;
cpFloat dt = 1.0f/60.0f/(cpFloat)steps;
for( i=0; i<steps;...
I have a body which I move with the help of a button,here is what Im doing
-(void) step: (ccTime) delta
{
int steps = 2;
CGFloat dt = delta/(CGFloat)steps;
for(int i=0; iactiveShapes, &eachShape, nil);
cpSpaceHashEach(space->staticShapes, &eachShape, nil);
if(MoveBody)
{
cpFloat movementPadding = 0.1;
cpBodyApplyForce(body,...
Has anyone had experience with implementing car physics in chipmunk? Here's an example in Box2d:
http://www.emanueleferonato.com/2009/04/06/two-ways-to-make-box2d-cars/
I'd like to port that over to chipmunk.
...
I just have a simple sprite - how can I get it to rotate?
A good answer would show how to rotate both a dynamic sprite and a static_mass sprite
...
I have two static (STATIC_MASS) SpaceManager sprites. One is a child of the other - by which I mean that one sort of builds up the other one, but although the child's images shows up in the right place, the child doesn't seem to exists in the chipmunk physics engine, like I would expect. In my case, I have a backboard (rectangular spri...
If I have two objects in chipmunk (I'm using cocos2d-iphone), once I've detected that they collided, how can I tell how hard they are hitting each other?
I want their force (vs. the velocity) to know the damage of the collision.
I've seen discussion about how to do this, but never concrete working code (and I couldn't get it work, ev...
Hello all!
I have a simple project built with Cocos2D and Chipmunk. So far it's just a Ball (body, shape & sprite) bouncing on the Ground (a static line segment at the bottom of the screen).
I implemented the ccTouchesBegan/Moved/Ended methods to drag the ball around.
I've tried both:
cpBodySlew(ballBody, touchPoint, 1.0/60.0f);
and
...
I'm making an iPhone game where the main actor is a ball that rolls depending on the device's accelerometer rotation.
I haven't started on this part of the coding yet, but I was wondering if you guys had a nice way of solving this:
I tried looking a little into chipmunk, and I noticed that bodies have the property v, which is a point c...
Using spacemanager, I need to perform an action on select bodies after each step, so I figured that defining my own C function for iterateFunc would be the way to go.
Everything works great, except I'm not sure how to then call an obj c method in the same class. In other words, an obj c class contains both the c function replacing itera...
Hello.
I'm using Chipmunk 5 for iPhone, with Cocos2D. Upon collision between two specific objects I'd like to run a method which checks the velocity of that collision, if it's over x it runs one set of code, if it's under x it runs another.
Now, I understand the basics but I can't work out the code to run a method on collision detecti...
Hello.
For school I have to make a game for my iPod touch, I chose to do an asteroids game. I have just started with cocos2d but have read the wenderlich blog. I wanted to use chipmunk in my game, i want realisitc motion of the ship. Is there a tutorial on creating the asteroids motion?
Thanks.
...
I'm trying to create a squishy ball with Cocos2d and Chipmunk (via SpaceManager) using a bunch of rects all chained together then joined with springs to a central body.
Something like these examples
But in order to do this, i think I need to store all the cpShapes in an array after I've created them so I can then loop through the arra...
Hi, I have a projectile that I would like to pass through specific coordinates at the apex of its path. I have been using a superb equation that giogadi outlined here, by plugging in the velocity values it produces into chipmunk's cpBodyApplyImpulse function.
The equation has one drawback that I haven't been able to figure out. It onl...
I'm creating a static shape in chipmunk (using SpaceManager) and attaching a cpCCSprite to it.
However, I need the anchor point of the sprite to be off center, but when I change the anchor point of the sprite, the shape & sprite no longer align.
So if I change the anchor point like this
[sprite setAnchorPoint:ccp(0.5, 0.3)];
The spr...
Hello.
I'm using Chipmunk with SpaceManager inside of Cocos2D. I have a body which is moving around with impulses, I'd like to be able to use that bodies location to drive a parallax node in Cocos2D.
So, when body 'a' moves to the left, the parallax follows but with a small time offset, or elastic effect. If you know AS3 and Flash, y...
Hi everybody !
I am facing a problem using chipmunk and iPhone accelerometer. Indeed, I defined a ball shape and body :
ballBody = cpBodyNew(100.0, INFINITY);
ballBody->p = cpv(160, 240);
cpSpaceAddBody(space, ballBody);
cpShape *ballShape = cpCircleShapeNew(ballBody, 20.0, cpvzero);
ballShape->e = 0.5;
ballShape->u = 0.8;
ballSha...
Hello.
I'm using Cocos2D, SpaceManager and Chipmunk. I have a parallax node with 4 layers on it, this is tied to the location of a playable chipmunk body. This body needs to collide with static objects on one of the parallax layers, the static bodies must start off screen then move into screen and collide.
I know you are not supposed...
First, sorry for my English, im not an American. My question is how can I remove the shape and body from the space, this isn't related with collision detection. Im triying to do this with a touch event, specifically I'm trying to clear a ball Touching it (I have a lot of balls in the space), but I have no idea how to do it, I have been l...