Quantcast

Jump to content

» «
Photo

Object Rotation Velocity

13 replies to this topic
12jango
  • 12jango

    "This is not revenge! This is entertainment!"

  • Members
  • Joined: 08 Mar 2008

#1

Posted 07 April 2014 - 01:47 PM Edited by 12jango, 08 April 2014 - 02:03 PM.

{$CLEO .cs}




thread 'sweat'




:LOAD
wait 0
Model.Load(615)
Model.Load(#NULL)
if and
    Model.Available(615)
    Model.Available(#NULL)
jf @LOAD




:TRI
wait 0
if and  
    Player.Defined($PLAYER_CHAR)
    0AB0:  key_pressed 49
jf @TRI
04C4: store_coords_to [email protected] [email protected] [email protected] from_actor $PLAYER_ACTOR with_offset 0.0 3.0 5.0 
04C4: store_coords_to [email protected] [email protected] [email protected] from_actor $PLAYER_ACTOR with_offset 13.0 3.0 5.0 
[email protected] = Object.Create(615, [email protected], [email protected], [email protected])
[email protected] = Object.Create(615, [email protected], [email protected], [email protected])




:TO
wait 0
Object.Angle([email protected]) = 0.0 
Object.Angle([email protected]) = 0.0 
if and  
    Player.Defined($PLAYER_CHAR)
    0AB0:  key_pressed 50
jf @TO




:wAN
wait 0
0400: store_coords_to [email protected] [email protected] [email protected] from_object [email protected] with_offset 0.0 0.0 0.0 
// Movement velocity
[email protected] = 0.02
[email protected] = 77.0
// Get the in-between vector
0063: [email protected] -= [email protected]
0063: [email protected] -= [email protected]
0063: [email protected] -= [email protected]
// Calculate vector length
050A: [email protected] = distance_between_XYZ 0.0 0.0 0.0 and_XYZ [email protected] [email protected] [email protected]
// Get the unit vector
0073: [email protected] /= [email protected]
0073: [email protected] /= [email protected]
0073: [email protected] /= [email protected]
// Multiply the vector by velocity
006B: [email protected] *= [email protected]
006B: [email protected] *= [email protected]
006B: [email protected] *= [email protected]
// Calculate the angle between the 2 points
05A1: set_object [email protected] rotation_velocity_about_an_axis [email protected] [email protected] [email protected] through_center_of_body




05A6: get_object [email protected] rotation_velocity_about_an_axis_X [email protected] axis_Y [email protected] axis_Z [email protected] through_center_of_body 
0453: set_object [email protected] XY_rotation [email protected] [email protected] angle [email protected] 
jump @WAN

Just a simple script; press 1 to spawn two trees in front of you then press 2 to rotate one tree.

It supposed to rotate both tree, but it's only one tree rotating (object [email protected]), I tried to rotate the other tree (object [email protected]) by using opcode 05A6 first then use 0453 to rotate it but didn't work!  :rol:

So, what does opcode 05A6 use for? I thought it would get an object rotation so you can use it to set another object's rotation to be same as the one you get?  :/  


Wesser
  • Wesser

    The complexity simplifier, the efficiency optimizer

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

#2

Posted 07 April 2014 - 02:16 PM Edited by Wesser, 07 April 2014 - 02:22 PM.

You wrote [email protected]. SB oddly accepts this big syntactical incongruity and treats it as a local variable with a hexadecimal identifier ([email protected]).

12jango
  • 12jango

    "This is not revenge! This is entertainment!"

  • Members
  • Joined: 08 Mar 2008

#3

Posted 08 April 2014 - 02:07 PM

I'm sorry I made mistakes when typing the script especially the [email protected] I meant it [email protected] :blush:

This time is the correct one. If you have time, please try it out to see what this script do.

The tree on your right is the object [email protected] that won't rotating. :turn:


12jango
  • 12jango

    "This is not revenge! This is entertainment!"

  • Members
  • Joined: 08 Mar 2008

#4

Posted 12 April 2014 - 05:36 AM Edited by 12jango, 12 April 2014 - 05:44 AM.

Is there any way to use 05A6:?


Seemann
  • Seemann

    Ruhe

  • GTA Mods Staff
  • Joined: 03 Sep 2004
  • Russia
  • Best Tool 2016 [OpenIV]
    Best Tool 2013 [Sanny Builder]
    Contribution Award [Mods]
    Helpfulness Awards [Mods]

#5

Posted 12 April 2014 - 08:45 AM

You wrote [email protected]. SB oddly accepts this big syntactical incongruity and treats it as a local variable with a hexadecimal identifier ([email protected]).

huh, funny :p should I fix that or leave it alone as a one yet feature?


Silent
  • Silent

    Chief Vision™ Alterer

  • GTA Mods Staff
  • Joined: 01 Feb 2010
  • Poland
  • Most Helpful [Modding] 2016
    Contribution Award [Mods]
    Best Script/Plugin 2014 [SilentPatch]
    Most Respected 2014
    Most Helpful [Mods] 2014
    Most Helpful [GTA] 2013
    Most Helpful [Mods] 2013
    Most Talented [Modding] 2013
    Best Map 2013 [ViceCityStories PC Edition]
    Best Vehicle 2013 [III Aircraft]
    Most Helpful [Mods] 2012
    Modder of the Year 2012

#6

Posted 12 April 2014 - 09:50 AM

huh, funny :p should I fix that or leave it alone as a one yet feature?


Maybe tweak it so it's less ambiguous and allow hex for globals too?

Wesser
  • Wesser

    The complexity simplifier, the efficiency optimizer

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

#7

Posted 12 April 2014 - 10:00 AM

It is not bad at all. I would suggest to clear the ambiguity with a percent sign (%).

fastman92
  • fastman92

    фастман92 | ف

  • Members
  • Joined: 28 Jul 2009
  • Poland
  • Best Conversion 2016 [GTA: Underground] [Contribution]
    Contribution Award [Mods]

#8

Posted 12 April 2014 - 12:14 PM Edited by fastman92, 12 April 2014 - 12:14 PM.

What about
$0x20 - global variable with ID 32
[email protected] - local variable with ID 32

Wesser
  • Wesser

    The complexity simplifier, the efficiency optimizer

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

#9

Posted 12 April 2014 - 01:01 PM Edited by Wesser, 12 April 2014 - 01:16 PM.

It will be still ambiguous as x and X are valid characters for defining custom globals names. Adding a special character right after the dollar sign ($) or before the local ID will easily advert SB to treat everything following (till another distinguishing token) as a hexadecimal number.

fastman92
  • fastman92

    фастман92 | ف

  • Members
  • Joined: 28 Jul 2009
  • Poland
  • Best Conversion 2016 [GTA: Underground] [Contribution]
    Contribution Award [Mods]

#10

Posted 12 April 2014 - 02:19 PM

Ok, true.

Seemann
  • Seemann

    Ruhe

  • GTA Mods Staff
  • Joined: 03 Sep 2004
  • Russia
  • Best Tool 2016 [OpenIV]
    Best Tool 2013 [Sanny Builder]
    Contribution Award [Mods]
    Helpfulness Awards [Mods]

#11

Posted 13 April 2014 - 02:28 PM

GTA scripts have too much data types characters already, so I would not add a one yet as the proposed percent sign.

 

The common convention for the variables naming is that the names must not begin with a digit. So $0x10 is not a valid name.

In fact SB threats it as a hexadimal value and compiles $0x10 as $16. Similarly, [email protected] will be compiled as [email protected] It means that the fastman's way is already implemented.

 

[email protected] definitely should be reported as an error by the compiler (and it looks so, two data types characters in one token are used).


Wesser
  • Wesser

    The complexity simplifier, the efficiency optimizer

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

#12

Posted 13 April 2014 - 04:05 PM

Yes, my bad, SB behaves like most compilers do indeed. Didn't know about the way of representing variables indices in hexadecimal. I totally agree with you then.

12jango
  • 12jango

    "This is not revenge! This is entertainment!"

  • Members
  • Joined: 08 Mar 2008

#13

Posted 18 April 2014 - 09:33 AM Edited by 12jango, 18 April 2014 - 09:33 AM.

So you're saying 05A6: isn't working at all?


12jango
  • 12jango

    "This is not revenge! This is entertainment!"

  • Members
  • Joined: 08 Mar 2008

#14

Posted 11 May 2014 - 02:14 AM

Anyone?





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users