Author Topic: Dynamic Collision Objects  (Read 658 times)

Offline AGP

  • quad
  • ******
  • Posts: 1609
    • View Profile
Dynamic Collision Objects
« on: June 13, 2013, 01:52:06 am »
I'd like to be able to collide with two dynamically-created spheres, (a checkForCollisionSpherical that instead of colliding with another Object3D collided with a SimpleVector and a radius). Any chance of getting that? It would be useful in the following method involving two AnimatedGroups (Bones, I know, but I'm sure it would be useful anywhere else):

Code: [Select]
     private boolean collideActive() {
SimpleVector chestPosition = ironMan.getJointPosition(ironMan.chest); //ironMan.chest is a Joint (Bones)
return Object3D.checkForCollisionSpherical(superman.getJointPosition(superman.leftFoot), 2f, chestPosition, 2f);//CHECKS WHETHER superman's LEFT FOOT STRUCK ironMan's CHEST

I'm not saying it would be hard to do (, I just think it would be a useful part of the API (but I won't be offended if you disagree :- ).
« Last Edit: June 13, 2013, 07:50:45 am by AGP »

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11895
    • View Profile
Re: Dynamic Collision Objects
« Reply #1 on: June 13, 2013, 03:56:35 pm »
Why not simply check the sphere against the actual geometry of the chest in that case?
Anyway, to detect a collision of that kind is just a simple distance check. You can already that by using SimpleVector.distance(<SimpleVector>). The only thing that you can't do with that is to correct the movement vector so that both spheres touch, but i don't think that this would be needed here, or is it?