Jump to content

[CLEO] camera angle visibility?


Recommended Posts

Hi all, I'm wondering how to make a particle/corona/anything being drawn only if the camera view is between some angles.

 

So for example, I want to make a corona which is only visible when I look it from north. Is this possible with CLEO?

 

I only found these opcodes which could be useful, but no angle found:

 

 

068D: get_camera_position_to $TEMPVAR_FLOAT_1 $TEMPVAR_FLOAT_2 $TEMPVAR_FLOAT_3068E: get_camera_target_point_to $TEMPVAR_FLOAT_1 $TEMPVAR_FLOAT_2 $TEMPVAR_FLOAT_3
Anyone knows how to make this? Edited by nyolc8
Link to comment
https://gtaforums.com/topic/768929-cleo-camera-angle-visibility/
Share on other sites

script below puts the health object always where the camera is viewing

{$CLEO .cs}:Camera_extended_xy_coordsthread 'CAMEXY'029B: 31@ = init_object 1240 at 0.0 100.0 950.0while truewait 0    if        0256:   player $PLAYER_CHAR defined    then        068E: get_camera_target_point_to 1@ 2@ 3@         068D: get_camera_position_to 7@ 8@ 9@         0087: 5@ = 7@ // (float)         0087: 6@ = 8@ // (float)         0063: 5@ -= 1@ // (float)         0063: 6@ -= 2@ // (float)         5@ *= -5.0         6@ *= -5.0         005B: 7@ += 5@ // (float)         005B: 8@ += 6@ // (float)         01BC: put_object 31@ at 7@ 8@ 3@         0655: AS_actor $PLAYER_ACTOR look_at_object 31@ 1000 ms     endend

position of 068E: get_camera_target_point is between camera_position and player while default camera mode (very near to cam position)
it needs to multiplicate the difference with negativ value to extend the offset to the view direction, to get a sensefull effect

.

Script below turns Player Z-angle always to camera view by using 0604: get_Z_angle_for_point

{$CLEO .cs}:Camera_extended_Anglethread 'CAMEXA'while truewait 0    if        0256:   player $PLAYER_CHAR defined    then        068E: get_camera_target_point_to 1@ 2@ 3@         068D: get_camera_position_to 7@ 8@ 9@         0087: 5@ = 7@ // (float)         0087: 6@ = 8@ // (float)         0063: 5@ -= 1@ // (float)         0063: 6@ -= 2@ // (float)         5@ *= -5.0         6@ *= -5.0         005B: 7@ += 5@ // (float)         005B: 8@ += 6@ // (float)        0063: 7@ -= 1@ // (float)         0063: 8@ -= 2@ // (float)                 0604: get_Z_angle_for_point 7@ 8@ store_to 30@         0173: set_actor $PLAYER_ACTOR Z_angle_to 30@    endend
Edited by ZAZ

I tried to modify the 2nd script and make it to return true (displays "draw" text in the test) only when I look the car from rear (between speicifc angles). Well it works but it's very inaccurate. :(

Any help to make it accurate? Also it becomes true even when I view the car from front.

 

 

{$CLEO .cs}:Camera_extended_Anglethread 'CAMEXA'while truewait 0    if and        0256:   player $PLAYER_CHAR defined        Actor.Driving($PLAYER_ACTOR)    then        068E: get_camera_target_point_to 1@ 2@ 3@         068D: get_camera_position_to 7@ 8@ 9@        9@ = Actor.CurrentCar($PLAYER_ACTOR)         0087: 5@ = 7@ // (float)         0087: 6@ = 8@ // (float)         0063: 5@ -= 1@ // (float)         0063: 6@ -= 2@ // (float)         5@ *= -5.0         6@ *= -5.0         005B: 7@ += 5@ // (float)         005B: 8@ += 6@ // (float)        0063: 7@ -= 1@ // (float)         0063: 8@ -= 2@ // (float)                 0604: get_Z_angle_for_point 7@ 8@ store_to 30@        02F6: 30@ = sine 30@ // (float)        02F8: get_car 9@ Z_angle_sine_to 10@        0097: 10@ = 10@ // absolute value (no minus)        0097: 30@ = 30@ // absolute value (no minus)                0007: 11@ = 30@        000F: 11@ -= 10@        0097: 11@ = 11@ // absolute value (no minus)                    if            11@ < 0.2        then            0AD1: print_formatted_now "draw" time 50 0        end    endend

try this

{$CLEO .cs}:Camera_to_Car_related_anglethread 'CAMCARA'while truewait 0    if        0256:   player $PLAYER_CHAR defined    then        if            00DF: actor $PLAYER_ACTOR driving        then            03C0: 10@ = actor $PLAYER_ACTOR car                        while  0256:   player $PLAYER_CHAR defined                wait 0                    if                    00DF: actor $PLAYER_ACTOR driving                then                                    0407: store_coords_to 1@ 2@ 3@ from_car 10@ with_offset 0.0 0.0 0.0                    //068E: get_camera_target_point_to 1@ 2@ 3@                     068D: get_camera_position_to 7@ 8@ 9@                                         0174: 15@ = car 10@ z_angle                                        0087: 5@ = 7@ // (float)                     0087: 6@ = 8@ // (float)                     0063: 5@ -= 1@ // (float)                     0063: 6@ -= 2@ // (float)                     005B: 7@ += 5@ // (float)                     005B: 8@ += 6@ // (float)                    0063: 7@ -= 1@ // (float)                     0063: 8@ -= 2@ // (float)                    0604: get_Z_angle_for_point 7@ 8@ store_to 30@                    0063: 15@ -= 30@  // floating-point values                    0097: make 15@ absolute_float                    if  and                        210.0 > 15@                        15@ > 150.0                    then                        0092: 15@ = float_to_integer 15@                        03F0: enable_text_draw 1                        045A: text_draw_1number  300.0  150.0 'NUMBER' 15@    // value                    end                                    else                    break                    end            end        end    endend

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • 0 User Currently Viewing
    0 members, 0 Anonymous, 0 Guests

×
×
  • Create New...

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.