Ray results does not include mesh thats controled by a skeleton? - Video demonstration


Im shooting a ray, using the rootNode as my start for searching for geometries.

Problem is, the result does not include the zombie mesh. Only time that the ray collides

is when I hit it somewhere near the middle torso.

Why does it not react when I hit him in the head or something?

Video to show is here:


Heres my method for hitting zombies:
[java]public static void shoot(Vector3f start, Vector3f end, String[] avoid, int hp) {
CollisionResults results = new CollisionResults();
Vector3f dir = end.subtract(start);
Ray ray = new Ray(start, dir);
MainClass.getRoot().collideWith(ray, results);

CollisionResults results2 = new CollisionResults();
for (int x = 0; x < results.size(); x++) {
String name = results.getCollision(x).getGeometry().getName();
if (results.getCollision(x).getGeometry().getParent() != null && !results.getCollision(x).getGeometry().getParent().getName().equals("Root Node")){
name = results.getCollision(x).getGeometry().getParent().getName();
if (!contains(avoid,name)){

} else {
System.out.println("Ignoring: "+name);
} catch (Exception e){
//System.out.println("Null pointer in ray");

results = results2;

if (results.size() > 0) {
// The closest collision point is what was truly hit:
CollisionResult closest = results.getClosestCollision();
// Let's interact - we mark the hit with a red dot.

if (closest.getContactPoint().distance(start) <= start.distance(end)){
ZombieManager.damage(closest.getGeometry(), hp, closest.getContactPoint(),dir );

I print all names of the geometries given back. Tho it doesnt print when I shoot him in the head.
Tried to see if theres an expection, so I printed it in later debugging, it did not react at all.

So what am I doing wrong?

Because the collision shape for normal collision does not get updated by animation, use a bullet ray.

I can only find jBulletRay for jme2, read something about you asking if they were implemented yet and they were not.

But that post was one year old, so I guess there is a class but I cannot find it…

What is the package name?


Ahh okej.

I looked here:


But it seems to be a outdated page.

Thanks :smiley:

no its not

Nonono waaait!!

Im trying to see if the ray hits a NONE physics-object!

So the mesh is added to the rootNode not the physicsspace.

So when I use this one, it TOO does not react to the mesh. Only to a part below it. So im prittie

much back at square one…

Should I try call shape.updateGeometricState() and shape.updateModelBound();

on all zombies and then check if a ray hits anyone, using a for loop?

you were useing the ragdoll no? just keep it attached but not in ragdoll mode, then all limbs of your character have physics shapes.

Yes, but it doesnt work apparently.

Can shoot him everywhere and it will only react when I shoot benith him.

I think the only thing I can hit is the capsule shaped RigidBodyControl benith him.

Plus, those cylinders would not be very accurate anyways due to their size etc…

But your saying there is no option for getting a ray to notice a animated armature other than

using the ragdolls cylinders?

Because Im using KinematicRagdollControl, so I can assign any names or anything that has to do

with the physical cylinders. I can just tell what my bonenames are…

it does work, i did it myself

Okej. I appriciate your taking such effort to help me :slight_smile:

It must be something in my creation of ragdoll then…

Heres how the ragdoll is created:


String[] boneNames = {"Neck.Top","Neck.Bottom","Fingers.L","Fingers.R","Hand.L","Hand.R","Forearm.L","Forearm.R","Arm.L","Arm.R","Shoulder.L","Shoulder.R","Foot.L", "Torso.Top","Torso.Bottom","MainBone","Butt.R","Butt.L","Shin.R","Shin.L","Hip.R","Hip.L","Heel.R","Heel.L","Foot.R"};

private void setupRagdoll() {

ragdoll = new KinematicRagdollControl(0.5f);

for(String s : boneNames){



float eighth_pi = FastMath.PI * 0.0125f;

ragdoll.setJointLimit("Torso.Top", eighth_pi, eighth_pi, eighth_pi, eighth_pi, eighth_pi, eighth_pi);

ragdoll.setJointLimit("Neck.Bottom", eighth_pi, eighth_pi, 0, 0, eighth_pi, eighth_pi);


ragdoll.addCollisionListener(new RagdollListener(this));




Geometry geo is my spatial that has the skeleton. The mesh that I wish to see if it collides.

Have I missed something in my ragdoll setup?

(If it helps, my zombie is walking 2m from the ground, hover-walking for some reason I cant fix…)

can u post an example normen ? just the code you wrote if you dont mind.

thank you.

Haha!!! It looks you took it very very seriously when @normen said you used copyrighted music … :roll:.

I just listened to some shots, but Eminen sound anymore ;P. There are a lot uncopyrighted musics in the internet :).

But don’t worry, i know you were listening Eminen while recording the video ;).

XD Not this time actually. Didnt want my video being taken down again so I had it quiet (plus I wanted to showoff my gun sound effects :P)

But as for the problem, I got a snapshot at it:


The green sourounded thing is my CharacterControl. Its the only one reacting to my rays.

The rest does not react. But the collision cylinders are there, just not working together with the rays…

My ray shoot method is here:

[java]public static void shoot(Vector3f start, Vector3f end, String[] avoid, int hp) {

Vector3f dir = end.subtract(start).normalize();

//Ray ray = new Ray(start, dir);

//MainClass.getRoot().collideWith(ray, results);

ArrayList<PhysicsRayTestResult> results = new ArrayList<PhysicsRayTestResult>();

MainClass.getPhysics().rayTest(start, end,results);

CollisionResults results2 = new CollisionResults();

for (int x = 0; x < results.size(); x++) {

PhysicsRayTestResult obj = results.get(x);




So what am I doing wrong?

Okej, so now I do now it looks like this:


Still no results in the results list from hitting any of the body cylinders…

I have no clue whats wrong…

Using debug shapes I was able to cast a normal ray and get collision. This was done

by looping through each bone checking if its debug shape collided with the ray.

Problem is, NOT having debug mode on, then the ray will not collide with the debug shape.

Not even if I create a new debugshape for it!

Normen, could you post your code that you said worked?

just a naive question. did you try calling node.updateModelBound(); for every node before the shooting begins ? maybe animations change the model bound.

No its actually a good question!

Tho it didnt work.

I ran updateModelBound on all zombies meshes before casting the ray. No luck there :confused: