Intersection of SimpleVector

Started by phoenicoperus, March 05, 2011, 10:29:37 PM

Previous topic - Next topic

phoenicoperus

Hi, I was wondering if there was an easy way to find the intersection of a sphere and a line using jptc api.

I want to translate an Object3D(object#1) from its original position to a given radius from the centre of another Object3D(object#2) but taking in count the object#1 direction (SimpleVector)



The idea is to travel from an object to a distance of another

:)

EgonOlsen

That's simple vector math. You have the radius of the sphere and you can easily calculate the distance between the objects as well as the direction vector from the object to move to the one with the sphere. You then simply divide the radius by the distance and multiply the direction vector by one minus that value. Then translate the object by this vector.

phoenicoperus

It works great. Like always... THANKS your are always there EgonOlsen!!!!!

Btw I want to help you with the wiki to make it easier for beginners how can I get an account?

EgonOlsen

I'll create one for you. I had to disable it due to massive spam attacks.