Quantcast

Jump to content

» «
Photo

get object rotation X and Y

  • This topic is locked This topic is locked
3 replies to this topic
Baragrasnki
  • Baragrasnki

    Player Hater

  • Members
  • Joined: 24 Jan 2013

#1

Posted 12 August 2013 - 04:59 PM

Hello!

With this opcode

0176: 27@ = object 20@ Z_angle

i can return the object Z_angle but i need the X and the Y

i have tried

0176: 27@ = object 20@ X_angle

but it gives Z angle.

Which opcodes should i Use?


Thank you

Wesser
  • Wesser

    The complexity simplifier, the efficiency optimizer.

  • Feroci
  • Joined: 19 Aug 2006
  • Unknown
  • Contribution Award [Mods]

#2

Posted 12 August 2013 - 06:51 PM

Z_angle is only the user-made description of the preceding argument and will be skipped by the compiler during the decompilation. The only significant parts of the command (also known as "opcode" according to the old naming convention) are its ID and arguments (math commands make an exception though). You should have tried to search for another command rather than changing the arguments tag uselessly. Sadly, there's no such command which retrives the X or Y angle of both an actor and an object. We need to find a workaround way to do so. Here we are:
  • CLEO3 compatible:
    CODE
    const
       RAD_TO_DEG = 57.295776
    end

    0A9F: 0@ = current_thread_pointer
    0@ += 0x10 // CScriptThread.m_iBaseAddress
    0A8D: 0@ = read_memory 0@ size 4 virtual_protect 0
    0@ -= @popFloat

    0A98: 1@ = object 31@ struct

    0AA6: call_function_method 0x006A6050 struct 1@ num_params 0 pop 0 // CVehicle__getAngleX
    0AA7: call_function 0@ num_params 0 pop 0 fValue 2@
    2@ *= RAD_TO_DEG
    0656: get_angle 2@ absolute_degrees_to 2@

    0AA6: call_function_method 0x006A6010 struct 1@ num_params 0 pop 0 // CVehicle__getAngleY
    0AA7: call_function 0@ num_params 0 pop 0 fValue 3@
    3@ *= -1.0
    0656: get_angle 3@ absolute_degrees_to 3@

    // 2@ and 3@ will contain respectively the X and Y angle of the entity.

    [...]

    :popFloat
    hex
       83EC 04   // sub     esp, 4
       D95C24 00 // fstp    [esp+4-4]
       8B4424 00 // mov     eax, [esp+4-4]
       83C4 04   // add     esp, 4
       C3        // retn
    end

  • CLEO4 only:
    CODE
    const
       RAD_TO_DEG = 57.295776
    end

    0A98: 1@ = object 31@ struct

    0AA6: call_method 0x006A6050 struct 1@ num_params 0 pop 0 // CVehicle__getAngleX
    0AE9: pop_float 2@
    2@ *= RAD_TO_DEG
    0656: get_angle 2@ absolute_degrees_to 2@

    0AA6: call_method 0x006A6010 struct 1@ num_params 0 pop 0 // CVehicle__getAngleY
    0AE9: pop_float 3@
    3@ *= -1.0
    0656: get_angle 3@ absolute_degrees_to 3@

    // 2@ and 3@ will contain respectively the X and Y angle of the entity.

Baragrasnki
  • Baragrasnki

    Player Hater

  • Members
  • Joined: 24 Jan 2013

#3

Posted 12 August 2013 - 08:30 PM Edited by Baragrasnki, 12 August 2013 - 08:54 PM.

Oh thanks it seems to work

I have this codes but 4@ 6@ 7@ returns all 0.000 0.000 0.000 even if i'm not, and the 8@ (the distance) is 0 too.

CODE
              01BB: get_object_coordinates 20@ store_to 11@ 12@ 13@
               00A0: store_actor $PLAYER_ACTOR position_to 5@ 6@ 7@

               050A: get_distance_between_coords_3d 11@ 12@ 13@ and 5@ 6@ 7@ store_to 8@

rehico
  • rehico

    Player Hater

  • Members
  • Joined: 26 Oct 2010

#4

Posted 19 June 2014 - 08:59 AM


const
   RAD_TO_DEG = 57.295776
end
 
0A98: 1@ = object 31@ struct
 
0AA6: call_method 0x006A6050 struct 1@ num_params 0 pop 0 // CVehicle__getAngleX
0AE9: pop_float 2@
2@ *= RAD_TO_DEG
0656: get_angle 2@ absolute_degrees_to 2@
 
0AA6: call_method 0x006A6010 struct 1@ num_params 0 pop 0 // CVehicle__getAngleY
0AE9: pop_float 3@
3@ *= -1.0
0656: get_angle 3@ absolute_degrees_to 3@
 
// 2@ and 3@ will contain respectively the X and Y angle of the entity.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users