Hello,
I have a little plane consisting out of two triangle.
It's like a left wing and a right wing.
I want a force coming out of the left wing and right wing going downwards like a thruster.
So far it seems box2d does not rotate and move the polygons/vertices so I ll have to do that myself.
I was thinking I could add two points like two lines coming out of the left and right wing going down... as a thrust direction indicator.
Then I could "transform" these two extra points... then subtract them from the left/right wing coordinates... which would give a vector for thrust.
Like a normal going downwards...
And then I could multiple the direction with a scale vector if I want to change thrust force...
But I wonder is there a better way to do it ?

PlaneRotation.PNG [ 10.2 KiB | Viewed 319 times ]
So this would allow three different ways to control the plane... either forward by activating both thruster that would be cool if it worked.
Or it could be used to either rotate left or rotate right...
The black dot is the center where it rotates...
It might also be cool to have these thrusters if wing gets blown off and thruster still on maybe it starts to do weird stuff 😉 🙂
So far I have this code:
b2Mul( mBody.GetTransform^, mModel.mTriangle[0].mVertex[2] )
The second parameter is the tip of the wing.
So I guess I could do the same with a thruster point...
But is there an easier way without requiring extra data ? Only temporarely data ?
Adding a vertex could become problematic for drawing...
Bye,
Skybuck.
I have a little plane consisting out of two triangle.
It's like a left wing and a right wing.
I want a force coming out of the left wing and right wing going downwards like a thruster.
So far it seems box2d does not rotate and move the polygons/vertices so I ll have to do that myself.
I was thinking I could add two points like two lines coming out of the left and right wing going down... as a thrust direction indicator.
Then I could "transform" these two extra points... then subtract them from the left/right wing coordinates... which would give a vector for thrust.
Like a normal going downwards...
And then I could multiple the direction with a scale vector if I want to change thrust force...
But I wonder is there a better way to do it ?
Attachment:
PlaneRotation.PNG [ 10.2 KiB | Viewed 319 times ]
So this would allow three different ways to control the plane... either forward by activating both thruster that would be cool if it worked.
Or it could be used to either rotate left or rotate right...
The black dot is the center where it rotates...
It might also be cool to have these thrusters if wing gets blown off and thruster still on maybe it starts to do weird stuff 😉 🙂
So far I have this code:
b2Mul( mBody.GetTransform^, mModel.mTriangle[0].mVertex[2] )
The second parameter is the tip of the wing.
So I guess I could do the same with a thruster point...
But is there an easier way without requiring extra data ? Only temporarely data ?
Adding a vertex could become problematic for drawing...
Bye,
Skybuck.