user1961104
user1961104

Reputation: 415

Box2d AS3 Flash simulating wind on top down view with friction

I am trying to make a top down game where you throw a disc using Box2d. The world has no gravity so the disc can be thrown and just bounces around the stage with the inertia and linear damping that I have set it with. Now, if I try to introduce wind using ApplyForce on an enter frame it will constantly push the disc in that direction until it hits a wall. What I am looking to do - with no luck so far - is give the stage (ground) some fiction so as the ball loses momentum it will eventually rest/stick. The code for the ApplyForce is as follows:

var xA = (Math.sin(windDir*(Math.PI/180)) * windSpeed * -1);
var yA = (Math.cos(windDir*(Math.PI/180)) * windSpeed );
var wind:V2 = new V2(xA, yA);
ball1.b2body.ApplyForce(wind, new V2(ball1.x, ball1.y));

Any thoughts?

Thanks.

Upvotes: 0

Views: 473

Answers (1)

csomakk
csomakk

Reputation: 5497

if it will have friction, it either wont move, or will move again until hits the wall, but slower.. its simple physics. you can slow down every object, but not with applyforce, because box2d is a simulator, and you want to do unrealistic thing.

Upvotes: 0

Related Questions