Hi, I am trying to learn how to use Box2D from the Ray Wenderlich tutorial site and do not understand the block of code below. I have checked the Box2D manual as well but still do not understand...
I understand that this code locks the paddle along the x plane and not along the y, but I dont get what each line is actually doing
b2Vec2 worldAxis(1.0f, 0.0f); I know it is setting x to 1, but what is the significance?
jointDef.collideConnected = true; I get this, allow collision?
jointDef.Initialize(_paddleBody, _groundBody, _paddleBody->GetWorldCenter(), worldAxis); I dont get the relation to worldcenter and worldaxis?
Thanks
I understand that this code locks the paddle along the x plane and not along the y, but I dont get what each line is actually doing
b2Vec2 worldAxis(1.0f, 0.0f); I know it is setting x to 1, but what is the significance?
jointDef.collideConnected = true; I get this, allow collision?
jointDef.Initialize(_paddleBody, _groundBody, _paddleBody->GetWorldCenter(), worldAxis); I dont get the relation to worldcenter and worldaxis?
Code:
b2PrismaticJointDef jointDef;
b2Vec2 worldAxis(1.0f, 0.0f);
jointDef.collideConnected = true;
jointDef.Initialize(_paddleBody, _groundBody,
_paddleBody->GetWorldCenter(), worldAxis);
_world->CreateJoint(&jointDef);
b2Vec2 worldAxis(1.0f, 0.0f);
jointDef.collideConnected = true;
jointDef.Initialize(_paddleBody, _groundBody,
_paddleBody->GetWorldCenter(), worldAxis);
_world->CreateJoint(&jointDef);
Thanks