Calculate distance between two Objects (get Simple Vector x,y,z)

Started by sushobhit, February 14, 2014, 07:53:30 AM

Previous topic - Next topic

sushobhit

Hi friends ,
I was working on a project in jpct regarding spaceship sim. And some point in the program I needed to calculate distance beetween two objects. I want a SimpleVector that contains the info of the distance in terms of all the three axis. To be more specific :

SimpleVector distance = Object1.getDistance(Object2); //This should return the simplevector form

is there some function to get this form of distance ?????? Maybe I am overlooking something cause I checked all the parameters of Object3d & SimpleVector Classes but could'nt find any such function ?????

EgonOlsen

Something like this should work:

SimpleVector distVect=obj2.getTransformedCenter().calcSub(obj1.getTransformedCenter());

sushobhit