playMaker

Author Topic: Get vector towards another object?  (Read 1596 times)

Mulbin

  • Junior Playmaker
  • **
  • Posts: 90
Get vector towards another object?
« on: January 15, 2017, 03:10:35 PM »
Hi, could anyone tell me how I get the vector from one object towards another?  I need to store it so I can then use forces towards/away from that specific direction.  Needs to be three axis.

jrock84

  • Playmaker Newbie
  • *
  • Posts: 23
    • Divergent Worlds Interactive
Re: Get vector towards another object?
« Reply #1 on: January 15, 2017, 11:02:56 PM »
You could use Get Vector XYZ, I believe it is, and use itween move to for your move.

mdotstrange

  • Hero Member
  • *****
  • Posts: 555
    • Can't code? Who cares! Make games anyway!
Re: Get vector towards another object?
« Reply #2 on: January 16, 2017, 02:41:08 AM »
Subtract one Vector3 from another to get the direction- can use the Vector3 Operator for that then use Vector3Normalize on the direction- then apply the direction as a force etc to move objects towards/away from others-

Can multiply the direction by a float to reverse it/make it stronger/weaker
Indie game dev and instructor at the Strange School. Learn Playmaker at the Strange School!