CLEO Help New driving camera [REQ??]

CLEO related
Status
Not open for further replies.

dLightas

Member
Joined
Jun 9, 2014
Messages
16
Reaction score
0
Is there possible to make driving camera like in this video, more centered around the corners. :
Comparison original vs scripted. -
I know there is already similar cleo, but it literally locks camera to the car. This cleo :
 

Parazitas

God
Staff member
Joined
Jan 2, 2017
Messages
3,315
Solutions
7
Reaction score
935
Location
Lithuania
PHP:
{$CLEO .cs}

0000: NOP

wait 10000 // wait until samp is ready

while true
wait 0

if
00DF:   actor $PLAYER_ACTOR driving
then
    02EB: restore_camera_with_jumpcut
end

end
 

dLightas

Member
Joined
Jun 9, 2014
Messages
16
Reaction score
0
It's totally locked with car like in video with elegy, I would like to leave some movement, when car goes sideways. I will contact you in PM :D
 

Opcode.eXe

Expert
Joined
Feb 18, 2013
Messages
1,488
Reaction score
231
Location
( ͡° ͜ʖ ͡°)
Here try this:

Code:
{$CLEO .cs}
0000:

WHILE TRUE
    WAIT 0
    IF
    00DF:   actor $PLAYER_ACTOR driving
    THEN
        03C0: 1@ = actor $PLAYER_ACTOR car
        06A2: get_car 1@ velocity_in_direction_XYZ 2@ 3@ 4@
        00AA: store_car 1@ position_to 5@ 6@ 7@
        005B: 5@ += 2@  // (float)
        005B: 6@ += 3@  // (float)
        005B: 7@ += 4@  // (float)
        0AB1: @AIM_AT_POS 4 XYZ: 5@ 6@ 7@ ADD_CAMERA_OFFSET 0.0
    END
END


//0AB1: @AIM_AT_POS 3 XYZ: 1@ 2@ 3@
:AIM_AT_POS
0087: 8@ = 3@
068D: get_camera_position_to 3@ 4@ 5@
0063: 0@ -= 3@
0063: 1@ -= 4@
0604: get_Z_angle_for_point 0@ 1@ store_to 6@
6@ -= 90.0
0017: 6@ /= 57.2957795           
005B: 6@ += 8@  // (float)                           
0A8D: 7@ = read_memory 0xB6F248 size 4 virtual_protect 0
0A25: set_camera_on_players_X_angle 7@ Z_angle 6@
0661: "by Opcode.eXe | UGBASE.EU"
0AB2: 0


It predicts your next position using the velocity of your drift.
Camera should always point in the direction your vehicle is driving.
 

Attachments

  • DriftCam.cs
    18.3 KB · Views: 7

dLightas

Member
Joined
Jun 9, 2014
Messages
16
Reaction score
0
Tested, perfectly good when calmly turning, but when drifting it wiggles pretty much(also looks like sometimes it does wrong/opposite? movement), is there any possible adjustments, smoothing?
EDIT : also it can center harded.
 
Last edited:

Opcode.eXe

Expert
Joined
Feb 18, 2013
Messages
1,488
Reaction score
231
Location
( ͡° ͜ʖ ͡°)
I added a smoothing function.
Code:
{$CLEO .cs}
0000:

WHILE TRUE
    WAIT 0
    IF
    00DF:   actor $PLAYER_ACTOR driving
    THEN
    03C0: 1@ = actor $PLAYER_ACTOR car
        IF
        81C1:   car 1@ stopped
        THEN       
            06A2: get_car 1@ velocity_in_direction_XYZ 2@ 3@ 4@
            2@ /= 2.0
            3@ /= 2.0
            4@ /= 2.0
            00AA: store_car 1@ position_to 5@ 6@ 7@
            005B: 5@ += 2@  // (float)
            005B: 6@ += 3@  // (float)
            005B: 7@ += 4@  // (float)
            0AB1: @AIM_AT_POS 3 XYZ: 5@ 6@ 7@
        END
    END
//    IF
//    0AB0: 88
//    THEN
//        0A92: RESTART "DriftCam.cs"
//        004E: STOP THIS CLEO
//    END
END


//0AB1: @AIM_AT_POS 3 XYZ: 1@ 2@ 3@
:AIM_AT_POS
0087: 8@ = 3@
068D: get_camera_position_to 3@ 4@ 5@
0063: 0@ -= 3@
0063: 1@ -= 4@
0604: get_Z_angle_for_point 0@ 1@ store_to 6@
6@ -= 90.0
0017: 6@ /= 57.2957795           
005B: 6@ += 8@  // (float)                           
0A8D: 7@ = read_memory 0xB6F248 size 4 virtual_protect 0

0AB1: @SmoothCngles 3 X 6@ Y 7@ Power 6.0 as_ 6@ 7@

0A25: set_camera_on_players_X_angle 7@ Z_angle 6@
0661: "by Opcode.eXe | UGBASE.EU"
0AB2: 0



0AB1: @SmoothCngles 3 X 4@ Y 5@ Power 30@ as_ 4@ 5@
:SmoothCngles

0A8D: 15@ = read_memory 0xB6F258 size 4 virtual_protect 0
0A8D: 16@ = read_memory 0xB6F248 size 4 virtual_protect 0
0063: 0@ -= 15@
0063: 1@ -= 16@
0AB1: @FixRadian 2 0@ 1@ _AS  0@ 1@
0073: 0@ /= 2@
0073: 1@ /= 2@                                               

005B: 0@ += 15@  // (float)
005B: 1@ += 16@  // (float)

0AB1: @FixRadian 2 0@ 1@ _AS  0@ 1@
0AB2: 2 0@ 1@
:FixRadian
IF 0@ > 3.14159265359
THEN
0@ -= 6.28318530717958647693
END

IF
0@ < -3.14159265359
THEN
0@ += 6.28318530717958647693
END

IF 1@ > 3.14159265359
THEN
1@ -= 6.28318530717958647693
END

IF
1@ < -3.14159265359
THEN
1@ += 6.28318530717958647693
END

0AB2: 2 0@ 1@
 

Attachments

  • DriftCam.cs
    19.7 KB · Views: 21
Status
Not open for further replies.
Top