### Author Topic: Intersection of SimpleVector  (Read 2005 times)

#### phoenicoperus

• byte
• Posts: 10
##### Intersection of SimpleVector
« on: March 05, 2011, 10:29:37 pm »
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

• Posts: 12081
##### Re: Intersection of SimpleVector
« Reply #1 on: March 05, 2011, 11:42:58 pm »
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

• byte
• Posts: 10
##### Re: Intersection of SimpleVector
« Reply #2 on: March 06, 2011, 04:43:38 am »
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?