A
A
Arti-Jack2016-12-30 21:22:07
Java
Arti-Jack, 2016-12-30 21:22:07

How to create bullets in libGDX using Box2D?

Good day.
There is one problem that is associated with the creation of bullets.
The fact is that everything in my code is sharpened to use the Box2D engine. The player, enemies, platforms are all engine fixtures that I process and draw using standard techniques. But when it came to bullets, problems arose.
I don't know how to make bullets using the engine. I just know that such a class already exists in libGDX, but, alas, I didn’t find anything on the Internet.
thank you in advance for your understanding.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nexeon, 2016-12-30
@Arti-Jack

Creating a bullet as a rigid body in Box2D is no different from other bodies, however ..
There is such a term as Collision tunneling - this is when, when moving very quickly, an object can suddenly slip through a wall. I won't go into details why this happens.
To avoid a similar problem in Box2D, we turn to the official manual , where it says:
To mark a body as a fast-moving object, just set the bullet property to true:
bodyDef.bullet = true;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question