Hi all,
I’ve been searching around the internet for a while now, but couldn’t find a solution to the following problem:
In box2d for Processing, I’d like to calculate the impact of a contact in order to modify certain parameters of a sound (e.g. its level). I’ve realized that Fisica has a class named FContactResult – is there anything comparable, ready-to-go, in box2d for Processing?
The thing is, I would like both angular velocity and linear velocity to be taken into account when calculating the impact force.
I’ve posted some of my code below (it’s based on – what else – Daniel Shiffman’s fantastic tutorials). I’ve also marked the spot where I’d guess the essential lines have to go. As you’ll see, I’ve even managed to get the “manifold”, though I don’t know how to go on from there.
Any tips and/or hints to useful resources are appreciated.
Many thanks in advance &
all the best to everybody
ilinx
void beginContact(Contact cp){
Fixture f1 = cp.getFixtureA();
Fixture f2 = cp.getFixtureB();
Body b1 = f1.getBody();
Body b2 = f2.getBody();
Object o1 = b1.getUserData();
Object o2 = b2.getUserData();
if(o1.getClass() == Boundary.class && o2.getClass() == Box.class){
collisionCount++;
println("hello world! " + collisionCount);
Box b = (Box)o2;
Manifold manifold = cp.getManifold();
}
}