简体   繁体   中英

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.

(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).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM