Hi all !
Please forgive my poor English.
First congratulation for Box2d and the port for Flash as3.
This is outstanding.
2 or 3 weeks ago, i followed a Car physics tutorial in order to make a top down car game.
Here is the link :
http://regedit.gamedev.pl/Mirror/Car%20Physics%20for%20Games/Car%20Physics%20for%20Games.html
And i did a little as3 application that resume the chapter Steering at low speed :
http://www.timelessconcept.com/flashLab/turn.swf
Basically, the car point in direction of its rotation angle.
and i just have to give the correct angular velocity in order to make it turn.
My code looks like this.
Very simple.
I would like to port it with Box2d in order to get some collisions.
What i have done so far doesn't do the job :
Any kind of help will be greatly appreciated.
Thank you very much for reading.
Please forgive my poor English.
First congratulation for Box2d and the port for Flash as3.
This is outstanding.
2 or 3 weeks ago, i followed a Car physics tutorial in order to make a top down car game.
Here is the link :
http://regedit.gamedev.pl/Mirror/Car%20Physics%20for%20Games/Car%20Physics%20for%20Games.html
And i did a little as3 application that resume the chapter Steering at low speed :
http://www.timelessconcept.com/flashLab/turn.swf
Basically, the car point in direction of its rotation angle.
and i just have to give the correct angular velocity in order to make it turn.
My code looks like this.
Code:
this.car.x += speed * Math.cos((this.car.rotation) * PI / 180);
this.car.y += speed * Math.sin((this.car.rotation) * PI / 180);
this.car.y += speed * Math.sin((this.car.rotation) * PI / 180);
Very simple.
I would like to port it with Box2d in order to get some collisions.
What i have done so far doesn't do the job :
Code:
if (right) {
car_final.SetAngularVelocity(0.9);
}
if (left) {
car_final.SetAngularVelocity(-0.9);
}
if (!left && !right) {
car_final.SetAngularVelocity(0);
}
car_final.ApplyForce(car_final.GetXForm().R.col2.Copy(), car_final.GetPosition());
car_final.SetAngularVelocity(0.9);
}
if (left) {
car_final.SetAngularVelocity(-0.9);
}
if (!left && !right) {
car_final.SetAngularVelocity(0);
}
car_final.ApplyForce(car_final.GetXForm().R.col2.Copy(), car_final.GetPosition());
Any kind of help will be greatly appreciated.
Thank you very much for reading.