Hi!
I want to make one body holds another as it shown in attach but with one condition: body which i drag (object) shouldn't give a push to other bodies. Target platform: iPhone (if it does matter), Box2D 2.0.1. The problem is too complex to explain it in english, so sorry me if it's bad.
I just want to create the game where player can build high towers and don't afraid to push it a bit. This is a main point - you can build high tower and, yes, you can push it a bit and tower just starts to swing and then become still.
When i hold an object with mouse joint
i reset rotational inertia (to keep object aligned to XY) and change the mass to 0.1 instead of calculated (to prevent pushing other objects).
As i understand there are only two critical parameters - maxForce and mass. If i set maxForce = 1000 and mass = 0.1 object don't push others but it's hard to insert it into the same size hole. If i set maxForce = 10000 and mass = 0.01 it's easy to insert but object starts to push other and oddly shake (because of maxForce?).
Are there other nice solutions to make bodies more... hmm.. elastic?
I want to make one body holds another as it shown in attach but with one condition: body which i drag (object) shouldn't give a push to other bodies. Target platform: iPhone (if it does matter), Box2D 2.0.1. The problem is too complex to explain it in english, so sorry me if it's bad.
I just want to create the game where player can build high towers and don't afraid to push it a bit. This is a main point - you can build high tower and, yes, you can push it a bit and tower just starts to swing and then become still.
When i hold an object with mouse joint
Code:
b2MouseJointDef()
{
type = e_mouseJoint;
target.Set(0.0f, 0.0f);
maxForce = 0.0f;
frequencyHz = 5.0f;
dampingRatio = 0.7f;
timeStep = 1.0f / 60.0f;
}
{
type = e_mouseJoint;
target.Set(0.0f, 0.0f);
maxForce = 0.0f;
frequencyHz = 5.0f;
dampingRatio = 0.7f;
timeStep = 1.0f / 60.0f;
}
i reset rotational inertia (to keep object aligned to XY) and change the mass to 0.1 instead of calculated (to prevent pushing other objects).
Code:
struct b2MassData
{
float32 mass; /// The mass of the shape, usually in kilograms.
b2Vec2 center; /// The position of the shape's centroid relative to the shape's origin.
float32 I; /// The rotational inertia of the shape.
};
{
float32 mass; /// The mass of the shape, usually in kilograms.
b2Vec2 center; /// The position of the shape's centroid relative to the shape's origin.
float32 I; /// The rotational inertia of the shape.
};
As i understand there are only two critical parameters - maxForce and mass. If i set maxForce = 1000 and mass = 0.1 object don't push others but it's hard to insert it into the same size hole. If i set maxForce = 10000 and mass = 0.01 it's easy to insert but object starts to push other and oddly shake (because of maxForce?).
Are there other nice solutions to make bodies more... hmm.. elastic?