user3534018
user3534018

Reputation:

Libgdx bullet Raycasting never collides

In another question of mine I had asked about raycasting with bullet and libgdx and someone actually gave me a nice response but then when i went to implement it I've spent all day attempting it it never collides with objects anyone have any idea how to fix this

Reply im refering to: RayCasting in Libgdx 3d My code is pretty much what you see in that reply but if you need any more information ill provide it.

Upvotes: 0

Views: 547

Answers (1)

Jankapunkt
Jankapunkt

Reputation: 8423

(This would be a comment, but I am below 50pt)

Is the function from the reply you refering to return null or does the object not react?

If an object is returned, you may try to activate it:

btCollisionObject body = BulletUtil.rayTest(collisionWorld, pickRay);
if (body != null) {
    body.activate(); //activate because it may sleep
    //... then do whatever you want with this body now
    return true;
}

In the other post (you reply to), there were also two lines which didn't work for me (see my comment in the other post).

Upvotes: 1

Related Questions