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
In the case of free fall movement, the change value of moving distance in the same time interval cannot be greater than 2, that is to say, it will change from free fall movement to uniform linear movement
#105
Open
oxDesigner opened this issue
Feb 23, 2020
· 1 comment
In the case of free fall movement, the change value of moving distance in the same time interval cannot be greater than 2, that is to say, it will change from free fall movement to uniform linear movement
const dynamicBox = new b2PolygonShape();
dynamicBox.SetAsBoxXY(0.1, 0.1);
var lastX = this.body.GetPosition().y;
setInterval(() => {
var X = this.body.GetPosition().y;
In the case of free fall movement, the change value of moving distance in the same time interval cannot be greater than 2, that is to say, it will change from free fall movement to uniform linear movement
I want to know how to modify it
code:
const bodyDef = new b2BodyDef;
bodyDef.type = b2_dynamicBody;
bodyDef.position.Set(0, 4);
this.body = world.CreateBody(bodyDef);
const dynamicBox = new b2PolygonShape();
dynamicBox.SetAsBoxXY(0.1, 0.1);
var lastX = this.body.GetPosition().y;
setInterval(() => {
var X = this.body.GetPosition().y;
}, 1000 / 60)
const fixtureDef = new b2FixtureDef;
fixtureDef.shape = dynamicBox;
fixtureDef.density = 1;
fixtureDef.friction = 0.2;
this.body.CreateFixtureFromDef(fixtureDef);
The text was updated successfully, but these errors were encountered: