Author Topic: Restricting the Mouse  (Read 6034 times)

Offline AGP

  • quad
  • ******
  • Posts: 1726
    • View Profile
Re: Restricting the Mouse
« Reply #15 on: November 15, 2014, 09:43:08 pm »
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.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Restricting the Mouse
« Reply #16 on: November 15, 2014, 09:52:27 pm »
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.. ???

Offline AGP

  • quad
  • ******
  • Posts: 1726
    • View Profile
Re: Restricting the Mouse
« Reply #17 on: November 16, 2014, 06:56:45 am »
Code: [Select]
     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):
Code: [Select]
     public boolean rayCollision(World theWorld, float range) {
if (theWorld.checkCollision(getTransformedCenter(), forward, range*.4f) == Object3D.NO_OBJECT)
     return false;
return true;
     }

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Restricting the Mouse
« Reply #18 on: November 16, 2014, 09:52:19 am »
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.

Offline AGP

  • quad
  • ******
  • Posts: 1726
    • View Profile
Re: Restricting the Mouse
« Reply #19 on: November 25, 2014, 05:14:32 pm »
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)?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Restricting the Mouse
« Reply #20 on: November 25, 2014, 06:25:41 pm »
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?

Offline AGP

  • quad
  • ******
  • Posts: 1726
    • View Profile
Re: Restricting the Mouse
« Reply #21 on: November 25, 2014, 06:35:44 pm »
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.