» «

# 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 [email protected] [email protected] and_origin_to 0.0 -1.0 store_to [email protected]

But I just can't figure out how to use it properly... 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
• Contribution Award [Mods]

### #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:      [email protected] - origin X      [email protected] - origin Y      [email protected] - origin Z      [email protected] - destination X      [email protected] - destination Y      [email protected] - destination Z    Result:      [email protected] - 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 [email protected] }0509: [email protected] = distance_between_XY [email protected] [email protected] and_XY [email protected] [email protected] 0063: [email protected] -= [email protected] 0604: get_Z_angle_for_point [email protected] [email protected] store_to [email protected] 0AB2: ret 1 [email protected] :getZAngleBetweenPoints{  Parameters:    Passed:      [email protected] - origin X      [email protected] - origin Y      [email protected] - destination X      [email protected] - destination Y    Result:      [email protected] - absolute Z angle  Example:    0AB1: call_scm_func @getZAngleBetweenPoints 4 from_XY 0.0 0.0 and_XY 1.0 0.0 store_to [email protected] }0063: [email protected] -= [email protected] 0063: [email protected] -= [email protected] 0604: get_Z_angle_for_point [email protected] [email protected] store_to [email protected] 0AB2: ret 1 [email protected]

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

DK22Pac
• ##### DK22Pac

𝘉eчнo 𝘔oлoдoй...

• Feroci
• Joined: 12 Apr 2009
• Best WIP Mod 2014 [Grand Theft Auto 3D Contribution]
Contribution Award [Mods]

### #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 [email protected]

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