Добрый день, дорогой читатель! Это уже четвертая статья по Box2D. И здесь я предложу готовое решение для программистов. Мне самому нужны были шестерни для моего проекта, и я сделал 4-х, 6-и, 12-и и 24-х зубчатые колеса. Код занял 2115 строк, 4 дня работы. И я хочу поделиться им с Вами, чтобы Вы могли сэкономить свое время для действительно впечатляющих проектов на Box2D. Все шестерни масштабируются, можно задать угол поворота, координаты, наличие, скорость и мощность двигателя. В коде все подробно прокомментировано.

Если Вам нужно что-то такое (gif-анимация будет после ката):

image

Рисунок 1. Система шестерней.

То эта статья, определенно, для Вас!

image

Рисунок 1. Система шестерней анимированная

Состав проекта все тот же, читайте первую статью по подключению libGDX, созданию такого же проекта.

В коде содержится описание для всех типов шестерней
package com.mygdx.game;

import com.badlogic.gdx.ApplicationAdapter;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Input.Keys;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.math.Vector3;
import com.badlogic.gdx.physics.box2d.Body;
import com.badlogic.gdx.physics.box2d.BodyDef;
import com.badlogic.gdx.physics.box2d.Box2DDebugRenderer;
import com.badlogic.gdx.physics.box2d.FixtureDef;
import com.badlogic.gdx.physics.box2d.PolygonShape;
import com.badlogic.gdx.physics.box2d.World;
import com.badlogic.gdx.physics.box2d.joints.RevoluteJointDef;
import com.badlogic.gdx.physics.box2d.joints.WeldJointDef;

import utils.Constants;

public class MyGdxGame extends ApplicationAdapter {
	private OrthographicCamera camera;
	private boolean DEBUG = false;
	private World world;
	private Box2DDebugRenderer b2dr;
	private Body basis;

	// 4 зубца
	private Body box;
	private Body toptooth;
	private Body righttooth;
	private Body bottooth;
	private Body lefttooth;

	// 6 зубцов
	private Body hexagonum;
	private Body lefthextooth;
	private Body righthextooth;
	private Body toprighthextooth;
	private Body toplefthextooth;
	private Body botrighthextooth;
	private Body botlefthextooth;

	// 12 зубцов
	private Body Dodecangulum;
	private Body Dodecangulum2;
	private Body DodecangulumBotLeftTooth1;
	private Body DodecangulumBotLeftTooth2;
	private Body DodecangulumBotLeftTooth3;
	private Body DodecangulumBotRightTooth1;
	private Body DodecangulumBotRightTooth2;
	private Body DodecangulumBotRightTooth3;
	private Body DodecangulumTopLeftTooth1;
	private Body DodecangulumTopLeftTooth2;
	private Body DodecangulumTopLeftTooth3;
	private Body DodecangulumTopRightTooth1;
	private Body DodecangulumTopRightTooth2;
	private Body DodecangulumTopRightTooth3;

	// 24 зубца
	private Body twentyfourteethcog1;
	private Body twentyfourteethcog2;
	private Body twentyfourteethcog3;
	private Body twentyfourteethcog4;
	private Body twentyfourteethcogBotLeftTooth1;
	private Body twentyfourteethcogBotLeftTooth2;
	private Body twentyfourteethcogBotLeftTooth3;
	private Body twentyfourteethcogBotLeftTooth4;
	private Body twentyfourteethcogBotLeftTooth5;
	private Body twentyfourteethcogBotLeftTooth6;
	private Body twentyfourteethcogBotRightTooth1;
	private Body twentyfourteethcogBotRightTooth2;
	private Body twentyfourteethcogBotRightTooth3;
	private Body twentyfourteethcogBotRightTooth4;
	private Body twentyfourteethcogBotRightTooth5;
	private Body twentyfourteethcogBotRightTooth6;
	private Body twentyfourteethcogTopLeftTooth1;
	private Body twentyfourteethcogTopLeftTooth2;
	private Body twentyfourteethcogTopLeftTooth3;
	private Body twentyfourteethcogTopLeftTooth4;
	private Body twentyfourteethcogTopLeftTooth5;
	private Body twentyfourteethcogTopLeftTooth6;
	private Body twentyfourteethcogTopRightTooth1;
	private Body twentyfourteethcogTopRightTooth2;
	private Body twentyfourteethcogTopRightTooth3;
	private Body twentyfourteethcogTopRightTooth4;
	private Body twentyfourteethcogTopRightTooth5;
	private Body twentyfourteethcogTopRightTooth6;

	public void create() {
		float w = Gdx.graphics.getWidth();
		float h = Gdx.graphics.getHeight();
		camera = new OrthographicCamera();
		camera.setToOrtho(false, w / 2, h / 2);
		world = new World(new Vector2(0, -9.8f), false);
		b2dr = new Box2DDebugRenderer();
		twentyfourCog(0f, 0f, 0f, true, 0.7f, 30, 30);
		// первый параметр - угол поворота, второй - координата центра вращения по x,
		// третий - координата центра вращения по y, четвертый - есть ли мотор, пятый -
		// масштаб шестерни, шестой - скорость мотора, седьмой - мощность мотора
	}

	// создание шестерни с 24 зубцами
	public void twentyfourCog(float rotation, float xo, float yo, boolean n, float resize, int speed, int hf) {
		// основание, центр вращения
		basis = createBasis(xo, yo, resize);
		// шестерня строится из 4 полигонов, потому что в Box2D ограничение по
		// количеству вершин полигона от 3 до 8
		twentyfourteethcog1 = createtwentyfourteethcog1(xo, yo, resize);
		twentyfourteethcog2 = createtwentyfourteethcog2(xo, yo, resize);
		twentyfourteethcog3 = createtwentyfourteethcog3(xo, yo, resize);
		twentyfourteethcog4 = createtwentyfourteethcog4(xo, yo, resize);
		// здесь задается вращение
		twentyfourteethcog1.setTransform(xo, yo, rotation);
		twentyfourteethcog2.setTransform(xo, yo, rotation);
		twentyfourteethcog3.setTransform(xo, yo, rotation);
		twentyfourteethcog4.setTransform(xo, yo, rotation);
		// создаются зубья, по одному
		twentyfourteethcogTopRightTooth1 = createtwentyfourteethcogTopRightTooth1(xo, yo, xo, yo, resize);
		twentyfourteethcogTopRightTooth1.setTransform(xo, yo, rotation);
		twentyfourteethcogTopRightTooth2 = createtwentyfourteethcogTopRightTooth2(xo, yo, xo, yo, resize);
		twentyfourteethcogTopRightTooth2.setTransform(xo, yo, rotation);
		twentyfourteethcogTopRightTooth3 = createtwentyfourteethcogTopRightTooth3(xo, yo, xo, yo, resize);
		twentyfourteethcogTopRightTooth3.setTransform(xo, yo, rotation);
		twentyfourteethcogTopRightTooth4 = createtwentyfourteethcogTopRightTooth4(xo, yo, xo, yo, resize);
		twentyfourteethcogTopRightTooth4.setTransform(xo, yo, rotation);
		twentyfourteethcogTopRightTooth5 = createtwentyfourteethcogTopRightTooth5(xo, yo, xo, yo, resize);
		twentyfourteethcogTopRightTooth5.setTransform(xo, yo, rotation);
		twentyfourteethcogTopRightTooth6 = createtwentyfourteethcogTopRightTooth6(xo, yo, xo, yo, resize);
		twentyfourteethcogTopRightTooth6.setTransform(xo, yo, rotation);

		twentyfourteethcogTopLeftTooth1 = createtwentyfourteethcogTopLeftTooth1(xo, yo, xo, yo, resize);
		twentyfourteethcogTopLeftTooth1.setTransform(xo, yo, rotation);
		twentyfourteethcogTopLeftTooth2 = createtwentyfourteethcogTopLeftTooth2(xo, yo, xo, yo, resize);
		twentyfourteethcogTopLeftTooth2.setTransform(xo, yo, rotation);
		twentyfourteethcogTopLeftTooth3 = createtwentyfourteethcogTopLeftTooth3(xo, yo, xo, yo, resize);
		twentyfourteethcogTopLeftTooth3.setTransform(xo, yo, rotation);
		twentyfourteethcogTopLeftTooth4 = createtwentyfourteethcogTopLeftTooth4(xo, yo, xo, yo, resize);
		twentyfourteethcogTopLeftTooth4.setTransform(xo, yo, rotation);
		twentyfourteethcogTopLeftTooth5 = createtwentyfourteethcogTopLeftTooth5(xo, yo, xo, yo, resize);
		twentyfourteethcogTopLeftTooth5.setTransform(xo, yo, rotation);
		twentyfourteethcogTopLeftTooth6 = createtwentyfourteethcogTopLeftTooth6(xo, yo, xo, yo, resize);
		twentyfourteethcogTopLeftTooth6.setTransform(xo, yo, rotation);

		twentyfourteethcogBotRightTooth1 = createtwentyfourteethcogBotRightTooth1(xo, yo, xo, yo, resize);
		twentyfourteethcogBotRightTooth1.setTransform(xo, yo, rotation);
		twentyfourteethcogBotRightTooth2 = createtwentyfourteethcogBotRightTooth2(xo, yo, xo, yo, resize);
		twentyfourteethcogBotRightTooth2.setTransform(xo, yo, rotation);
		twentyfourteethcogBotRightTooth3 = createtwentyfourteethcogBotRightTooth3(xo, yo, xo, yo, resize);
		twentyfourteethcogBotRightTooth3.setTransform(xo, yo, rotation);
		twentyfourteethcogBotRightTooth4 = createtwentyfourteethcogBotRightTooth4(xo, yo, xo, yo, resize);
		twentyfourteethcogBotRightTooth4.setTransform(xo, yo, rotation);
		twentyfourteethcogBotRightTooth5 = createtwentyfourteethcogBotRightTooth5(xo, yo, xo, yo, resize);
		twentyfourteethcogBotRightTooth5.setTransform(xo, yo, rotation);
		twentyfourteethcogBotRightTooth6 = createtwentyfourteethcogBotRightTooth6(xo, yo, xo, yo, resize);
		twentyfourteethcogBotRightTooth6.setTransform(xo, yo, rotation);

		twentyfourteethcogBotLeftTooth1 = createtwentyfourteethcogBotLeftTooth1(xo, yo, xo, yo, resize);
		twentyfourteethcogBotLeftTooth1.setTransform(xo, yo, rotation);
		twentyfourteethcogBotLeftTooth2 = createtwentyfourteethcogBotLeftTooth2(xo, yo, xo, yo, resize);
		twentyfourteethcogBotLeftTooth2.setTransform(xo, yo, rotation);
		twentyfourteethcogBotLeftTooth3 = createtwentyfourteethcogBotLeftTooth3(xo, yo, xo, yo, resize);
		twentyfourteethcogBotLeftTooth3.setTransform(xo, yo, rotation);
		twentyfourteethcogBotLeftTooth4 = createtwentyfourteethcogBotLeftTooth4(xo, yo, xo, yo, resize);
		twentyfourteethcogBotLeftTooth4.setTransform(xo, yo, rotation);
		twentyfourteethcogBotLeftTooth5 = createtwentyfourteethcogBotLeftTooth5(xo, yo, xo, yo, resize);
		twentyfourteethcogBotLeftTooth5.setTransform(xo, yo, rotation);
		twentyfourteethcogBotLeftTooth6 = createtwentyfourteethcogBotLeftTooth6(xo, yo, xo, yo, resize);
		twentyfourteethcogBotLeftTooth6.setTransform(xo, yo, rotation);

		// связки между полигонами, составляющими шестерню
		weldMotJoint(twentyfourteethcog1, twentyfourteethcog2);
		weldMotJoint(twentyfourteethcog1, twentyfourteethcog3);
		weldMotJoint(twentyfourteethcog1, twentyfourteethcog4);

		weldMotJoint(twentyfourteethcog2, twentyfourteethcog1);
		weldMotJoint(twentyfourteethcog2, twentyfourteethcog3);
		weldMotJoint(twentyfourteethcog2, twentyfourteethcog4);

		weldMotJoint(twentyfourteethcog3, twentyfourteethcog1);
		weldMotJoint(twentyfourteethcog3, twentyfourteethcog2);
		weldMotJoint(twentyfourteethcog3, twentyfourteethcog4);

		weldMotJoint(twentyfourteethcog4, twentyfourteethcog1);
		weldMotJoint(twentyfourteethcog4, twentyfourteethcog2);
		weldMotJoint(twentyfourteethcog4, twentyfourteethcog3);

		weldMotJoint(twentyfourteethcog1, twentyfourteethcogTopRightTooth1);
		weldMotJoint(twentyfourteethcog1, twentyfourteethcogTopRightTooth2);
		weldMotJoint(twentyfourteethcog1, twentyfourteethcogTopRightTooth3);
		weldMotJoint(twentyfourteethcog1, twentyfourteethcogTopRightTooth4);
		weldMotJoint(twentyfourteethcog1, twentyfourteethcogTopRightTooth5);
		weldMotJoint(twentyfourteethcog1, twentyfourteethcogTopRightTooth6);

		weldMotJoint(twentyfourteethcog4, twentyfourteethcogTopLeftTooth1);
		weldMotJoint(twentyfourteethcog4, twentyfourteethcogTopLeftTooth2);
		weldMotJoint(twentyfourteethcog4, twentyfourteethcogTopLeftTooth3);
		weldMotJoint(twentyfourteethcog4, twentyfourteethcogTopLeftTooth4);
		weldMotJoint(twentyfourteethcog4, twentyfourteethcogTopLeftTooth5);
		weldMotJoint(twentyfourteethcog4, twentyfourteethcogTopLeftTooth6);

		weldMotJoint(twentyfourteethcog2, twentyfourteethcogBotRightTooth1);
		weldMotJoint(twentyfourteethcog2, twentyfourteethcogBotRightTooth2);
		weldMotJoint(twentyfourteethcog2, twentyfourteethcogBotRightTooth3);
		weldMotJoint(twentyfourteethcog2, twentyfourteethcogBotRightTooth4);
		weldMotJoint(twentyfourteethcog2, twentyfourteethcogBotRightTooth5);
		weldMotJoint(twentyfourteethcog2, twentyfourteethcogBotRightTooth6);

		weldMotJoint(twentyfourteethcog3, twentyfourteethcogBotLeftTooth1);
		weldMotJoint(twentyfourteethcog3, twentyfourteethcogBotLeftTooth2);
		weldMotJoint(twentyfourteethcog3, twentyfourteethcogBotLeftTooth3);
		weldMotJoint(twentyfourteethcog3, twentyfourteethcogBotLeftTooth4);
		weldMotJoint(twentyfourteethcog3, twentyfourteethcogBotLeftTooth5);
		weldMotJoint(twentyfourteethcog3, twentyfourteethcogBotLeftTooth6);

		// связь между шестерней и базисом для обеспечения вращения
		revJoint(basis, twentyfourteethcog1, n, speed, hf);
		revJoint(basis, twentyfourteethcog2, n, speed, hf);
		revJoint(basis, twentyfourteethcog3, n, speed, hf);
		revJoint(basis, twentyfourteethcog4, n, speed, hf);
	}

	// все по аналогии, шестерня с 12 зубьями
	public void twelveCog(float rotation, float xo, float yo, boolean n, float resize, int speed, int hf) {
		basis = createBasis(xo, yo, resize);

		Dodecangulum = createDodecangulum(xo, yo, resize);
		Dodecangulum.setTransform(xo, yo, rotation);

		DodecangulumTopLeftTooth1 = createTopLeftDodecangulumTooth1(xo, yo, xo, yo, resize);
		DodecangulumTopLeftTooth1.setTransform(xo, yo, rotation);
		DodecangulumTopLeftTooth2 = createTopLeftDodecangulumTooth2(xo, yo, xo, yo, resize);
		DodecangulumTopLeftTooth2.setTransform(xo, yo, rotation);
		DodecangulumTopLeftTooth3 = createTopLeftDodecangulumTooth3(xo, yo, xo, yo, resize);
		DodecangulumTopLeftTooth3.setTransform(xo, yo, rotation);
		DodecangulumTopRightTooth1 = createTopRightDodecangulumTooth1(xo, yo, xo, yo, resize);
		DodecangulumTopRightTooth1.setTransform(xo, yo, rotation);
		DodecangulumTopRightTooth2 = createTopRightDodecangulumTooth2(xo, yo, xo, yo, resize);
		DodecangulumTopRightTooth2.setTransform(xo, yo, rotation);
		DodecangulumTopRightTooth3 = createTopRightDodecangulumTooth3(xo, yo, xo, yo, resize);
		DodecangulumTopRightTooth3.setTransform(xo, yo, rotation);

		weldMotJoint(DodecangulumTopLeftTooth1, Dodecangulum);
		weldMotJoint(DodecangulumTopLeftTooth2, Dodecangulum);
		weldMotJoint(DodecangulumTopLeftTooth3, Dodecangulum);
		weldMotJoint(DodecangulumTopRightTooth1, Dodecangulum);
		weldMotJoint(DodecangulumTopRightTooth2, Dodecangulum);
		weldMotJoint(DodecangulumTopRightTooth3, Dodecangulum);

		Dodecangulum2 = createDodecangulum2(xo, yo, resize);
		Dodecangulum2.setTransform(xo, yo, rotation);

		DodecangulumBotLeftTooth1 = createBotLeftDodecangulumTooth1(xo, yo, xo, yo, resize);
		DodecangulumBotLeftTooth1.setTransform(xo, yo, rotation);
		DodecangulumBotLeftTooth2 = createBotLeftDodecangulumTooth2(xo, yo, xo, yo, resize);
		DodecangulumBotLeftTooth2.setTransform(xo, yo, rotation);
		DodecangulumBotLeftTooth3 = createBotLeftDodecangulumTooth3(xo, yo, xo, yo, resize);
		DodecangulumBotLeftTooth3.setTransform(xo, yo, rotation);
		DodecangulumBotRightTooth1 = createBotRightDodecangulumTooth1(xo, yo, xo, yo, resize);
		DodecangulumBotRightTooth1.setTransform(xo, yo, rotation);
		DodecangulumBotRightTooth2 = createBotRightDodecangulumTooth2(xo, yo, xo, yo, resize);
		DodecangulumBotRightTooth2.setTransform(xo, yo, rotation);
		DodecangulumBotRightTooth3 = createBotRightDodecangulumTooth3(xo, yo, xo, yo, resize);
		DodecangulumBotRightTooth3.setTransform(xo, yo, rotation);

		weldMotJoint(DodecangulumBotLeftTooth1, Dodecangulum2);
		weldMotJoint(DodecangulumBotLeftTooth2, Dodecangulum2);
		weldMotJoint(DodecangulumBotLeftTooth3, Dodecangulum2);

		weldMotJoint(DodecangulumBotRightTooth1, Dodecangulum2);
		weldMotJoint(DodecangulumBotRightTooth2, Dodecangulum2);
		weldMotJoint(DodecangulumBotRightTooth3, Dodecangulum2);

		weldMotJoint(Dodecangulum2, Dodecangulum);
		weldMotJoint(Dodecangulum, Dodecangulum2);
		revJoint(basis, Dodecangulum, n, speed, hf);
		revJoint(basis, Dodecangulum2, n, speed, hf);
	}

	// все по аналогии, шестерня с 6 зубьями
	public void sixCog(float rotation, float xo, float yo, boolean n, float resize, int speed, int hf) {
		basis = createBasis(xo, yo, resize);
		hexagonum = createHexagonum(xo, yo, resize);
		revJoint(basis, hexagonum, n, speed, hf);
		hexagonum.setTransform(hexagonum.getPosition().x, hexagonum.getPosition().y, rotation);
		lefthextooth = createLeftHexTooth(xo, yo, xo, yo, resize);
		lefthextooth.setTransform(xo, yo, rotation);
		righthextooth = createRightHexTooth(xo, yo, xo, yo, resize);
		righthextooth.setTransform(xo, yo, rotation);
		toprighthextooth = createTopRightHexTooth(xo, yo, xo, yo, resize);
		toprighthextooth.setTransform(xo, yo, rotation);
		toplefthextooth = createTopLeftHexTooth(xo, yo, xo, yo, resize);
		toplefthextooth.setTransform(xo, yo, rotation);
		botlefthextooth = createBotLeftHexTooth(xo, yo, xo, yo, resize);
		botlefthextooth.setTransform(xo, yo, rotation);
		botrighthextooth = createBotRightHexTooth(xo, yo, xo, yo, resize);
		botrighthextooth.setTransform(xo, yo, rotation);
		weldMotJoint(hexagonum, lefthextooth);
		weldMotJoint(hexagonum, righthextooth);
		weldMotJoint(hexagonum, toprighthextooth);
		weldMotJoint(hexagonum, toplefthextooth);
		weldMotJoint(hexagonum, botlefthextooth);
		weldMotJoint(hexagonum, botrighthextooth);
	}

	// все по аналогии, шестерня с 4 зубьями
	public void fourCog(float rotation, float xo, float yo, boolean n, float resize, int speed, int hf) {
		basis = createBasis(xo, yo, resize);
		box = createBox(xo, yo, resize);
		box.setTransform(box.getPosition().x, box.getPosition().y, rotation);
		toptooth = createTopTooth(xo, yo, xo, yo, resize);
		toptooth.setTransform(xo, yo, rotation);
		righttooth = createRightTooth(xo, yo, xo, yo, resize);
		righttooth.setTransform(xo, yo, rotation);
		bottooth = createBotTooth(xo, yo, xo, yo, resize);
		bottooth.setTransform(xo, yo, rotation);
		lefttooth = createLeftTooth(xo, yo, xo, yo, resize);
		lefttooth.setTransform(xo, yo, rotation);
		weldMotJoint(box, toptooth);
		weldMotJoint(box, righttooth);
		weldMotJoint(box, bottooth);
		weldMotJoint(box, lefttooth);
		revJoint(basis, box, n, speed, hf);
	}

	// описание связки для обеспечения вращения
	public void revJoint(Body body1, Body body2, boolean n, int speed, int hf) {
		RevoluteJointDef rjd = new RevoluteJointDef();
		if (n == true) {
			rjd.enableMotor = true;
			rjd.motorSpeed = speed;
			rjd.maxMotorTorque = hf;
		}
		rjd.collideConnected = false;
		rjd.bodyA = body1;
		rjd.bodyB = body2;
		rjd.localAnchorA.set(body1.getPosition().x, body1.getPosition().y);
		rjd.localAnchorB.set(body2.getPosition().x, body2.getPosition().y);
		world.createJoint(rjd);
	}

	// неподвижная связка
	public void weldMotJoint(Body body1, Body body2) {
		WeldJointDef rjd = new WeldJointDef();
		rjd.collideConnected = false;
		rjd.bodyA = body1;
		rjd.bodyB = body2;
		rjd.localAnchorA.set(body1.getPosition().x, body1.getPosition().y);
		rjd.localAnchorB.set(body2.getPosition().x, body2.getPosition().y);
		world.createJoint(rjd);
	}

	public void render() {
		update(Gdx.graphics.getDeltaTime());
		Gdx.gl.glClearColor(0, 0, 0, 1);
		Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
		b2dr.render(world, camera.combined.scl(Constants.PPM));
	}

	public void resize(int width, int height) {
		camera.setToOrtho(false, width / 2, height / 2);
	}

	public void dispose() {
		world.dispose();
		b2dr.dispose();
	}

	public void update(float delta) {
		world.step(1 / 60f, 6, 2);
		cameraUpdate(delta);
	}

	// камера следит за центром вращения
	public void cameraUpdate(float delta) {
		Vector3 position = camera.position;
		position.x = basis.getPosition().x * Constants.PPM;
		position.y = basis.getPosition().y * Constants.PPM;
		camera.position.set(position);
		camera.update();
	}

	// создание центра вращения для шестерни с 4 зубьями
	public Body createBox(float dx, float dy, float resize) {
		Vector2[] verticles = new Vector2[4];
		verticles[0] = new Vector2(2f * 10 / utils.Constants.PPM * resize + dx,
				2f * 10 / utils.Constants.PPM * resize + dy);
		verticles[1] = new Vector2(2f * 10 / utils.Constants.PPM * resize + dx,
				-2f * 10 / utils.Constants.PPM * resize + dy);
		verticles[2] = new Vector2(-2f * 10 / utils.Constants.PPM * resize + dx,
				2f * 10 / utils.Constants.PPM * resize + dy);
		verticles[3] = new Vector2(-2f * 10 / utils.Constants.PPM * resize + dx,
				-2f * 10 / utils.Constants.PPM * resize + dy);
		PolygonShape shape = new PolygonShape();
		Body fBody;
		BodyDef def = new BodyDef();
		def.type = BodyDef.BodyType.DynamicBody;
		def.position.set(dx, dy);
		def.fixedRotation = false;
		fBody = world.createBody(def);
		shape.set(verticles);
		FixtureDef fd = new FixtureDef();
		fd.shape = shape;
		fd.friction = 0.5f;
		fd.density = 3f;
		fd.restitution = 0.5f;
		fBody.createFixture(fd);

		fBody.createFixture(fd);
		shape.dispose();
		return fBody;
	}

	// каждый зубец создается, как полигон с четырьмя вершинами
	public Body createTopTooth(float xo, float yo, float dx, float dy, float resize) {
		PolygonShape shape = new PolygonShape();

		Vector2[] verticles = new Vector2[4];
		verticles[0] = new Vector2(-2f * 10 / utils.Constants.PPM * resize + dx,
				2f * 10 / utils.Constants.PPM * resize + dy);
		verticles[1] = new Vector2(-0.5f * 10 / utils.Constants.PPM * resize + dx,
				8f * 10 / utils.Constants.PPM * resize + dy);
		verticles[2] = new Vector2(0.5f * 10 / utils.Constants.PPM * resize + dx,
				8f * 10 / utils.Constants.PPM * resize + dy);
		verticles[3] = new Vector2(2f * 10 / utils.Constants.PPM * resize + dx,
				2f * 10 / utils.Constants.PPM * resize + dy);
		Body fBody;
		BodyDef def = new BodyDef();
		def.type = BodyDef.BodyType.DynamicBody;
		def.position.set(xo * 10 / utils.Constants.PPM + dx, yo * 10 / utils.Constants.PPM + dy);
		def.fixedRotation = false;
		shape.set(verticles);
		fBody = world.createBody(def);
		FixtureDef fd = new FixtureDef();
		fd.shape = shape;
		fd.friction = 0.7f;
		fd.density = 3f;
		fd.restitution = 0.5f;
		fBody.createFixture(fd);

		shape.dispose();
		return fBody;
	}

	public Body createRightTooth(float xo, float yo, float dx, float dy, float resize) {
		PolygonShape shape = new PolygonShape();

		Vector2[] verticles = new Vector2[4];
		verticles[0] = new Vector2(2f * 10 / utils.Constants.PPM * resize + dx,
				-2f * 10 / utils.Constants.PPM * resize + dy);
		verticles[1] = new Vector2(8f * 10 / utils.Constants.PPM * resize + dx,
				0.5f * 10 / utils.Constants.PPM * resize + dy);
		verticles[2] = new Vector2(8f * 10 / utils.Constants.PPM * resize + dx,
				-0.5f * 10 / utils.Constants.PPM * resize + dy);
		verticles[3] = new Vector2(2f * 10 / utils.Constants.PPM * resize + dx,
				2f * 10 / utils.Constants.PPM * resize + dy);
		Body fBody;
		BodyDef def = new BodyDef();
		def.type = BodyDef.BodyType.DynamicBody;
		def.position.set(xo * 10 / utils.Constants.PPM + dx, yo * 10 / utils.Constants.PPM + dy);
		def.fixedRotation = false;
		shape.set(verticles);
		fBody = world.createBody(def);
		FixtureDef fd = new FixtureDef();
		fd.shape = shape;
		fd.friction = 0.7f;
		fd.density = 3f;
		fd.restitution = 0.5f;
		fBody.createFixture(fd);
		shape.dispose();
		return fBody;
	}

	public Body createBotTooth(float xo, float yo, float dx, float dy, float resize) {
		PolygonShape shape = new PolygonShape();

		Vector2[] verticles = new Vector2[4];
		verticles[0] = new Vector2(2f * 10 / utils.Constants.PPM * resize + dx,
				-2f * 10 / utils.Constants.PPM * resize + dy);
		verticles[1] = new Vector2(-0.5f * 10 / utils.Constants.PPM * resize + dx,
				-8f * 10 / utils.Constants.PPM * resize + dy);
		verticles[2] = new Vector2(0.5f * 10 / utils.Constants.PPM * resize + dx,
				-8f * 10 / utils.Constants.PPM * resize + dy);
		verticles[3] = new Vector2(-2f * 10 / utils.Constants.PPM * resize + dx,
				-2f * 10 / utils.Constants.PPM * resize + dy);

		Body fBody;
		BodyDef def = new BodyDef();
		def.type = BodyDef.BodyType.DynamicBody;
		def.position.set(xo * 10 / utils.Constants.PPM + dx, yo * 10 / utils.Constants.PPM + dy);
		def.fixedRotation = false;
		shape.set(verticles);
		fBody = world.createBody(def);
		FixtureDef fd = new FixtureDef();
		fd.shape = shape;
		fd.friction = 0.7f;
		fd.density = 3f;
		fd.restitution = 0.5f;
		fBody.createFixture(fd);

		shape.dispose();
		return fBody;
	}

	public Body createLeftTooth(float xo, float yo, float dx, float dy, float resize) {
		PolygonShape shape = new PolygonShape();

		Vector2[] verticles = new Vector2[4];
		verticles[0] = new Vector2(-2f * 10 / utils.Constants.PPM * resize + dx,
				-2f * 10 / utils.Constants.PPM * resize + dy);
		verticles[1] = new Vector2(-8f * 10 / utils.Constants.PPM * resize + dx,
				0.5f * 10 / utils.Constants.PPM * resize + dy);
		verticles[2] = new Vector2(-8f * 10 / utils.Constants.PPM * resize + dx,
				-0.5f * 10 / utils.Constants.PPM * resize + dy);
		verticles[3] = new Vector2(-2f * 10 / utils.Constants.PPM * resize + dx,
				2f * 10 / utils.Constants.PPM * resize + dy);

		Body fBody;
		BodyDef def = new BodyDef();
		def.type = BodyDef.BodyType.DynamicBody;
		def.position.set(xo * 10 / utils.Constants.PPM + dx, yo * 10 / utils.Constants.PPM + dy);
		def.fixedRotation = false;
		shape.set(verticles);
		fBody = world.createBody(def);
		FixtureDef fd = new FixtureDef();
		fd.shape = shape;
		fd.friction = 0.7f;
		fd.density = 3f;
		fd.restitution = 0.5f;
		fBody.createFixture(fd);

		shape.dispose();
		return fBody;
	}

	public Body createBasis(float dx, float dy, float resize) {
		Vector2[] verticles = new Vector2[4];
		verticles[0] = new Vector2(2f * 10 / utils.Constants.PPM / 2 * resize + dx,
				2f * 10 / utils.Constants.PPM / 2 * resize + dy);
		verticles[1] = new Vector2(2f * 10 / utils.Constants.PPM / 2 * resize + dx,
				-2f * 10 / utils.Constants.PPM / 2 * resize + dy);
		verticles[2] = new Vector2(-2f * 10 / utils.Constants.PPM / 2 * resize + dx,
				2f * 10 / utils.Constants.PPM / 2 * resize + dy);
		verticles[3] = new Vector2(-2f * 10 / utils.Constants.PPM / 2 * resize + dx,
				-2f * 10 / utils.Constants.PPM / 2 * resize + dy);

		PolygonShape shape = new PolygonShape();
		Body fBody;
		BodyDef def = new BodyDef();
		def.type = BodyDef.BodyType.StaticBody;
		def.position.set(dx, dy);
		def.fixedRotation = false;
		fBody = world.createBody(def);
		shape.set(verticles);

		FixtureDef fd = new FixtureDef();
		fd.shape = shape;
		fd.friction = 0.5f;
		fd.density = 3f;
		fd.restitution = 0.5f;
		fBody.createFixture(fd);

		fBody.createFixture(fd);
		shape.dispose();
		return fBody;
	}

	// Шестерня с 6 зубьями
	public Body createHexagonum(float dx, float dy, float resize) {
		Vector2[] verticles = new Vector2[6];
		verticles[0] = new Vector2(0f * 10 / utils.Constants.PPM * resize + dx,
				3f * 10 / utils.Constants.PPM * resize + dy);
		verticles[1] = new Vector2(0f * 10 / utils.Constants.PPM * resize + dx,
				-3f * 10 / utils.Constants.PPM * resize + dy);
		verticles[2] = new Vector2(2.5f * 10 / utils.Constants.PPM * resize + dx,
				1.5f * 10 / utils.Constants.PPM * resize + dy);
		verticles[3] = new Vector2(2.5f * 10 / utils.Constants.PPM * resize + dx,
				-1.5f * 10 / utils.Constants.PPM * resize + dy);
		verticles[4] = new Vector2(-2.5f * 10 / utils.Constants.PPM * resize + dx,
				-1.5f * 10 / utils.Constants.PPM * resize + dy);
		verticles[5] = new Vector2(-2.5f * 10 / utils.Constants.PPM * resize + dx,
				1.5f * 10 / utils.Constants.PPM * resize + dy);

		PolygonShape shape = new PolygonShape();
		Body fBody;
		BodyDef def = new BodyDef();
		def.type = BodyDef.BodyType.DynamicBody;
		def.position.set(dx, dy);
		def.fixedRotation = false;
		fBody = world.createBody(def);
		shape.set(verticles);
		FixtureDef fd = new FixtureDef();
		fd.shape = shape;
		fd.friction = 0.5f;
		fd.density = 3f;
		fd.restitution = 0.5f;
		fBody.createFixture(fd);

		fBody.createFixture(fd);
		shape.dispose();
		return fBody;
	}

	public Body createLeftHexTooth(float xo, float yo, float dx, float dy, float resize) {
		PolygonShape shape = new PolygonShape();

		Vector2[] verticles = new Vector2[4];
		verticles[0] = new Vector2(-2.5f * 10 / utils.Constants.PPM * resize + dx,
				-1.5f * 10 / utils.Constants.PPM * resize + dy);
		verticles[1] = new Vector2(-2.5f * 10 / utils.Constants.PPM * resize + dx,
				1.5f * 10 / utils.Constants.PPM * resize + dy);
		verticles[2] = new Vector2(-9.5f * 10 / utils.Constants.PPM * resize + dx,
				-0.5f * 10 / utils.Constants.PPM * resize + dy);
		verticles[3] = new Vector2(-9.5f * 10 / utils.Constants.PPM * resize + dx,
				0.5f * 10 / utils.Constants.PPM * resize + dy);

		Body fBody;
		BodyDef def = new BodyDef();
		def.type = BodyDef.BodyType.DynamicBody;
		def.position.set(xo * 10 / utils.Constants.PPM + dx, yo * 10 / utils.Constants.PPM + dy);
		def.fixedRotation = false;
		shape.set(verticles);
		fBody = world.createBody(def);
		FixtureDef fd = new FixtureDef();
		fd.shape = shape;
		fd.friction = 0.7f;
		fd.density = 3f;
		fd.restitution = 0.5f;
		fBody.createFixture(fd);

		shape.dispose();
		return fBody;
	}

	public Body createRightHexTooth(float xo, float yo, float dx, float dy, float resize) {
		PolygonShape shape = new PolygonShape();

		Vector2[] verticles = new Vector2[4];
		verticles[0] = new Vector2(2.5f * 10 / utils.Constants.PPM * resize + dx,
				-1.5f * 10 / utils.Constants.PPM * resize + dy);
		verticles[1] = new Vector2(2.5f * 10 / utils.Constants.PPM * resize + dx,
				1.5f * 10 / utils.Constants.PPM * resize + dy);
		verticles[2] = new Vector2(9.5f * 10 / utils.Constants.PPM * resize + dx,
				-0.5f * 10 / utils.Constants.PPM * resize + dy);
		verticles[3] = new Vector2(9.5f * 10 / utils.Constants.PPM * resize + dx,
				0.5f * 10 / utils.Constants.PPM * resize + dy);

		Body fBody;
		BodyDef def = new BodyDef();
		def.type = BodyDef.BodyType.DynamicBody;
		def.position.set(xo * 10 / utils.Constants.PPM + dx, yo * 10 / utils.Constants.PPM + dy);
		def.fixedRotation = false;
		shape.set(verticles);
		fBody = world.createBody(def);
		FixtureDef fd = new FixtureDef();
		fd.shape = shape;
		fd.friction = 0.7f;
		fd.density = 3f;
		fd.restitution = 0.5f;
		fBody.createFixture(fd);

		shape.dispose();
		return fBody;
	}

	public Body createTopRightHexTooth(float xo, float yo, float dx, float dy, float resize) {
		PolygonShape shape = new PolygonShape();

		Vector2[] verticles = new Vector2[4];
		verticles[0] = new Vector2(0f * 10 / utils.Constants.PPM * resize + dx,
				3f * 10 / utils.Constants.PPM * resize + dy);
		verticles[1] = new Vector2(2.5f * 10 / utils.Constants.PPM * resize + dx,
				1.5f * 10 / utils.Constants.PPM * resize + dy);
		verticles[2] = new Vector2(5.9f * 10 / utils.Constants.PPM * resize + dx,
				8.7f * 10 / utils.Constants.PPM * resize + dy);
		verticles[3] = new Vector2(5.1f * 10 / utils.Constants.PPM * resize + dx,
				9.3f * 10 / utils.Constants.PPM * resize + dy);

		Body fBody;
		BodyDef def = new BodyDef();
		def.type = BodyDef.BodyType.DynamicBody;
		def.position.set(xo * 10 / utils.Constants.PPM + dx, yo * 10 / utils.Constants.PPM + dy);
		def.fixedRotation = false;
		shape.set(verticles);
		fBody = world.createBody(def);
		FixtureDef fd = new FixtureDef();
		fd.shape = shape;
		fd.friction = 0.7f;
		fd.density = 3f;
		fd.restitution = 0.5f;
		fBody.createFixture(fd);

		shape.dispose();
		return fBody;
	}

	public Body createTopLeftHexTooth(float xo, float yo, float dx, float dy, float resize) {
		PolygonShape shape = new PolygonShape();

		Vector2[] verticles = new Vector2[4];
		verticles[0] = new Vector2(0f * 10 / utils.Constants.PPM * resize + dx,
				3f * 10 / utils.Constants.PPM * resize + dy);
		verticles[1] = new Vector2(-2.5f * 10 / utils.Constants.PPM * resize + dx,
				1.5f * 10 / utils.Constants.PPM * resize + dy);
		verticles[2] = new Vector2(-5.9f * 10 / utils.Constants.PPM * resize + dx,
				8.7f * 10 / utils.Constants.PPM * resize + dy);
		verticles[3] = new Vector2(-5.1f * 10 / utils.Constants.PPM * resize + dx,
				9.3f * 10 / utils.Constants.PPM * resize + dy);

		Body fBody;
		BodyDef def = new BodyDef();
		def.type = BodyDef.BodyType.DynamicBody;
		def.position.set(xo * 10 / utils.Constants.PPM + dx, yo * 10 / utils.Constants.PPM + dy);
		def.fixedRotation = false;
		shape.set(verticles);
		fBody = world.createBody(def);
		FixtureDef fd = new FixtureDef();
		fd.shape = shape;
		fd.friction = 0.7f;
		fd.density = 3f;
		fd.restitution = 0.5f;
		fBody.createFixture(fd);

		shape.dispose();
		return fBody;
	}

	public Body createBotRightHexTooth(float xo, float yo, float dx, float dy, float resize) {
		PolygonShape shape = new PolygonShape();

		Vector2[] verticles = new Vector2[4];
		verticles[0] = new Vector2(0f * 10 / utils.Constants.PPM * resize + dx,
				-3f * 10 / utils.Constants.PPM * resize + dy);
		verticles[1] = new Vector2(2.5f * 10 / utils.Constants.PPM * resize + dx,
				-1.5f * 10 / utils.Constants.PPM * resize + dy);
		verticles[2] = new Vector2(5.9f * 10 / utils.Constants.PPM * resize + dx,
				-8.7f * 10 / utils.Constants.PPM * resize + dy);
		verticles[3] = new Vector2(5.1f * 10 / utils.Constants.PPM * resize + dx,
				-9.3f * 10 / utils.Constants.PPM * resize + dy);

		Body fBody;
		BodyDef def = new BodyDef();
		def.type = BodyDef.BodyType.DynamicBody;
		def.position.set(xo * 10 / utils.Constants.PPM + dx, yo * 10 / utils.Constants.PPM + dy);
		def.fixedRotation = false;
		shape.set(verticles);
		fBody = world.createBody(def);
		FixtureDef fd = new FixtureDef();
		fd.shape = shape;
		fd.friction = 0.7f;
		fd.density = 3f;
		fd.restitution = 0.5f;
		fBody.createFixture(fd);

		shape.dispose();
		return fBody;
	}

	public Body createBotLeftHexTooth(float xo, float yo, float dx, float dy, float resize) {
		PolygonShape shape = new PolygonShape();

		Vector2[] verticles = new Vector2[4];
		verticles[0] = new Vector2(0f * 10 / utils.Constants.PPM * resize + dx,
				-3f * 10 / utils.Constants.PPM * resize + dy);
		verticles[1] = new Vector2(-2.5f * 10 / utils.Constants.PPM * resize + dx,
				-1.5f * 10 / utils.Constants.PPM * resize + dy);
		verticles[2] = new Vector2(-5.9f * 10 / utils.Constants.PPM * resize + dx,
				-8.7f * 10 / utils.Constants.PPM * resize + dy);
		verticles[3] = new Vector2(-5.1f * 10 / utils.Constants.PPM * resize + dx,
				-9.3f * 10 / utils.Constants.PPM * resize + dy);

		Body fBody;
		BodyDef def = new BodyDef();
		def.type = BodyDef.BodyType.DynamicBody;
		def.position.set(xo * 10 / utils.Constants.PPM + dx, yo * 10 / utils.Constants.PPM + dy);
		def.fixedRotation = false;
		shape.set(verticles);
		fBody = world.createBody(def);
		FixtureDef fd = new FixtureDef();
		fd.shape = shape;
		fd.friction = 0.7f;
		fd.density = 3f;
		fd.restitution = 0.5f;
		fBody.createFixture(fd);

		shape.dispose();
		return fBody;
	}

	// Шестерня с 12 зубьями, состоит из 2 частей из-за ограничения по вершинам
	public Body createDodecangulum(float dx, float dy, float resize) {
		Vector2[] verticles = new Vector2[8];
		verticles[0] = new Vector2(-4f * 10 / utils.Constants.PPM * resize + dx,
				0 * 10 / utils.Constants.PPM * resize + dy);
		verticles[1] = new Vector2(-3.4f * 10 / utils.Constants.PPM * resize + dx,
				2f * 10 / utils.Constants.PPM * resize + dy);
		verticles[2] = new Vector2(-2.2f * 10 / utils.Constants.PPM * resize + dx,
				3.6f * 10 / utils.Constants.PPM * resize + dy);
		verticles[3] = new Vector2(0f * 10 / utils.Constants.PPM * resize + dx,
				4f * 10 / utils.Constants.PPM * resize + dy);
		verticles[4] = new Vector2(2.2f * 10 / utils.Constants.PPM * resize + dx,
				3.6f * 10 / utils.Constants.PPM * resize + dy);
		verticles[5] = new Vector2(3.4f * 10 / utils.Constants.PPM * resize + dx,
				2f * 10 / utils.Constants.PPM * resize + dy);
		verticles[6] = new Vector2(4 * 10 / utils.Constants.PPM * resize + dx,
				0 * 10 / utils.Constants.PPM * resize + dy);
		verticles[7] = new Vector2(0 * 10 / utils.Constants.PPM * resize + dx,
				0 * 10 / utils.Constants.PPM * resize + dy);
		PolygonShape shape = new PolygonShape();
		Body fBody;
		BodyDef def = new BodyDef();
		def.type = BodyDef.BodyType.DynamicBody;
		def.position.set(dx, dy);
		def.fixedRotation = false;
		fBody = world.createBody(def);
		shape.set(verticles);
		FixtureDef fd = new FixtureDef();
		fd.shape = shape;
		fd.friction = 0.5f;
		fd.density = 3f;
		fd.restitution = 0.5f;
		fBody.createFixture(fd);

		fBody.createFixture(fd);
		shape.dispose();
		return fBody;
	}

	public Body createDodecangulum2(float dx, float dy, float resize) {
		Vector2[] verticles = new Vector2[8];
		verticles[0] = new Vector2(4 * 10 / utils.Constants.PPM * resize + dx,
				0 * 10 / utils.Constants.PPM * resize + dy);
		verticles[1] = new Vector2(3.4f * 10 / utils.Constants.PPM * resize + dx,
				-2f * 10 / utils.Constants.PPM * resize + dy);
		verticles[2] = new Vector2(2.2f * 10 / utils.Constants.PPM * resize + dx,
				-3.6f * 10 / utils.Constants.PPM * resize + dy);
		verticles[3] = new Vector2(0f * 10 / utils.Constants.PPM * resize + dx,
				-4f * 10 / utils.Constants.PPM * resize + dy);
		verticles[4] = new Vector2(-2.2f * 10 / utils.Constants.PPM * resize + dx,
				-3.6f * 10 / utils.Constants.PPM * resize + dy);
		verticles[5] = new Vector2(-3.4f * 10 / utils.Constants.PPM * resize + dx,
				-2f * 10 / utils.Constants.PPM * resize + dy);
		verticles[6] = new Vector2(-4f * 10 / utils.Constants.PPM * resize + dx,
				0 * 10 / utils.Constants.PPM * resize + dy);
		verticles[7] = new Vector2(0f * 10 / utils.Constants.PPM * resize + dx,
				0 * 10 / utils.Constants.PPM * resize + dy);
		PolygonShape shape = new PolygonShape();
		Body fBody;
		BodyDef def = new BodyDef();
		def.type = BodyDef.BodyType.DynamicBody;
		def.position.set(dx, dy);
		def.fixedRotation = false;
		fBody = world.createBody(def);
		shape.set(verticles);
		FixtureDef fd = new FixtureDef();
		fd.shape = shape;
		fd.friction = 0.5f;
		fd.density = 3f;
		fd.restitution = 0.5f;
		fBody.createFixture(fd);

		fBody.createFixture(fd);
		shape.dispose();
		return fBody;
	}

	public Body createTopLeftDodecangulumTooth1(float xo, float yo, float dx, float dy, float resize) {
		PolygonShape shape = new PolygonShape();

		Vector2[] verticles = new Vector2[4];
		verticles[0] = new Vector2(0f * 10 / utils.Constants.PPM * resize + dx,
				4f * 10 / utils.Constants.PPM * resize + dy);
		verticles[1] = new Vector2(-2.2f * 10 / utils.Constants.PPM * resize + dx,
				3.6f * 10 / utils.Constants.PPM * resize + dy);
		verticles[2] = new Vector2(-2.5f * 10 / utils.Constants.PPM * resize + dx,
				11.6f * 10 / utils.Constants.PPM * resize + dy);
		verticles[3] = new Vector2(-3.6f * 10 / utils.Constants.PPM * resize + dx,
				11.3f * 10 / utils.Constants.PPM * resize + dy);

		Body fBody;
		BodyDef def = new BodyDef();
		def.type = BodyDef.BodyType.DynamicBody;
		def.position.set(xo * 10 / utils.Constants.PPM + dx, yo * 10 / utils.Constants.PPM + dy);
		def.fixedRotation = false;
		shape.set(verticles);
		fBody = world.createBody(def);
		FixtureDef fd = new FixtureDef();
		fd.shape = shape;
		fd.friction = 0.7f;
		fd.density = 3f;
		fd.restitution = 0.5f;
		fBody.createFixture(fd);

		shape.dispose();
		return fBody;
	}

	public Body createTopLeftDodecangulumTooth2(float xo, float yo, float dx, float dy, float resize) {
		PolygonShape shape = new PolygonShape();

		Vector2[] verticles = new Vector2[4];
		verticles[0] = new Vector2(-3.4f * 10 / utils.Constants.PPM * resize + dx,
				2f * 10 / utils.Constants.PPM * resize + dy);
		verticles[1] = new Vector2(-2.2f * 10 / utils.Constants.PPM * resize + dx,
				3.6f * 10 / utils.Constants.PPM * resize + dy);
		verticles[2] = new Vector2(-8.1f * 10 / utils.Constants.PPM * resize + dx,
				8.8f * 10 / utils.Constants.PPM * resize + dy);
		verticles[3] = new Vector2(-8.7f * 10 / utils.Constants.PPM * resize + dx,
				8.1f * 10 / utils.Constants.PPM * resize + dy);

		Body fBody;
		BodyDef def = new BodyDef();
		def.type = BodyDef.BodyType.DynamicBody;
		def.position.set(xo * 10 / utils.Constants.PPM + dx, yo * 10 / utils.Constants.PPM + dy);
		def.fixedRotation = false;
		shape.set(verticles);
		fBody = world.createBody(def);
		FixtureDef fd = new FixtureDef();
		fd.shape = shape;
		fd.friction = 0.7f;
		fd.density = 3f;
		fd.restitution = 0.5f;
		fBody.createFixture(fd);

		shape.dispose();
		return fBody;
	}

	public Body createTopLeftDodecangulumTooth3(float xo, float yo, float dx, float dy, float resize) {
		PolygonShape shape = new PolygonShape();

		Vector2[] verticles = new Vector2[4];
		verticles[0] = new Vector2(-4.0f * 10 / utils.Constants.PPM * resize + dx,
				0 * 10 / utils.Constants.PPM * resize + dy);
		verticles[1] = new Vector2(-3.4f * 10 / utils.Constants.PPM * resize + dx,
				2f * 10 / utils.Constants.PPM * resize + dy);
		verticles[2] = new Vector2(-11.25f * 10 / utils.Constants.PPM * resize + dx,
				3.9f * 10 / utils.Constants.PPM * resize + dy);
		verticles[3] = new Vector2(-11.5f * 10 / utils.Constants.PPM * resize + dx,
				2.7f * 10 / utils.Constants.PPM * resize + dy);

		Body fBody;
		BodyDef def = new BodyDef();
		def.type = BodyDef.BodyType.DynamicBody;
		def.position.set(xo * 10 / utils.Constants.PPM + dx, yo * 10 / utils.Constants.PPM + dy);
		def.fixedRotation = false;
		shape.set(verticles);
		fBody = world.createBody(def);
		FixtureDef fd = new FixtureDef();
		fd.shape = shape;
		fd.friction = 0.7f;
		fd.density = 3f;
		fd.restitution = 0.5f;
		fBody.createFixture(fd);

		shape.dispose();
		return fBody;
	}

	public Body createTopRightDodecangulumTooth1(float xo, float yo, float dx, float dy, float resize) {
		PolygonShape shape = new PolygonShape();

		Vector2[] verticles = new Vector2[4];
		verticles[0] = new Vector2(0f * 10 / utils.Constants.PPM * resize + dx,
				4f * 10 / utils.Constants.PPM * resize + dy);
		verticles[1] = new Vector2(2.2f * 10 / utils.Constants.PPM * resize + dx,
				3.6f * 10 / utils.Constants.PPM * resize + dy);
		verticles[2] = new Vector2(2.5f * 10 / utils.Constants.PPM * resize + dx,
				11.6f * 10 / utils.Constants.PPM * resize + dy);
		verticles[3] = new Vector2(3.6f * 10 / utils.Constants.PPM * resize + dx,
				11.3f * 10 / utils.Constants.PPM * resize + dy);

		Body fBody;
		BodyDef def = new BodyDef();
		def.type = BodyDef.BodyType.DynamicBody;
		def.position.set(xo * 10 / utils.Constants.PPM + dx, yo * 10 / utils.Constants.PPM + dy);
		def.fixedRotation = false;
		shape.set(verticles);
		fBody = world.createBody(def);
		FixtureDef fd = new FixtureDef();
		fd.shape = shape;
		fd.friction = 0.7f;
		fd.density = 3f;
		fd.restitution = 0.5f;
		fBody.createFixture(fd);

		shape.dispose();
		return fBody;
	}

	public Body createTopRightDodecangulumTooth2(float xo, float yo, float dx, float dy, float resize) {
		PolygonShape shape = new PolygonShape();

		Vector2[] verticles = new Vector2[4];
		verticles[0] = new Vector2(3.4f * 10 / utils.Constants.PPM * resize + dx,
				2f * 10 / utils.Constants.PPM * resize + dy);
		verticles[1] = new Vector2(2.2f * 10 / utils.Constants.PPM * resize + dx,
				3.6f * 10 / utils.Constants.PPM * resize + dy);
		verticles[2] = new Vector2(8.1f * 10 / utils.Constants.PPM * resize + dx,
				8.8f * 10 / utils.Constants.PPM * resize + dy);
		verticles[3] = new Vector2(8.7f * 10 / utils.Constants.PPM * resize + dx,
				8.1f * 10 / utils.Constants.PPM * resize + dy);

		Body fBody;
		BodyDef def = new BodyDef();
		def.type = BodyDef.BodyType.DynamicBody;
		def.position.set(xo * 10 / utils.Constants.PPM + dx, yo * 10 / utils.Constants.PPM + dy);
		def.fixedRotation = false;
		shape.set(verticles);
		fBody = world.createBody(def);
		FixtureDef fd = new FixtureDef();
		fd.shape = shape;
		fd.friction = 0.7f;
		fd.density = 3f;
		fd.restitution = 0.5f;
		fBody.createFixture(fd);

		shape.dispose();
		return fBody;
	}

	public Body createTopRightDodecangulumTooth3(float xo, float yo, float dx, float dy, float resize) {
		PolygonShape shape = new PolygonShape();

		Vector2[] verticles = new Vector2[4];
		verticles[0] = new Vector2(4.0f * 10 / utils.Constants.PPM * resize + dx,
				0 * 10 / utils.Constants.PPM * resize + dy);
		verticles[1] = new Vector2(3.4f * 10 / utils.Constants.PPM * resize + dx,
				2f * 10 / utils.Constants.PPM * resize + dy);
		verticles[2] = new Vector2(11.25f * 10 / utils.Constants.PPM * resize + dx,
				3.9f * 10 / utils.Constants.PPM * resize + dy);
		verticles[3] = new Vector2(11.5f * 10 / utils.Constants.PPM * resize + dx,
				2.7f * 10 / utils.Constants.PPM * resize + dy);

		Body fBody;
		BodyDef def = new BodyDef();
		def.type = BodyDef.BodyType.DynamicBody;
		def.position.set(xo * 10 / utils.Constants.PPM + dx, yo * 10 / utils.Constants.PPM + dy);
		def.fixedRotation = false;
		shape.set(verticles);
		fBody = world.createBody(def);
		FixtureDef fd = new FixtureDef();
		fd.shape = shape;
		fd.friction = 0.7f;
		fd.density = 3f;
		fd.restitution = 0.5f;
		fBody.createFixture(fd);

		shape.dispose();
		return fBody;
	}

	public Body createBotLeftDodecangulumTooth1(float xo, float yo, float dx, float dy, float resize) {
		PolygonShape shape = new PolygonShape();

		Vector2[] verticles = new Vector2[4];
		verticles[0] = new Vector2(0f * 10 / utils.Constants.PPM * resize + dx,
				-4f * 10 / utils.Constants.PPM * resize + dy);
		verticles[1] = new Vector2(-2.2f * 10 / utils.Constants.PPM * resize + dx,
				-3.6f * 10 / utils.Constants.PPM * resize + dy);
		verticles[2] = new Vector2(-2.5f * 10 / utils.Constants.PPM * resize + dx,
				-11.6f * 10 / utils.Constants.PPM * resize + dy);
		verticles[3] = new Vector2(-3.6f * 10 / utils.Constants.PPM * resize + dx,
				-11.3f * 10 / utils.Constants.PPM * resize + dy);

		Body fBody;
		BodyDef def = new BodyDef();
		def.type = BodyDef.BodyType.DynamicBody;
		def.position.set(xo * 10 / utils.Constants.PPM + dx, yo * 10 / utils.Constants.PPM + dy);
		def.fixedRotation = false;
		shape.set(verticles);
		fBody = world.createBody(def);
		FixtureDef fd = new FixtureDef();
		fd.shape = shape;
		fd.friction = 0.7f;
		fd.density = 3f;
		fd.restitution = 0.5f;
		fBody.createFixture(fd);

		shape.dispose();
		return fBody;
	}

	public Body createBotLeftDodecangulumTooth2(float xo, float yo, float dx, float dy, float resize) {
		PolygonShape shape = new PolygonShape();

		Vector2[] verticles = new Vector2[4];
		verticles[0] = new Vector2(-3.4f * 10 / utils.Constants.PPM * resize + dx,
				-2f * 10 / utils.Constants.PPM * resize + dy);
		verticles[1] = new Vector2(-2.2f * 10 / utils.Constants.PPM * resize + dx,
				-3.6f * 10 / utils.Constants.PPM * resize + dy);
		verticles[2] = new Vector2(-8.1f * 10 / utils.Constants.PPM * resize + dx,
				-8.8f * 10 / utils.Constants.PPM * resize + dy);
		verticles[3] = new Vector2(-8.7f * 10 / utils.Constants.PPM * resize + dx,
				-8.1f * 10 / utils.Constants.PPM * resize + dy);

		Body fBody;
		BodyDef def = new BodyDef();
		def.type = BodyDef.BodyType.DynamicBody;
		def.position.set(xo * 10 / utils.Constants.PPM + dx, yo * 10 / utils.Constants.PPM + dy);
		def.fixedRotation = false;
		shape.set(verticles);
		fBody = world.createBody(def);
		FixtureDef fd = new FixtureDef();
		fd.shape = shape;
		fd.friction = 0.7f;
		fd.density = 3f;
		fd.restitution = 0.5f;
		fBody.createFixture(fd);

		shape.dispose();
		return fBody;
	}

	public Body createBotLeftDodecangulumTooth3(float xo, float yo, float dx, float dy, float resize) {
		PolygonShape shape = new PolygonShape();

		Vector2[] verticles = new Vector2[4];
		verticles[0] = new Vector2(-4.0f * 10 / utils.Constants.PPM * resize + dx,
				0 * 10 / utils.Constants.PPM * resize + dy);
		verticles[1] = new Vector2(-3.4f * 10 / utils.Constants.PPM * resize + dx,
				-2f * 10 / utils.Constants.PPM * resize + dy);
		verticles[2] = new Vector2(-11.25f * 10 / utils.Constants.PPM * resize + dx,
				-3.9f * 10 / utils.Constants.PPM * resize + dy);
		verticles[3] = new Vector2(-11.5f * 10 / utils.Constants.PPM * resize + dx,
				-2.7f * 10 / utils.Constants.PPM * resize + dy);

		Body fBody;
		BodyDef def = new BodyDef();
		def.type = BodyDef.BodyType.DynamicBody;
		def.position.set(xo * 10 / utils.Constants.PPM + dx, yo * 10 / utils.Constants.PPM + dy);
		def.fixedRotation = false;
		shape.set(verticles);
		fBody = world.createBody(def);
		FixtureDef fd = new FixtureDef();
		fd.shape = shape;
		fd.friction = 0.7f;
		fd.density = 3f;
		fd.restitution = 0.5f;
		fBody.createFixture(fd);

		shape.dispose();
		return fBody;
	}

	public Body createBotRightDodecangulumTooth1(float xo, float yo, float dx, float dy, float resize) {
		PolygonShape shape = new PolygonShape();

		Vector2[] verticles = new Vector2[4];
		verticles[0] = new Vector2(0f * 10 / utils.Constants.PPM * resize + dx,
				-4f * 10 / utils.Constants.PPM * resize + dy);
		verticles[1] = new Vector2(2.2f * 10 / utils.Constants.PPM * resize + dx,
				-3.6f * 10 / utils.Constants.PPM * resize + dy);
		verticles[2] = new Vector2(2.5f * 10 / utils.Constants.PPM * resize + dx,
				-11.6f * 10 / utils.Constants.PPM * resize + dy);
		verticles[3] = new Vector2(3.6f * 10 / utils.Constants.PPM * resize + dx,
				-11.3f * 10 / utils.Constants.PPM * resize + dy);

		Body fBody;
		BodyDef def = new BodyDef();
		def.type = BodyDef.BodyType.DynamicBody;
		def.position.set(xo * 10 / utils.Constants.PPM + dx, yo * 10 / utils.Constants.PPM + dy);
		def.fixedRotation = false;
		shape.set(verticles);
		fBody = world.createBody(def);
		FixtureDef fd = new FixtureDef();
		fd.shape = shape;
		fd.friction = 0.7f;
		fd.density = 3f;
		fd.restitution = 0.5f;
		fBody.createFixture(fd);

		shape.dispose();
		return fBody;
	}

	public Body createBotRightDodecangulumTooth2(float xo, float yo, float dx, float dy, float resize) {
		PolygonShape shape = new PolygonShape();

		Vector2[] verticles = new Vector2[4];
		verticles[0] = new Vector2(3.4f * 10 / utils.Constants.PPM * resize + dx,
				-2f * 10 / utils.Constants.PPM * resize + dy);
		verticles[1] = new Vector2(2.2f * 10 / utils.Constants.PPM * resize + dx,
				-3.6f * 10 / utils.Constants.PPM * resize + dy);
		verticles[2] = new Vector2(8.1f * 10 / utils.Constants.PPM * resize + dx,
				-8.8f * 10 / utils.Constants.PPM * resize + dy);
		verticles[3] = new Vector2(8.7f * 10 / utils.Constants.PPM * resize + dx,
				-8.1f * 10 / utils.Constants.PPM * resize + dy);

		Body fBody;
		BodyDef def = new BodyDef();
		def.type = BodyDef.BodyType.DynamicBody;
		def.position.set(xo * 10 / utils.Constants.PPM + dx, yo * 10 / utils.Constants.PPM + dy);
		def.fixedRotation = false;
		shape.set(verticles);
		fBody = world.createBody(def);
		FixtureDef fd = new FixtureDef();
		fd.shape = shape;
		fd.friction = 0.7f;
		fd.density = 3f;
		fd.restitution = 0.5f;
		fBody.createFixture(fd);

		shape.dispose();
		return fBody;
	}

	public Body createBotRightDodecangulumTooth3(float xo, float yo, float dx, float dy, float resize) {
		PolygonShape shape = new PolygonShape();

		Vector2[] verticles = new Vector2[4];
		verticles[0] = new Vector2(4.0f * 10 / utils.Constants.PPM * resize + dx,
				0 * 10 / utils.Constants.PPM * resize + dy);
		verticles[1] = new Vector2(3.4f * 10 / utils.Constants.PPM * resize + dx,
				-2f * 10 / utils.Constants.PPM * resize + dy);
		verticles[2] = new Vector2(11.25f * 10 / utils.Constants.PPM * resize + dx,
				-3.9f * 10 / utils.Constants.PPM * resize + dy);
		verticles[3] = new Vector2(11.5f * 10 / utils.Constants.PPM * resize + dx,
				-2.7f * 10 / utils.Constants.PPM * resize + dy);

		Body fBody;
		BodyDef def = new BodyDef();
		def.type = BodyDef.BodyType.DynamicBody;
		def.position.set(xo * 10 / utils.Constants.PPM + dx, yo * 10 / utils.Constants.PPM + dy);
		def.fixedRotation = false;
		shape.set(verticles);
		fBody = world.createBody(def);
		FixtureDef fd = new FixtureDef();
		fd.shape = shape;
		fd.friction = 0.7f;
		fd.density = 3f;
		fd.restitution = 0.5f;
		fBody.createFixture(fd);

		shape.dispose();
		return fBody;
	}

	// шестерня с 24 зубьями задается, как 4 связанных полигона
	public Body createtwentyfourteethcog1(float dx, float dy, float resize) {
		Vector2[] verticles = new Vector2[8];
		verticles[0] = new Vector2(0 * 10 / utils.Constants.PPM * resize + dx,
				8f * 10 / utils.Constants.PPM * resize + dy);
		verticles[1] = new Vector2(2.1f * 10 / utils.Constants.PPM * resize + dx,
				7.6f * 10 / utils.Constants.PPM * resize + dy);
		verticles[2] = new Vector2(4f * 10 / utils.Constants.PPM * resize + dx,
				6.9f * 10 / utils.Constants.PPM * resize + dy);
		verticles[3] = new Vector2(5.6f * 10 / utils.Constants.PPM * resize + dx,
				5.6f * 10 / utils.Constants.PPM * resize + dy);
		verticles[4] = new Vector2(6.9f * 10 / utils.Constants.PPM * resize + dx,
				4f * 10 / utils.Constants.PPM * resize + dy);
		verticles[5] = new Vector2(7.6f * 10 / utils.Constants.PPM * resize + dx,
				2.1f * 10 / utils.Constants.PPM * resize + dy);
		verticles[6] = new Vector2(8f * 10 / utils.Constants.PPM * resize + dx,
				0 * 10 / utils.Constants.PPM * resize + dy);
		verticles[7] = new Vector2(0f * 10 / utils.Constants.PPM * resize + dx,
				0 * 10 / utils.Constants.PPM * resize + dy);
		PolygonShape shape = new PolygonShape();
		Body fBody;
		BodyDef def = new BodyDef();
		def.type = BodyDef.BodyType.DynamicBody;
		def.position.set(dx, dy);
		def.fixedRotation = false;
		fBody = world.createBody(def);
		shape.set(verticles);
		FixtureDef fd = new FixtureDef();
		fd.shape = shape;
		fd.friction = 0.5f;
		fd.density = 3f;
		fd.restitution = 0.5f;
		fBody.createFixture(fd);
		fBody.createFixture(fd);
		shape.dispose();
		return fBody;
	}

	public Body createtwentyfourteethcog2(float dx, float dy, float resize) {
		Vector2[] verticles = new Vector2[8];
		verticles[0] = new Vector2(0 * 10 / utils.Constants.PPM * resize + dx,
				-8f * 10 / utils.Constants.PPM * resize + dy);
		verticles[1] = new Vector2(2.1f * 10 / utils.Constants.PPM * resize + dx,
				-7.6f * 10 / utils.Constants.PPM * resize + dy);
		verticles[2] = new Vector2(4f * 10 / utils.Constants.PPM * resize + dx,
				-6.9f * 10 / utils.Constants.PPM * resize + dy);
		verticles[3] = new Vector2(5.6f * 10 / utils.Constants.PPM * resize + dx,
				-5.6f * 10 / utils.Constants.PPM * resize + dy);
		verticles[4] = new Vector2(6.9f * 10 / utils.Constants.PPM * resize + dx,
				-4f * 10 / utils.Constants.PPM * resize + dy);
		verticles[5] = new Vector2(7.6f * 10 / utils.Constants.PPM * resize + dx,
				-2.1f * 10 / utils.Constants.PPM * resize + dy);
		verticles[6] = new Vector2(8f * 10 / utils.Constants.PPM * resize + dx,
				0 * 10 / utils.Constants.PPM * resize + dy);
		verticles[7] = new Vector2(0f * 10 / utils.Constants.PPM * resize + dx,
				0 * 10 / utils.Constants.PPM * resize + dy);
		PolygonShape shape = new PolygonShape();
		Body fBody;
		BodyDef def = new BodyDef();
		def.type = BodyDef.BodyType.DynamicBody;
		def.position.set(dx, dy);
		def.fixedRotation = false;
		fBody = world.createBody(def);
		shape.set(verticles);
		FixtureDef fd = new FixtureDef();
		fd.shape = shape;
		fd.friction = 0.5f;
		fd.density = 3f;
		fd.restitution = 0.5f;
		fBody.createFixture(fd);
		fBody.createFixture(fd);
		shape.dispose();
		return fBody;
	}

	public Body createtwentyfourteethcog3(float dx, float dy, float resize) {
		Vector2[] verticles = new Vector2[8];
		verticles[0] = new Vector2(0 * 10f / utils.Constants.PPM * resize + dx,
				-8f * 10 / utils.Constants.PPM * resize + dy);
		verticles[1] = new Vector2(-2.1f * 10 / utils.Constants.PPM * resize + dx,
				-7.6f * 10 / utils.Constants.PPM * resize + dy);
		verticles[2] = new Vector2(-4f * 10 / utils.Constants.PPM * resize + dx,
				-6.9f * 10 / utils.Constants.PPM * resize + dy);
		verticles[3] = new Vector2(-5.6f * 10 / utils.Constants.PPM * resize + dx,
				-5.6f * 10 / utils.Constants.PPM * resize + dy);
		verticles[4] = new Vector2(-6.9f * 10 / utils.Constants.PPM * resize + dx,
				-4f * 10 / utils.Constants.PPM * resize + dy);
		verticles[5] = new Vector2(-7.6f * 10 / utils.Constants.PPM * resize + dx,
				-2.1f * 10 / utils.Constants.PPM * resize + dy);
		verticles[6] = new Vector2(-8f * 10 / utils.Constants.PPM * resize + dx,
				0 * 10 / utils.Constants.PPM * resize + dy);
		verticles[7] = new Vector2(0f * 10 / utils.Constants.PPM * resize + dx,
				0 * 10 / utils.Constants.PPM * resize + dy);
		PolygonShape shape = new PolygonShape();
		Body fBody;
		BodyDef def = new BodyDef();
		def.type = BodyDef.BodyType.DynamicBody;
		def.position.set(dx, dy);
		def.fixedRotation = false;
		fBody = world.createBody(def);
		shape.set(verticles);
		FixtureDef fd = new FixtureDef();
		fd.shape = shape;
		fd.friction = 0.5f;
		fd.density = 3f;
		fd.restitution = 0.5f;
		fBody.createFixture(fd);
		fBody.createFixture(fd);
		shape.dispose();
		return fBody;
	}

	public Body createtwentyfourteethcog4(float dx, float dy, float resize) {
		Vector2[] verticles = new Vector2[8];
		verticles[0] = new Vector2(-0 * 10 / utils.Constants.PPM * resize + dx,
				8 * 10 / utils.Constants.PPM * resize + dy);
		verticles[1] = new Vector2(-2.1f * 10 / utils.Constants.PPM * resize + dx,
				7.6f * 10 / utils.Constants.PPM * resize + dy);
		verticles[2] = new Vector2(-4f * 10 / utils.Constants.PPM * resize + dx,
				6.9f * 10 / utils.Constants.PPM * resize + dy);
		verticles[3] = new Vector2(-5.6f * 10 / utils.Constants.PPM * resize + dx,
				5.6f * 10 / utils.Constants.PPM * resize + dy);
		verticles[4] = new Vector2(-6.9f * 10 / utils.Constants.PPM * resize + dx,
				4f * 10 / utils.Constants.PPM * resize + dy);
		verticles[5] = new Vector2(-7.6f * 10 / utils.Constants.PPM * resize + dx,
				2.1f * 10 / utils.Constants.PPM * resize + dy);
		verticles[6] = new Vector2(-8f * 10 / utils.Constants.PPM * resize + dx,
				0 * 10 / utils.Constants.PPM * resize + dy);
		verticles[7] = new Vector2(0f * 10 / utils.Constants.PPM * resize + dx,
				0 * 10 / utils.Constants.PPM * resize + dy);
		PolygonShape shape = new PolygonShape();
		Body fBody;
		BodyDef def = new BodyDef();
		def.type = BodyDef.BodyType.DynamicBody;
		def.position.set(dx, dy);
		def.fixedRotation = false;
		fBody = world.createBody(def);
		shape.set(verticles);
		FixtureDef fd = new FixtureDef();
		fd.shape = shape;
		fd.friction = 0.5f;
		fd.density = 3f;
		fd.restitution = 0.5f;
		fBody.createFixture(fd);
		fBody.createFixture(fd);
		shape.dispose();
		return fBody;
	}

	public Body createtwentyfourteethcogTopRightTooth1(float xo, float yo, float dx, float dy, float resize) {
		PolygonShape shape = new PolygonShape();

		Vector2[] verticles = new Vector2[4];
		verticles[0] = new Vector2(0f * 10 / utils.Constants.PPM * resize + dx,
				8f * 10 / utils.Constants.PPM * resize + dy);
		verticles[1] = new Vector2(2.1f * 10 / utils.Constants.PPM * resize + dx,
				7.6f * 10 / utils.Constants.PPM * resize + dy);
		verticles[2] = new Vector2(2.0f * 10 / utils.Constants.PPM * resize + dx,
				15.8f * 10 / utils.Constants.PPM * resize + dy);
		verticles[3] = new Vector2(3.0f * 10 / utils.Constants.PPM * resize + dx,
				15.6f * 10 / utils.Constants.PPM * resize + dy);

		Body fBody;
		BodyDef def = new BodyDef();
		def.type = BodyDef.BodyType.DynamicBody;
		def.position.set(xo * 10 / utils.Constants.PPM + dx, yo * 10 / utils.Constants.PPM + dy);
		def.fixedRotation = false;
		shape.set(verticles);
		fBody = world.createBody(def);
		FixtureDef fd = new FixtureDef();
		fd.shape = shape;
		fd.friction = 0.7f;
		fd.density = 3f;
		fd.restitution = 0.5f;
		fBody.createFixture(fd);

		shape.dispose();
		return fBody;
	}

	public Body createtwentyfourteethcogTopRightTooth2(float xo, float yo, float dx, float dy, float resize) {
		PolygonShape shape = new PolygonShape();

		Vector2[] verticles = new Vector2[4];
		verticles[0] = new Vector2(4f * 10 / utils.Constants.PPM * resize + dx,
				6.9f * 10 / utils.Constants.PPM * resize + dy);
		verticles[1] = new Vector2(2.1f * 10 / utils.Constants.PPM * resize + dx,
				7.6f * 10 / utils.Constants.PPM * resize + dy);

		verticles[2] = new Vector2(5.6f * 10 / utils.Constants.PPM * resize + dx,
				14.9f * 10 / utils.Constants.PPM * resize + dy);
		verticles[3] = new Vector2(6.6f * 10 / utils.Constants.PPM * resize + dx,
				14.5f * 10 / utils.Constants.PPM * resize + dy);
		Body fBody;
		BodyDef def = new BodyDef();
		def.type = BodyDef.BodyType.DynamicBody;
		def.position.set(xo * 10 / utils.Constants.PPM + dx, yo * 10 / utils.Constants.PPM + dy);
		def.fixedRotation = false;
		shape.set(verticles);
		fBody = world.createBody(def);
		FixtureDef fd = new FixtureDef();
		fd.shape = shape;
		fd.friction = 0.7f;
		fd.density = 3f;
		fd.restitution = 0.5f;
		fBody.createFixture(fd);
		shape.dispose();
		return fBody;
	}

	public Body createtwentyfourteethcogTopRightTooth3(float xo, float yo, float dx, float dy, float resize) {
		PolygonShape shape = new PolygonShape();

		Vector2[] verticles = new Vector2[4];
		verticles[0] = new Vector2(4f * 10 / utils.Constants.PPM * resize + dx,
				6.9f * 10 / utils.Constants.PPM * resize + dy);
		verticles[1] = new Vector2(5.6f * 10 / utils.Constants.PPM * resize + dx,
				5.6f * 10 / utils.Constants.PPM * resize + dy);

		verticles[2] = new Vector2(10.2f * 10 / utils.Constants.PPM * resize + dx,
				12.2f * 10 / utils.Constants.PPM * resize + dy);
		verticles[3] = new Vector2(9.5f * 10 / utils.Constants.PPM * resize + dx,
				12.8f * 10 / utils.Constants.PPM * resize + dy);

		Body fBody;
		BodyDef def = new BodyDef();
		def.type = BodyDef.BodyType.DynamicBody;
		def.position.set(xo * 10 / utils.Constants.PPM + dx, yo * 10 / utils.Constants.PPM + dy);
		def.fixedRotation = false;
		shape.set(verticles);
		fBody = world.createBody(def);
		FixtureDef fd = new FixtureDef();
		fd.shape = shape;
		fd.friction = 0.7f;
		fd.density = 3f;
		fd.restitution = 0.5f;
		fBody.createFixture(fd);
		shape.dispose();
		return fBody;
	}

	public Body createtwentyfourteethcogTopRightTooth4(float xo, float yo, float dx, float dy, float resize) {
		PolygonShape shape = new PolygonShape();

		Vector2[] verticles = new Vector2[4];
		verticles[0] = new Vector2(6.9f * 10 / utils.Constants.PPM * resize + dx,
				4.0f * 10 / utils.Constants.PPM * resize + dy);
		verticles[1] = new Vector2(5.6f * 10 / utils.Constants.PPM * resize + dx,
				5.6f * 10 / utils.Constants.PPM * resize + dy);
		verticles[2] = new Vector2(12.2f * 10 / utils.Constants.PPM * resize + dx,
				10.2f * 10 / utils.Constants.PPM * resize + dy);
		verticles[3] = new Vector2(12.8f * 10 / utils.Constants.PPM * resize + dx,
				9.5f * 10 / utils.Constants.PPM * resize + dy);
		Body fBody;
		BodyDef def = new BodyDef();
		def.type = BodyDef.BodyType.DynamicBody;
		def.position.set(xo * 10 / utils.Constants.PPM + dx, yo * 10 / utils.Constants.PPM + dy);
		def.fixedRotation = false;
		shape.set(verticles);
		fBody = world.createBody(def);
		FixtureDef fd = new FixtureDef();
		fd.shape = shape;
		fd.friction = 0.7f;
		fd.density = 3f;
		fd.restitution = 0.5f;
		fBody.createFixture(fd);
		shape.dispose();
		return fBody;
	}

	public Body createtwentyfourteethcogTopRightTooth5(float xo, float yo, float dx, float dy, float resize) {
		PolygonShape shape = new PolygonShape();

		Vector2[] verticles = new Vector2[4];
		verticles[0] = new Vector2(6.9f * 10 / utils.Constants.PPM * resize + dx,
				4.0f * 10 / utils.Constants.PPM * resize + dy);
		verticles[1] = new Vector2(7.6f * 10 / utils.Constants.PPM * resize + dx,
				2.1f * 10 / utils.Constants.PPM * resize + dy);

		verticles[2] = new Vector2(14.5f * 10 / utils.Constants.PPM * resize + dx,
				6.6f * 10 / utils.Constants.PPM * resize + dy);
		verticles[3] = new Vector2(14.9f * 10 / utils.Constants.PPM * resize + dx,
				5.6f * 10 / utils.Constants.PPM * resize + dy);
		Body fBody;
		BodyDef def = new BodyDef();
		def.type = BodyDef.BodyType.DynamicBody;
		def.position.set(xo * 10 / utils.Constants.PPM + dx, yo * 10 / utils.Constants.PPM + dy);
		def.fixedRotation = false;
		shape.set(verticles);
		fBody = world.createBody(def);
		FixtureDef fd = new FixtureDef();
		fd.shape = shape;
		fd.friction = 0.7f;
		fd.density = 3f;
		fd.restitution = 0.5f;
		fBody.createFixture(fd);
		shape.dispose();
		return fBody;
	}

	public Body createtwentyfourteethcogTopRightTooth6(float xo, float yo, float dx, float dy, float resize) {
		PolygonShape shape = new PolygonShape();

		Vector2[] verticles = new Vector2[4];
		verticles[0] = new Vector2(8f * 10 / utils.Constants.PPM * resize + dx,
				0.0f * 10 / utils.Constants.PPM * resize + dy);
		verticles[1] = new Vector2(7.6f * 10 / utils.Constants.PPM * resize + dx,
				2.1f * 10 / utils.Constants.PPM * resize + dy);

		verticles[2] = new Vector2(15.8f * 10 / utils.Constants.PPM * resize + dx,
				2.0f * 10 / utils.Constants.PPM * resize + dy);

		verticles[3] = new Vector2(15.6f * 10 / utils.Constants.PPM * resize + dx,
				3.0f * 10 / utils.Constants.PPM * resize + dy);
		Body fBody;
		BodyDef def = new BodyDef();
		def.type = BodyDef.BodyType.DynamicBody;
		def.position.set(xo * 10 / utils.Constants.PPM + dx, yo * 10 / utils.Constants.PPM + dy);
		def.fixedRotation = false;
		shape.set(verticles);
		fBody = world.createBody(def);
		FixtureDef fd = new FixtureDef();
		fd.shape = shape;
		fd.friction = 0.7f;
		fd.density = 3f;
		fd.restitution = 0.5f;
		fBody.createFixture(fd);
		shape.dispose();
		return fBody;
	}

	public Body createtwentyfourteethcogTopLeftTooth1(float xo, float yo, float dx, float dy, float resize) {
		PolygonShape shape = new PolygonShape();

		Vector2[] verticles = new Vector2[4];
		verticles[0] = new Vector2(0f * 10 / utils.Constants.PPM * resize + dx,
				8f * 10 / utils.Constants.PPM * resize + dy);
		verticles[1] = new Vector2(-2.1f * 10 / utils.Constants.PPM * resize + dx,
				7.6f * 10 / utils.Constants.PPM * resize + dy);
		verticles[2] = new Vector2(-2.0f * 10 / utils.Constants.PPM * resize + dx,
				15.8f * 10 / utils.Constants.PPM * resize + dy);
		verticles[3] = new Vector2(-3.0f * 10 / utils.Constants.PPM * resize + dx,
				15.6f * 10 / utils.Constants.PPM * resize + dy);

		Body fBody;
		BodyDef def = new BodyDef();
		def.type = BodyDef.BodyType.DynamicBody;
		def.position.set(xo * 10 / utils.Constants.PPM + dx, yo * 10 / utils.Constants.PPM + dy);
		def.fixedRotation = false;
		shape.set(verticles);
		fBody = world.createBody(def);
		FixtureDef fd = new FixtureDef();
		fd.shape = shape;
		fd.friction = 0.7f;
		fd.density = 3f;
		fd.restitution = 0.5f;
		fBody.createFixture(fd);

		shape.dispose();
		return fBody;
	}

	public Body createtwentyfourteethcogTopLeftTooth2(float xo, float yo, float dx, float dy, float resize) {
		PolygonShape shape = new PolygonShape();

		Vector2[] verticles = new Vector2[4];
		verticles[0] = new Vector2(-4f * 10 / utils.Constants.PPM * resize + dx,
				6.9f * 10 / utils.Constants.PPM * resize + dy);
		verticles[1] = new Vector2(-2.1f * 10 / utils.Constants.PPM * resize + dx,
				7.6f * 10 / utils.Constants.PPM * resize + dy);

		verticles[2] = new Vector2(-5.6f * 10 / utils.Constants.PPM * resize + dx,
				14.9f * 10 / utils.Constants.PPM * resize + dy);
		verticles[3] = new Vector2(-6.6f * 10 / utils.Constants.PPM * resize + dx,
				14.5f * 10 / utils.Constants.PPM * resize + dy);
		Body fBody;
		BodyDef def = new BodyDef();
		def.type = BodyDef.BodyType.DynamicBody;
		def.position.set(xo * 10 / utils.Constants.PPM + dx, yo * 10 / utils.Constants.PPM + dy);
		def.fixedRotation = false;
		shape.set(verticles);
		fBody = world.createBody(def);
		FixtureDef fd = new FixtureDef();
		fd.shape = shape;
		fd.friction = 0.7f;
		fd.density = 3f;
		fd.restitution = 0.5f;
		fBody.createFixture(fd);
		shape.dispose();
		return fBody;
	}

	public Body createtwentyfourteethcogTopLeftTooth3(float xo, float yo, float dx, float dy, float resize) {
		PolygonShape shape = new PolygonShape();

		Vector2[] verticles = new Vector2[4];
		verticles[0] = new Vector2(-4f * 10 / utils.Constants.PPM * resize + dx,
				6.9f * 10 / utils.Constants.PPM * resize + dy);
		verticles[1] = new Vector2(-5.6f * 10 / utils.Constants.PPM * resize + dx,
				5.6f * 10 / utils.Constants.PPM * resize + dy);

		verticles[2] = new Vector2(-10.2f * 10 / utils.Constants.PPM * resize + dx,
				12.2f * 10 / utils.Constants.PPM * resize + dy);
		verticles[3] = new Vector2(-9.5f * 10 / utils.Constants.PPM * resize + dx,
				12.8f * 10 / utils.Constants.PPM * resize + dy);

		Body fBody;
		BodyDef def = new BodyDef();
		def.type = BodyDef.BodyType.DynamicBody;
		def.position.set(xo * 10 / utils.Constants.PPM + dx, yo * 10 / utils.Constants.PPM + dy);
		def.fixedRotation = false;
		shape.set(verticles);
		fBody = world.createBody(def);
		FixtureDef fd = new FixtureDef();
		fd.shape = shape;
		fd.friction = 0.7f;
		fd.density = 3f;
		fd.restitution = 0.5f;
		fBody.createFixture(fd);
		shape.dispose();
		return fBody;
	}

	public Body createtwentyfourteethcogTopLeftTooth4(float xo, float yo, float dx, float dy, float resize) {
		PolygonShape shape = new PolygonShape();

		Vector2[] verticles = new Vector2[4];
		verticles[0] = new Vector2(-6.9f * 10 / utils.Constants.PPM * resize + dx,
				4.0f * 10 / utils.Constants.PPM * resize + dy);
		verticles[1] = new Vector2(-5.6f * 10 / utils.Constants.PPM * resize + dx,
				5.6f * 10 / utils.Constants.PPM * resize + dy);
		verticles[2] = new Vector2(-12.2f * 10 / utils.Constants.PPM * resize + dx,
				10.2f * 10 / utils.Constants.PPM * resize + dy);
		verticles[3] = new Vector2(-12.8f * 10 / utils.Constants.PPM * resize + dx,
				9.5f * 10 / utils.Constants.PPM * resize + dy);
		Body fBody;
		BodyDef def = new BodyDef();
		def.type = BodyDef.BodyType.DynamicBody;
		def.position.set(xo * 10 / utils.Constants.PPM + dx, yo * 10 / utils.Constants.PPM + dy);
		def.fixedRotation = false;
		shape.set(verticles);
		fBody = world.createBody(def);
		FixtureDef fd = new FixtureDef();
		fd.shape = shape;
		fd.friction = 0.7f;
		fd.density = 3f;
		fd.restitution = 0.5f;
		fBody.createFixture(fd);
		shape.dispose();
		return fBody;
	}

	public Body createtwentyfourteethcogTopLeftTooth5(float xo, float yo, float dx, float dy, float resize) {
		PolygonShape shape = new PolygonShape();

		Vector2[] verticles = new Vector2[4];
		verticles[0] = new Vector2(-6.9f * 10 / utils.Constants.PPM * resize + dx,
				4.0f * 10 / utils.Constants.PPM * resize + dy);
		verticles[1] = new Vector2(-7.6f * 10 / utils.Constants.PPM * resize + dx,
				2.1f * 10 / utils.Constants.PPM * resize + dy);

		verticles[2] = new Vector2(-14.5f * 10 / utils.Constants.PPM * resize + dx,
				6.6f * 10 / utils.Constants.PPM * resize + dy);
		verticles[3] = new Vector2(-14.9f * 10 / utils.Constants.PPM * resize + dx,
				5.6f * 10 / utils.Constants.PPM * resize + dy);
		Body fBody;
		BodyDef def = new BodyDef();
		def.type = BodyDef.BodyType.DynamicBody;
		def.position.set(xo * 10 / utils.Constants.PPM + dx, yo * 10 / utils.Constants.PPM + dy);
		def.fixedRotation = false;
		shape.set(verticles);
		fBody = world.createBody(def);
		FixtureDef fd = new FixtureDef();
		fd.shape = shape;
		fd.friction = 0.7f;
		fd.density = 3f;
		fd.restitution = 0.5f;
		fBody.createFixture(fd);
		shape.dispose();
		return fBody;
	}

	public Body createtwentyfourteethcogTopLeftTooth6(float xo, float yo, float dx, float dy, float resize) {
		PolygonShape shape = new PolygonShape();

		Vector2[] verticles = new Vector2[4];
		verticles[0] = new Vector2(-8f * 10 / utils.Constants.PPM * resize + dx,
				0.0f * 10 / utils.Constants.PPM * resize + dy);
		verticles[1] = new Vector2(-7.6f * 10 / utils.Constants.PPM * resize + dx,
				2.1f * 10 / utils.Constants.PPM * resize + dy);

		verticles[2] = new Vector2(-15.8f * 10 / utils.Constants.PPM * resize + dx,
				2.0f * 10 / utils.Constants.PPM * resize + dy);

		verticles[3] = new Vector2(-15.6f * 10 / utils.Constants.PPM * resize + dx,
				3.0f * 10 / utils.Constants.PPM * resize + dy);
		Body fBody;
		BodyDef def = new BodyDef();
		def.type = BodyDef.BodyType.DynamicBody;
		def.position.set(xo * 10 / utils.Constants.PPM + dx, yo * 10 / utils.Constants.PPM + dy);
		def.fixedRotation = false;
		shape.set(verticles);
		fBody = world.createBody(def);
		FixtureDef fd = new FixtureDef();
		fd.shape = shape;
		fd.friction = 0.7f;
		fd.density = 3f;
		fd.restitution = 0.5f;
		fBody.createFixture(fd);
		shape.dispose();
		return fBody;
	}

	public Body createtwentyfourteethcogBotRightTooth1(float xo, float yo, float dx, float dy, float resize) {
		PolygonShape shape = new PolygonShape();

		Vector2[] verticles = new Vector2[4];
		verticles[0] = new Vector2(0f * 10 / utils.Constants.PPM * resize + dx,
				-8f * 10 / utils.Constants.PPM * resize + dy);
		verticles[1] = new Vector2(2.1f * 10 / utils.Constants.PPM * resize + dx,
				-7.6f * 10 / utils.Constants.PPM * resize + dy);
		verticles[2] = new Vector2(2.0f * 10 / utils.Constants.PPM * resize + dx,
				-15.8f * 10 / utils.Constants.PPM * resize + dy);
		verticles[3] = new Vector2(3.0f * 10 / utils.Constants.PPM * resize + dx,
				-15.6f * 10 / utils.Constants.PPM * resize + dy);

		Body fBody;
		BodyDef def = new BodyDef();
		def.type = BodyDef.BodyType.DynamicBody;
		def.position.set(xo * 10 / utils.Constants.PPM + dx, yo * 10 / utils.Constants.PPM + dy);
		def.fixedRotation = false;
		shape.set(verticles);
		fBody = world.createBody(def);
		FixtureDef fd = new FixtureDef();
		fd.shape = shape;
		fd.friction = 0.7f;
		fd.density = 3f;
		fd.restitution = 0.5f;
		fBody.createFixture(fd);

		shape.dispose();
		return fBody;
	}

	public Body createtwentyfourteethcogBotRightTooth2(float xo, float yo, float dx, float dy, float resize) {
		PolygonShape shape = new PolygonShape();

		Vector2[] verticles = new Vector2[4];
		verticles[0] = new Vector2(4f * 10 / utils.Constants.PPM * resize + dx,
				-6.9f * 10 / utils.Constants.PPM * resize + dy);
		verticles[1] = new Vector2(2.1f * 10 / utils.Constants.PPM * resize + dx,
				-7.6f * 10 / utils.Constants.PPM * resize + dy);

		verticles[2] = new Vector2(5.6f * 10 / utils.Constants.PPM * resize + dx,
				-14.9f * 10 / utils.Constants.PPM * resize + dy);
		verticles[3] = new Vector2(6.6f * 10 / utils.Constants.PPM * resize + dx,
				-14.5f * 10 / utils.Constants.PPM * resize + dy);
		Body fBody;
		BodyDef def = new BodyDef();
		def.type = BodyDef.BodyType.DynamicBody;
		def.position.set(xo * 10 / utils.Constants.PPM + dx, yo * 10 / utils.Constants.PPM + dy);
		def.fixedRotation = false;
		shape.set(verticles);
		fBody = world.createBody(def);
		FixtureDef fd = new FixtureDef();
		fd.shape = shape;
		fd.friction = 0.7f;
		fd.density = 3f;
		fd.restitution = 0.5f;
		fBody.createFixture(fd);
		shape.dispose();
		return fBody;
	}

	public Body createtwentyfourteethcogBotRightTooth3(float xo, float yo, float dx, float dy, float resize) {
		PolygonShape shape = new PolygonShape();

		Vector2[] verticles = new Vector2[4];
		verticles[0] = new Vector2(4f * 10 / utils.Constants.PPM * resize + dx,
				-6.9f * 10 / utils.Constants.PPM * resize + dy);
		verticles[1] = new Vector2(5.6f * 10 / utils.Constants.PPM * resize + dx,
				-5.6f * 10 / utils.Constants.PPM * resize + dy);

		verticles[2] = new Vector2(10.2f * 10 / utils.Constants.PPM * resize + dx,
				-12.2f * 10 / utils.Constants.PPM * resize + dy);
		verticles[3] = new Vector2(9.5f * 10 / utils.Constants.PPM * resize + dx,
				-12.8f * 10 / utils.Constants.PPM * resize + dy);

		Body fBody;
		BodyDef def = new BodyDef();
		def.type = BodyDef.BodyType.DynamicBody;
		def.position.set(xo * 10 / utils.Constants.PPM + dx, yo * 10 / utils.Constants.PPM + dy);
		def.fixedRotation = false;
		shape.set(verticles);
		fBody = world.createBody(def);
		FixtureDef fd = new FixtureDef();
		fd.shape = shape;
		fd.friction = 0.7f;
		fd.density = 3f;
		fd.restitution = 0.5f;
		fBody.createFixture(fd);
		shape.dispose();
		return fBody;
	}

	public Body createtwentyfourteethcogBotRightTooth4(float xo, float yo, float dx, float dy, float resize) {
		PolygonShape shape = new PolygonShape();

		Vector2[] verticles = new Vector2[4];
		verticles[0] = new Vector2(6.9f * 10 / utils.Constants.PPM * resize + dx,
				-4.0f * 10 / utils.Constants.PPM * resize + dy);
		verticles[1] = new Vector2(5.6f * 10 / utils.Constants.PPM * resize + dx,
				-5.6f * 10 / utils.Constants.PPM * resize + dy);
		verticles[2] = new Vector2(12.2f * 10 / utils.Constants.PPM * resize + dx,
				-10.2f * 10 / utils.Constants.PPM * resize + dy);
		verticles[3] = new Vector2(12.8f * 10 / utils.Constants.PPM * resize + dx,
				-9.5f * 10 / utils.Constants.PPM * resize + dy);
		Body fBody;
		BodyDef def = new BodyDef();
		def.type = BodyDef.BodyType.DynamicBody;
		def.position.set(xo * 10 / utils.Constants.PPM + dx, yo * 10 / utils.Constants.PPM + dy);
		def.fixedRotation = false;
		shape.set(verticles);
		fBody = world.createBody(def);
		FixtureDef fd = new FixtureDef();
		fd.shape = shape;
		fd.friction = 0.7f;
		fd.density = 3f;
		fd.restitution = 0.5f;
		fBody.createFixture(fd);
		shape.dispose();
		return fBody;
	}

	public Body createtwentyfourteethcogBotRightTooth5(float xo, float yo, float dx, float dy, float resize) {
		PolygonShape shape = new PolygonShape();

		Vector2[] verticles = new Vector2[4];
		verticles[0] = new Vector2(6.9f * 10 / utils.Constants.PPM * resize + dx,
				-4.0f * 10 / utils.Constants.PPM * resize + dy);
		verticles[1] = new Vector2(7.6f * 10 / utils.Constants.PPM * resize + dx,
				-2.1f * 10 / utils.Constants.PPM * resize + dy);

		verticles[2] = new Vector2(14.5f * 10 / utils.Constants.PPM * resize + dx,
				-6.6f * 10 / utils.Constants.PPM * resize + dy);
		verticles[3] = new Vector2(14.9f * 10 / utils.Constants.PPM * resize + dx,
				-5.6f * 10 / utils.Constants.PPM * resize + dy);
		Body fBody;
		BodyDef def = new BodyDef();
		def.type = BodyDef.BodyType.DynamicBody;
		def.position.set(xo * 10 / utils.Constants.PPM + dx, yo * 10 / utils.Constants.PPM + dy);
		def.fixedRotation = false;
		shape.set(verticles);
		fBody = world.createBody(def);
		FixtureDef fd = new FixtureDef();
		fd.shape = shape;
		fd.friction = 0.7f;
		fd.density = 3f;
		fd.restitution = 0.5f;
		fBody.createFixture(fd);
		shape.dispose();
		return fBody;
	}

	public Body createtwentyfourteethcogBotRightTooth6(float xo, float yo, float dx, float dy, float resize) {
		PolygonShape shape = new PolygonShape();

		Vector2[] verticles = new Vector2[4];
		verticles[0] = new Vector2(8f * 10 / utils.Constants.PPM * resize + dx,
				0.0f * 10 / utils.Constants.PPM * resize + dy);
		verticles[1] = new Vector2(7.6f * 10 / utils.Constants.PPM * resize + dx,
				-2.1f * 10 / utils.Constants.PPM * resize + dy);

		verticles[2] = new Vector2(15.8f * 10 / utils.Constants.PPM * resize + dx,
				-2.0f * 10 / utils.Constants.PPM * resize + dy);

		verticles[3] = new Vector2(15.6f * 10 / utils.Constants.PPM * resize + dx,
				-3.0f * 10 / utils.Constants.PPM * resize + dy);
		Body fBody;
		BodyDef def = new BodyDef();
		def.type = BodyDef.BodyType.DynamicBody;
		def.position.set(xo * 10 / utils.Constants.PPM + dx, yo * 10 / utils.Constants.PPM + dy);
		def.fixedRotation = false;
		shape.set(verticles);
		fBody = world.createBody(def);
		FixtureDef fd = new FixtureDef();
		fd.shape = shape;
		fd.friction = 0.7f;
		fd.density = 3f;
		fd.restitution = 0.5f;
		fBody.createFixture(fd);
		shape.dispose();
		return fBody;
	}

	public Body createtwentyfourteethcogBotLeftTooth1(float xo, float yo, float dx, float dy, float resize) {
		PolygonShape shape = new PolygonShape();

		Vector2[] verticles = new Vector2[4];
		verticles[0] = new Vector2(0f * 10 / utils.Constants.PPM * resize + dx,
				-8f * 10 / utils.Constants.PPM * resize + dy);
		verticles[1] = new Vector2(-2.1f * 10 / utils.Constants.PPM * resize + dx,
				-7.6f * 10 / utils.Constants.PPM * resize + dy);
		verticles[2] = new Vector2(-2.0f * 10 / utils.Constants.PPM * resize + dx,
				-15.8f * 10 / utils.Constants.PPM * resize + dy);
		verticles[3] = new Vector2(-3.0f * 10 / utils.Constants.PPM * resize + dx,
				-15.6f * 10 / utils.Constants.PPM * resize + dy);

		Body fBody;
		BodyDef def = new BodyDef();
		def.type = BodyDef.BodyType.DynamicBody;
		def.position.set(xo * 10 / utils.Constants.PPM + dx, yo * 10 / utils.Constants.PPM + dy);
		def.fixedRotation = false;
		shape.set(verticles);
		fBody = world.createBody(def);
		FixtureDef fd = new FixtureDef();
		fd.shape = shape;
		fd.friction = 0.7f;
		fd.density = 3f;
		fd.restitution = 0.5f;
		fBody.createFixture(fd);

		shape.dispose();
		return fBody;
	}

	public Body createtwentyfourteethcogBotLeftTooth2(float xo, float yo, float dx, float dy, float resize) {
		PolygonShape shape = new PolygonShape();

		Vector2[] verticles = new Vector2[4];
		verticles[0] = new Vector2(-4f * 10 / utils.Constants.PPM * resize + dx,
				-6.9f * 10 / utils.Constants.PPM * resize + dy);
		verticles[1] = new Vector2(-2.1f * 10 / utils.Constants.PPM * resize + dx,
				-7.6f * 10 / utils.Constants.PPM * resize + dy);

		verticles[2] = new Vector2(-5.6f * 10 / utils.Constants.PPM * resize + dx,
				-14.9f * 10 / utils.Constants.PPM * resize + dy);
		verticles[3] = new Vector2(-6.6f * 10 / utils.Constants.PPM * resize + dx,
				-14.5f * 10 / utils.Constants.PPM * resize + dy);
		Body fBody;
		BodyDef def = new BodyDef();
		def.type = BodyDef.BodyType.DynamicBody;
		def.position.set(xo * 10 / utils.Constants.PPM + dx, yo * 10 / utils.Constants.PPM + dy);
		def.fixedRotation = false;
		shape.set(verticles);
		fBody = world.createBody(def);
		FixtureDef fd = new FixtureDef();
		fd.shape = shape;
		fd.friction = 0.7f;
		fd.density = 3f;
		fd.restitution = 0.5f;
		fBody.createFixture(fd);
		shape.dispose();
		return fBody;
	}

	public Body createtwentyfourteethcogBotLeftTooth3(float xo, float yo, float dx, float dy, float resize) {
		PolygonShape shape = new PolygonShape();

		Vector2[] verticles = new Vector2[4];
		verticles[0] = new Vector2(-4f * 10 / utils.Constants.PPM * resize + dx,
				-6.9f * 10 / utils.Constants.PPM * resize + dy);
		verticles[1] = new Vector2(-5.6f * 10 / utils.Constants.PPM * resize + dx,
				-5.6f * 10 / utils.Constants.PPM * resize + dy);

		verticles[2] = new Vector2(-10.2f * 10 / utils.Constants.PPM * resize + dx,
				-12.2f * 10 / utils.Constants.PPM * resize + dy);
		verticles[3] = new Vector2(-9.5f * 10 / utils.Constants.PPM * resize + dx,
				-12.8f * 10 / utils.Constants.PPM * resize + dy);

		Body fBody;
		BodyDef def = new BodyDef();
		def.type = BodyDef.BodyType.DynamicBody;
		def.position.set(xo * 10 / utils.Constants.PPM + dx, yo * 10 / utils.Constants.PPM + dy);
		def.fixedRotation = false;
		shape.set(verticles);
		fBody = world.createBody(def);
		FixtureDef fd = new FixtureDef();
		fd.shape = shape;
		fd.friction = 0.7f;
		fd.density = 3f;
		fd.restitution = 0.5f;
		fBody.createFixture(fd);
		shape.dispose();
		return fBody;
	}

	public Body createtwentyfourteethcogBotLeftTooth4(float xo, float yo, float dx, float dy, float resize) {
		PolygonShape shape = new PolygonShape();

		Vector2[] verticles = new Vector2[4];
		verticles[0] = new Vector2(-6.9f * 10 / utils.Constants.PPM * resize + dx,
				-4.0f * 10 / utils.Constants.PPM * resize + dy);
		verticles[1] = new Vector2(-5.6f * 10 / utils.Constants.PPM * resize + dx,
				-5.6f * 10 / utils.Constants.PPM * resize + dy);
		verticles[2] = new Vector2(-12.2f * 10 / utils.Constants.PPM * resize + dx,
				-10.2f * 10 / utils.Constants.PPM * resize + dy);
		verticles[3] = new Vector2(-12.8f * 10 / utils.Constants.PPM * resize + dx,
				-9.5f * 10 / utils.Constants.PPM * resize + dy);
		Body fBody;
		BodyDef def = new BodyDef();
		def.type = BodyDef.BodyType.DynamicBody;
		def.position.set(xo * 10 / utils.Constants.PPM + dx, yo * 10 / utils.Constants.PPM + dy);
		def.fixedRotation = false;
		shape.set(verticles);
		fBody = world.createBody(def);
		FixtureDef fd = new FixtureDef();
		fd.shape = shape;
		fd.friction = 0.7f;
		fd.density = 3f;
		fd.restitution = 0.5f;
		fBody.createFixture(fd);
		shape.dispose();
		return fBody;
	}

	public Body createtwentyfourteethcogBotLeftTooth5(float xo, float yo, float dx, float dy, float resize) {
		PolygonShape shape = new PolygonShape();

		Vector2[] verticles = new Vector2[4];
		verticles[0] = new Vector2(-6.9f * 10 / utils.Constants.PPM * resize + dx,
				-4.0f * 10 / utils.Constants.PPM * resize + dy);
		verticles[1] = new Vector2(-7.6f * 10 / utils.Constants.PPM * resize + dx,
				-2.1f * 10 / utils.Constants.PPM * resize + dy);

		verticles[2] = new Vector2(-14.5f * 10 / utils.Constants.PPM * resize + dx,
				-6.6f * 10 / utils.Constants.PPM * resize + dy);
		verticles[3] = new Vector2(-14.9f * 10 / utils.Constants.PPM * resize + dx,
				-5.6f * 10 / utils.Constants.PPM * resize + dy);
		Body fBody;
		BodyDef def = new BodyDef();
		def.type = BodyDef.BodyType.DynamicBody;
		def.position.set(xo * 10 / utils.Constants.PPM + dx, yo * 10 / utils.Constants.PPM + dy);
		def.fixedRotation = false;
		shape.set(verticles);
		fBody = world.createBody(def);
		FixtureDef fd = new FixtureDef();
		fd.shape = shape;
		fd.friction = 0.7f;
		fd.density = 3f;
		fd.restitution = 0.5f;
		fBody.createFixture(fd);
		shape.dispose();
		return fBody;
	}

	public Body createtwentyfourteethcogBotLeftTooth6(float xo, float yo, float dx, float dy, float resize) {
		PolygonShape shape = new PolygonShape();

		Vector2[] verticles = new Vector2[4];
		verticles[0] = new Vector2(-8f * 10 / utils.Constants.PPM * resize + dx,
				0.0f * 10 / utils.Constants.PPM * resize + dy);
		verticles[1] = new Vector2(-7.6f * 10 / utils.Constants.PPM * resize + dx,
				-2.1f * 10 / utils.Constants.PPM * resize + dy);

		verticles[2] = new Vector2(-15.8f * 10 / utils.Constants.PPM * resize + dx,
				-2.0f * 10 / utils.Constants.PPM * resize + dy);

		verticles[3] = new Vector2(-15.6f * 10 / utils.Constants.PPM * resize + dx,
				-3.0f * 10 / utils.Constants.PPM * resize + dy);
		Body fBody;
		BodyDef def = new BodyDef();
		def.type = BodyDef.BodyType.DynamicBody;
		def.position.set(xo * 10 / utils.Constants.PPM + dx, yo * 10 / utils.Constants.PPM + dy);
		def.fixedRotation = false;
		shape.set(verticles);
		fBody = world.createBody(def);
		FixtureDef fd = new FixtureDef();
		fd.shape = shape;
		fd.friction = 0.7f;
		fd.density = 3f;
		fd.restitution = 0.5f;
		fBody.createFixture(fd);
		shape.dispose();
		return fBody;
	}
}



image

Рисунок 3. Шестеренка с 4 зубьями.

image

Рисунок 4. Шестеренка с 6 зубьями.

image

Рисунок 5. Шестеренка с 12 зубьями.

image

Рисунок 6. Шестеренка с 24 зубьями.

Спасибо, что прочли до конца! Надеюсь, что код из этой статьи очень помог Вам в Вашем проекте!

P.S. Отвечу на все вопросы в комментариях.

Комментарии (34)


  1. BubaVV
    06.05.2019 15:04
    +1

    Это ручное разворачивание циклов что ли?


    1. neurocore
      06.05.2019 15:11

      Действительно) Автор не умеет в циклы


    1. Kopilov
      06.05.2019 15:20

      Возможно, кодогенерация из шаблона


      1. Enthusiastic_programmer Автор
        06.05.2019 15:59

        Нет, я не пользовался шаблонами.


    1. Enthusiastic_programmer Автор
      06.05.2019 15:59

      Циклы в Box2D работают с багами. Я использовал симметрию координатной плоскости, вы верно подметили.


      1. hardex
        06.05.2019 18:22

        Циклы в Box2D Кривой код работает с багами


        1. Enthusiastic_programmer Автор
          06.05.2019 18:29

          Возможно :)


  1. tvr
    06.05.2019 15:14
    +1

    Это не шестерни, а сюрикены какие-то.


    1. Enthusiastic_programmer Автор
      06.05.2019 15:58

      Я хотел сделать шестерни с острыми зубцами — тогда были бы 100% сюрикены.


      1. barkalov
        06.05.2019 17:54

        Я просто оставлю это здесь:
        image


        1. tvr
          06.05.2019 18:30

          Я вспомнил свой курсовой по деталям машин и завис до конца рабочего дня.
          Красота.


  1. argamidon
    06.05.2019 15:23

    На гифке отчётливо видны коллизии — центральной большой и правой шестерни (субьями залезают друг на друга).
    Как это понимать? Это баг самой библиотеки?


    1. Enthusiastic_programmer Автор
      06.05.2019 15:54

      Здравствуйте! Да, я сам нередко замечал подобное. На Хабре есть статья об этом.


  1. hardex
    06.05.2019 15:34

    Я очень б&*@ь надеюсь, что код чем-то сгенерирован.


    1. zagayevskiy
      06.05.2019 15:48
      +4

      Ага. Руками автора.


      1. Enthusiastic_programmer Автор
        06.05.2019 15:55
        +1

        Да, каждая строка написана вручную.


        1. Daemonis
          06.05.2019 15:57
          +1

          Думаю, пора сменить ник на OverEnthusiastic_programmer :)


          1. Enthusiastic_programmer Автор
            06.05.2019 18:08

            Здравствуйте! Да, очень много работаю! :) Но это все во благо программирования. Спасибо!


        1. zagayevskiy
          06.05.2019 18:04

          Это не повод для гордости. Я думаю, весь этот титанический код можно заменить сотней строк, которые будут генерить произвольные шестерни.


          1. Enthusiastic_programmer Автор
            06.05.2019 18:07

            Добрый день! Я доволен своим кодом, потому что он подходит мне для реализации моей задумки. При этом, я делюсь им с теми, кому он может подойти. Если вы можете предложить более оптимальное решение, то я буду рад ознакомиться с ним, поставить лайк и повысить Вам карму. Спасибо!


            1. hardex
              06.05.2019 18:34

              Какой у вас вообще план на случай, если понадобится изменить friction?


  1. GokenTanmay
    06.05.2019 15:49
    +2

    Почему шестерни спроектированы без эвольвенты?


    1. Enthusiastic_programmer Автор
      06.05.2019 15:57
      +1

      Добрый день! С эвольвентой сцепление лучше, несомненно, но ограничение полигона в Box2D по вершинам — 8 шт. При описании кривых требуется больше, я бы не смог написать так много кода.


      1. olartamonov
        06.05.2019 20:17

        я бы не смог написать так много кода


        — Чего делать можешь?
        — Могу копать…
        — А ещё что?
        — Могу не копать…
        — А лестницу построить можешь?
        — Могу, но копать дохрена придётся…


  1. cher11
    06.05.2019 16:54

    Как-то довелось сделать шестеренки на Chipmunk. Делаем круглое основание, затем циклом добавляем отдельные зубчики (для этого нужны 4 координаты — верхние края зубчика, их считаем из окружности, большей основания, и нижние края, их можно брать из окружности, идентичной основанию, по этим координатам и создаем Shape). Вот, в принципе, и всё. Код мог генерить и высокие зубчики, и низкие, и 4 зубчика, и 200.
    Зачем автор все набрал руками и чему пытается научить — загадка.


    1. Enthusiastic_programmer Автор
      06.05.2019 17:33
      -1

      Здравствуйте! Спасибо, интересный алгоритм реализации! Буду знать!


  1. Heinhain
    06.05.2019 18:57
    +1

    Как-то не верится, что при написании одних и тех же строк раз за разом не возникло ощущения, что что-то не так. Стыдно должно быть за такой код и уж точно стыдно его выкладывать на всеобщее обозрение.


    1. Enthusiastic_programmer Автор
      08.05.2019 17:13

      Здравствуйте! Конечно, есть «Совершенный код» Макконнелла, надо стремиться к этому. Но код, представленный в статье, работает и он понятен любому программисту. Разве это не говорит в его пользу?


  1. Alex_ME
    06.05.2019 20:27
    +3

    Автор!
    Регулярно вижу ваши посты на тему Box2D. Я не хочу Вас обидеть, но ваши посты не несут в себе ценности. Хабр — не уютный бложик, в который можно логгировать результаты своей деятельности. Если бы вы рассматривали какие-то тонкости, особенности, приемы, нетривиальные случаи или большой и сложный проект, то это было бы куда более полезно и интересно другим людям. Ваши же посты в формате «смотрите, я сделяль!» не слишком информативны.


    1. Enthusiastic_programmer Автор
      08.05.2019 17:11

      Добрый день! Спасибо за Ваше мнение!


  1. igormich88
    06.05.2019 21:39

    У меня несколько вопросов:
    1) может быть код стоит разбить на блоки (или вообще не выкладывать весь код, а дать ссылку на git)
    2) код какой то очень процедурный, вам не приходило в голову сделать специальный класс для шестерёнок?
    И да есть еще такая штука

    спойлер
    verticles[0] = new Vector2(-2f * 10 / utils.Constants.PPM * resize + dx, 2f * 10 / utils.Constants.PPM * resize + dy);
    verticles[1] = new Vector2(-0.5f * 10 / utils.Constants.PPM * resize + dx, 8f * 10 / utils.Constants.PPM * resize + dy);
    verticles[2] = new Vector2(0.5f * 10 / utils.Constants.PPM * resize + dx, 8f * 10 / utils.Constants.PPM * resize + dy);
    verticles[3] = new Vector2(2f * 10 / utils.Constants.PPM * resize + dx, 2f * 10 / utils.Constants.PPM * resize + dy);

    В этом коде я кстати не могу понять что значат числа 10(а почему не 10f?), 8f, 2f, 0.5f


    1. neurocore
      07.05.2019 07:18

      Начали с более «широкого» типа float, а дальше не важно что там, в результате будет float


      1. igormich88
        07.05.2019 08:12

        Так и utils.Constants.PPM тоже float так что результат будет float в любом случае.


        1. neurocore
          07.05.2019 08:14

          Ну ок, из контекста это было неочевидно