playMaker

Author Topic: Calculate point and camera target between two objects  (Read 1009 times)

Aaddiction

  • PlayMaker2 Beta
  • Full Member
  • *
  • Posts: 172
Calculate point and camera target between two objects
« on: December 15, 2021, 03:01:48 PM »
I'm trying to have a camera that looks at two moving objects at the same time. Meaning to look at point that is the medium between two objects in 3d space.

I'm using the smooth look at action. The problem is how to calculate this point that is medium between the two objects? Would appreciate your help.

Thank you.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7618
    • jinxtergames
Re: Calculate point and camera target between two objects
« Reply #1 on: December 15, 2021, 03:11:58 PM »
Hi.
Maybe use cinemachine.

else

you could have a separate (empty)object for the camera to look at.

that object can position itself between the 2 other objects :

something like get position from obj A and B
then do A - B
Then Divide the result by 2 and add to A
(i did not test, but i think that should work)

Aaddiction

  • PlayMaker2 Beta
  • Full Member
  • *
  • Posts: 172
Re: Calculate point and camera target between two objects
« Reply #2 on: December 16, 2021, 11:43:46 AM »
I will try and let you know, thank you.