Author Topic: Vectors and position help needed  (Read 305 times)

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Vectors and position help needed
« on: July 06, 2014, 06:34:09 pm »


               

I have two objects and I need to make one to run towards the position of the second object +1meter more.


 


I cant figure this out and yes I read the vectors tutorial make me even more confused.


 


Anyone?



               
               

               
            

Legacy_WhiZard

  • Hero Member
  • *****
  • Posts: 2149
  • Karma: +0/-0
Vectors and position help needed
« Reply #1 on: July 06, 2014, 06:51:37 pm »


               

object o1; //Define Object to Move

object o2; //Define Target Object to Move Past

vector vDis = GetPosition(o2) - GetPosition(o1);

vDis *= (VectorMagnitude(vDis) + 1.0)/ VectorMagnitude(vDis);

AssignCommand(o1, ActionMoveToLocation(Location(GetArea(o1), GetPosition(o1) + vDis, VectorToAngle(vDis))));



               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Vectors and position help needed
« Reply #2 on: July 06, 2014, 06:56:12 pm »


               

thanks thats it '<img'>