Author Topic: Intersection of SimpleVector  (Read 1603 times)

Offline phoenicoperus

  • byte
  • *
  • Posts: 10
    • View Profile
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

 :)

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11747
    • View Profile
    • http://www.jpct.net
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.

Offline phoenicoperus

  • byte
  • *
  • Posts: 10
    • View Profile
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?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11747
    • View Profile
    • http://www.jpct.net
Re: Intersection of SimpleVector
« Reply #3 on: March 08, 2011, 01:54:22 pm »
I'll create one for you. I had to disable it due to massive spam attacks.