www.jpct.net

jPCT - a 3d engine for Java => Support => Topic started by: AGP on June 13, 2013, 01:52:06 am

Title: Dynamic Collision Objects
Post by: AGP 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 (http://www.gamasutra.com/view/feature/3015/pool_hall_lessons_fast_accurate_.php), I just think it would be a useful part of the API (but I won't be offended if you disagree :- ).
Title: Re: Dynamic Collision Objects
Post by: EgonOlsen 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?