Restricting the Mouse

Started by AGP, November 12, 2014, 07:12:02 PM

Previous topic - Next topic

AGP

Hmmm. And there's nothing in Config to cause that? It's worth noting that I've set the zombie to Object3D.COLLISION_CHECK_OTHERS and the bullet to Object3D.COLLISION_CHECK_SELF | Object3D.COLLISION_CHECK_OTHERS.

EgonOlsen

No, there's nothing in Config about that. It's basic ray-polygon collision detection. It's proven, it doesn't go wrong until one uses it wrong...or not at all...maybe you can post the code snippet that uses it to see if you actually do.. ???

AGP


     if (bullet != null && bullet.isAlive()) {
if (bullet.rayCollision(theWorld, deltaTime*60f)) {
     zombie1.triggerDeath(heroSphere);
}
bullet.translate(bullet.forward.x*deltaTime*60f, bullet.forward.y*deltaTime*60f, bullet.forward.z*deltaTime*60f);
     }


In bullet (Bullet is an Object3D subclass):

     public boolean rayCollision(World theWorld, float range) {
if (theWorld.checkCollision(getTransformedCenter(), forward, range*.4f) == Object3D.NO_OBJECT)
     return false;
return true;
     }

EgonOlsen

Looks fine. Try to remove the -OTHERS from the bullet. Maybe it collides with itself this way and there's no point in setting it up this way anyway, because nothing else collides with a bullet, or does it.

AGP

It doesn't collide with anything else (no superheroes on this one! :- ). I fixed the mouse completely, but I'm still getting the issue in which the bullet sometimes goes through the zombies, and sometimes hits it when it shouldn't. Is there any chance that it could be a bones issue (maybe the collision mesh is one place while the mesh being rendered is somewhere else)?

EgonOlsen

Not unless you are doing one of these tasks in another thread then the other one. If all operations (i.e. animation, collision detection, rendering) happen in the same thread, it shouldn't be the reason.
Btw: I don't understand how you are even able to notice this flaw. How much off are the results? Or is the bullet really slow?

AGP

It's big enough and slow enough to notice. I'll speed it up when it's perfect.

BTW, watch the Jurassic World trailer. It's awesome.