Page 1 of 1

Density ans other things

Posted: Sun Dec 07, 2008 3:59 pm
by Dark
Hi,

I have to do a school project, and i decided to use Chipmunk.
I did manage to do some things but, for the moment:
- I don't know how we represent density in chipmunk
- i have to do a sort of balance that I use as a catapult(composed a triangle(static object) and 3 lines(object) to project balls) . I want that my object to be on the top of the triangle. Do i have to do like that:

Code: Select all

static cpBody* make_support(cpFloat x, cpFloat y){
  int num=4;
  cpVect* test=transforme_ligne(-170,0,100,0,10);
  cpVect* test2=transforme_ligne(-170,0,-170,60,3);
  cpVect* test3=transforme_ligne(100,0,130,60,3);
  cpBody* body=cpBodyNew(10.0,cpMomentForPoly(0.2,num,test,cpvzero));
  body->p=cpv(x,y);
  cpSpaceAddBody(space,body);
  shape=cpPolyShapeNew(body,num,test,cpvzero);
  shape->e=0.8;shape->u=0.8;
  cpSpaceAddShape(space,shape);
  shape=cpPolyShapeNew(body,num,test2,cpvzero);
  shape->e=0.8;shape->u=0.8;
  cpSpaceAddShape(space,shape);

  shape=cpPolyShapeNew(body,num,test3,cpvzero);
  cpSpaceAddShape(space,shape);
  
  return body;
}
I hope you will understand my "english"
Thx for your help.
Dark

Re: Density ans other things

Posted: Tue Dec 09, 2008 3:16 pm
by Dark
up ?
Sorry but i have no answers, anyone know how setting the density when you have moment of inertia ?
Dark

Re: Density ans other things

Posted: Thu Dec 11, 2008 5:20 am
by spiderman
Good Morning,

I have to do the same project than dark and I think the moment of inertia is linked with the density but on chipmunk, I don't know how to use the density too.

We have to finish the project the next monday morning and we need help to solve this problem.

Sorry for my bad english thanks for your future help.

Re: Density ans other things

Posted: Sat Dec 13, 2008 2:35 pm
by maximile
In Chipmunk you set the mass of a body rather than the density. You set it with body->m. If you only know the density you'll have to work out the mass from the size of the shape.

Re: Density ans other things

Posted: Wed Dec 17, 2008 6:00 pm
by spiderman
If I understood, the density is useful to obtain the mass when whe don't know it.

thank you for your help.