Quantcast

Jump to content

» «
Photo

Angles in script HELP!

3 replies to this topic
arielnmz
  • arielnmz

    BlackHawk

  • Members
  • Joined: 17 Jun 2011

#1

Posted 17 June 2011 - 04:02 AM

Hey guys I need help, any ideas on how can I get the angle between two points (vectors or whatever)? Or how can I realize arc functions (those to get the angle from a sine/cosine)? On cleo 4??

I tried the 05A4 opcode:

QUOTE
05A4: get_angle_between_vectors_origin_to 9@ 10@ and_origin_to 0.0 -1.0 store_to 26@


But I just can't figure out how to use it properly... confused.gif I've searched through many post but it isn't explained very well

Hope you can help. Thanks!

Wesser
  • Wesser

    The complexity simplifier, the efficiency optimizer.

  • Feroci
  • Joined: 19 Aug 2006
  • Unknown

#2

Posted 17 June 2011 - 10:26 AM Edited by Wesser, 11 July 2013 - 02:56 PM.

I'd recommend to use 0604 but I can't remember if 05A4 just avoids to substract the 2 vectors. However, use these functions to get pitch (x) and yaw (z) angles:
CODE
:getXAngleBetweenPoints
{
 Parameters:
   Passed:
     0@ - origin X
     1@ - origin Y
     2@ - origin Z
     3@ - destination X
     4@ - destination Y
     5@ - destination Z
   Result:
     7@ - absolute X angle

 Example:
   0AB1: call_scm_func @getXAngleBetweenPoints 6 from_XYZ 0.0 0.0 0.0 and_XYZ 1.0 0.0 0.0 store_to 1@
}
0509: 6@ = distance_between_XY 0@ 1@ and_XY 3@ 4@
0063: 2@ -= 5@
0604: get_Z_angle_for_point 6@ 2@ store_to 7@
0AB2: ret 1 7@

:getZAngleBetweenPoints
{
 Parameters:
   Passed:
     0@ - origin X
     1@ - origin Y
     2@ - destination X
     3@ - destination Y
   Result:
     4@ - absolute Z angle

 Example:
   0AB1: call_scm_func @getZAngleBetweenPoints 4 from_XY 0.0 0.0 and_XY 1.0 0.0 store_to 1@
}
0063: 0@ -= 2@
0063: 1@ -= 3@
0604: get_Z_angle_for_point 0@ 1@ store_to 4@
0AB2: ret 1 4@

//Edit: corrected angles nomenclature.
  • HM128 likes this

DK22Pac
  • DK22Pac

    Playing SA on my lovely PS2. Y'all bums.

  • Feroci
  • Joined: 12 Apr 2009
  • Ukraine

#3

Posted 17 June 2011 - 10:55 AM

CODE
05A4: get_angle_between_vectors 2D_Vector_1_X 2D_Vector_1_Y and 2D_Vector_2_X 2D_Vector_2_Y store_to 26@

arielnmz
  • arielnmz

    BlackHawk

  • Members
  • Joined: 17 Jun 2011

#4

Posted 17 June 2011 - 09:18 PM

Thanks guys!!!!! it helped me a lot!!!




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users