Android Question Box2D question?

ilan

Expert
Licensed User
Longtime User
hi

i am working on a new Box2D game. i want to create a revolutejoint to connect a wheel to a box
(creating a car) i know there is a WheelJoint but i would like to test it with a revolutejoint.

the question is, when i see some source and tutorials they use almost always Body.GetWorldCenter
in box2d (B4a) i cannot find GetWorldCenter i only have GetWorldPoint
do i need to set a vector with (0,0) and use GetWorldPoint?

B4X:
    Dim v1 As lgMathVector2
    v1.Set(0,0)
    RevoluteJointDef.initialize(BodyA,BodyB,BodyA.getWorldPoint(v1))

(0,0 is the centre of my world)
 

Informatix

Expert
Licensed User
Longtime User
hi

i am working on a new Box2D game. i want to create a revolutejoint to connect a wheel to a box
(creating a car) i know there is a WheelJoint but i would like to test it with a revolutejoint.

the question is, when i see some source and tutorials they use almost always Body.GetWorldCenter
in box2d (B4a) i cannot find GetWorldCenter i only have GetWorldPoint
do i need to set a vector with (0,0) and use GetWorldPoint?

B4X:
    Dim v1 As lgMathVector2
    v1.Set(0,0)
    RevoluteJointDef.initialize(BodyA,BodyB,BodyA.getWorldPoint(v1))

(0,0 is the centre of my world)
I don't remember the function name but there's one. I already used it.

EDIT: it's WorldCenter.
 
Upvote 0

ilan

Expert
Licensed User
Longtime User
Btw i must say that box2d is awesome. I am studying it for 1 week and after you understand the logic it is not complicated at all.

I have created few examples with joints like a car and other examples and its going very well. I will start soon a very nice game so thank you very much for wrapping this lib.

Btw have you heard about Toxiclibs?
It is also a very good physic engine that also
Got 3d vectors. And it is simpler to use since you only handle the drawing part and all physics are done automaticly.
 
Upvote 0

ilan

Expert
Licensed User
Longtime User
It seems to me that the property is there since the beginning.

you are right :oops:
it is the last option. i don't know why i have not seen it, maybe my eyes where really closed.

i thought it should start with Get... and i only saw GetWorldPoint and not ...center.

thank you :)
 
Upvote 0

ilan

Expert
Licensed User
Longtime User
Upvote 0
Top