Exact Picture collision check?

Hey guys!
I just started programming with jMonkey so I’m doing a simple 2D game for now. It’s a simple oldschool space rocket shooting thingy game and I’m pretty satisfied with what I did in two days of work. To make the 2D sprites, I used com.jme3.ui.Picture. I’m just really frustrated with this thing: every sprite is handled like a square, and sometimes collisions are detected when there visually aren’t. Can somebody help me with that? I have a git repository where you can check out the code @

@MamosLab said: Hey guys! I just started programming with jMonkey so I'm doing a simple 2D game for now. It's a simple oldschool space rocket shooting thingy game and I'm pretty satisfied with what I did in two days of work. To make the 2D sprites, I used com.jme3.ui.Picture. I'm just really frustrated with this thing: every sprite is handled like a square, and sometimes collisions are detected when there visually aren't. Can somebody help me with that? I have a git repository where you can check out the code @
I pressed enter and the post got published... :facepalm: Anyhow, repository is @ https://github.com/MamosLab/Space-Rocket. Thank you in advance for the help!

You will have to write your own pixel-accurate sprite collision. It’s beyond the scope of a 3D engine so JME doesn’t have it.

1 Like

You could also try to use the default jme system

(Dont do if you target android, as the physic engine needs quite some power)
Based on your details of the enemys, you might be able to approximate them with kinematic rigidbodys consisting of a few hitboxes, and then do physical rays instead of the jme ones.

Eg a few intersecting boxes in a compoundshape
A Convex Shape.

Note do not try to use the MeshBased shapes for this, as for non static objects their performance is to low if you use them in higher numbers. (1-2 for the playership are probably fine)

If that gets you a close enough, it will save you quite some time.

1 Like
@pspeed said: You will have to write your own pixel-accurate sprite collision. It's beyond the scope of a 3D engine so JME doesn't have it.
Aw, how sad there isn't already the API for that. Thank you really much!
@Empire Phoenix said: You could also try to use the default jme system

(Dont do if you target android, as the physic engine needs quite some power)
Based on your details of the enemys, you might be able to approximate them with kinematic rigidbodys consisting of a few hitboxes, and then do physical rays instead of the jme ones.

Eg a few intersecting boxes in a compoundshape
A Convex Shape.

Note do not try to use the MeshBased shapes for this, as for non static objects their performance is to low if you use them in higher numbers. (1-2 for the playership are probably fine)

If that gets you a close enough, it will save you quite some time.


I think I’m gonna try that when I get better with jMonkey. Thank you for the suggestion!