You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If I change linear velocity by amount less than or equal to absolute value of 10e-2 then step will make body advance it's position according to it's speed but after the step body's linear velocity will be equal to zero. Maybe this is intended behavior, but it seems rather strange, so... is it? Is there something I can do about it
at all?
edit:
my guess: it has something to do with b2_linearSleepTolerance, but the thing is, Box2D C++ works just fine with any values, even as low as 10e-5
Here's the code for demonstration:
for (let body = world.GetBodyList(); B2D.getPointer(body) !== 0; body = body.GetNext()) {
if (body.GetType() === B2D.b2_dynamicBody) {
let velocity = body.GetLinearVelocity();
// -0.011 works by the way
let velocityDelta = -0.01;
velocity.Set(velocity.get_x(), velocity.get_y() + velocityDelta);
body.SetLinearVelocity(velocity);
velocity = body.GetLinearVelocity();
// output is: velocity before step: -0.009999999776482582
console.log("velocity before step: " + velocity.get_y());
}
}
// arguments here doesn't matter
world.Step(1, 20, 10);
for (let body = world.GetBodyList(); B2D.getPointer(body) !== 0; body = body.GetNext()) {
if (body.GetType() === B2D.b2_dynamicBody) {
let velocity = body.GetLinearVelocity();
// output is: velocity after step: 0
console.log("velocity after step: " + velocity.get_y());
}
}
The text was updated successfully, but these errors were encountered:
If I change linear velocity by amount less than or equal to absolute value of 10e-2 then step will make body advance it's position according to it's speed but after the step body's linear velocity will be equal to zero. Maybe this is intended behavior, but it seems rather strange, so... is it? Is there something I can do about it
at all?
edit:
my guess: it has something to do with b2_linearSleepTolerance, but the thing is, Box2D C++ works just fine with any values, even as low as 10e-5
Here's the code for demonstration:
The text was updated successfully, but these errors were encountered: