I'm using AndEngine LevelLoader in Gles2 to load rectangles which form the walls for my game.
<entity x="0" y="477" width="800" height="10" type="wall"/>
<entity x="800" y="477" width="240" height="10" angle="315" type="wall"/>
And using the following code to create the rectangle
Rectangle rect = new Rectangle(x, y,
width, height, activity.getVertexBufferObjectManager());
rect.setRotation(angle);
Body block = PhysicsFactory.createBoxBody(this.mPhysicsWorld, rect,
BodyType.StaticBody, objectFixtureDef);
It works, but what I want the image below demonstrates what happens. Is there any formulae for working out what Y value to start the rectangle at so it meets up, or how to transform the rectangle so that it starts next to the other one?
Thanks in advance.
In the
Entity
class, you have a function calledsetRotationCenter
, You can use it to change point where to rotate your entity. By default it is initialized to be at the center of the Entity.use :