First of all, this is the first post I've written here on StackOverflow, and I'm actually new to programming, so if I say anything wrong, I'm sorry.
I tried and tried to make this work - I want to simulate a body that stays still on the air, and for that I use SetLinearVelocity(new b2Vec2(0, 0))
.
As I read in other posts, seems that the gravity vector is important: it's a b2Vec2(0, 30);
and I have timestep of 1/30 seconds.
The bit of code that handles the mechanic of that particular body is the following:
this.clocktick = function(deltaT) {
this.body.SetLinearVelocity(new b2Vec2(0, 0));
if(this.body.GetLinearVelocity().y != 15){
console.debug(this.body.GetLinearVelocity().y);
}
}
I find it funny that the body is always descending and I already had a situation that even though it's descending, the debug returns a value of 0.
I'd just like to hear from a solution or some other suggestion to simulate what i intend to simulate.
Thx