GhostRiderSA Posted December 20, 2020 Share Posted December 20, 2020 (edited) Hello everyone! Someone have an memory address for San Andreas where the Axis of Rotation is stored from the Camera? Or maybe the distance from Camera to the Axis of Rotation? is it possible to calculate / get it somehow? i try to get the axis where the camera rotates around. any help appreciated hope someone still help here! Maybe @Wesser ? Edited December 20, 2020 by GhostRiderSA Link to comment Share on other sites More sharing options...
aldrinjohnom Posted December 21, 2020 Share Posted December 21, 2020 @ZAZ @OrionSR @DK22Pac Link to comment Share on other sites More sharing options...
ZAZ Posted December 23, 2020 Share Posted December 23, 2020 Center Axis of Rotation is Player_Actor center opcode 068D: gives camera position 068D: get_camera_position_to 1@ 2@ 3@ 04C4: store_coords_to 7@ 8@ 9@ from_actor $PLAYER_ACTOR with_offset 0.0 0.0 0.0 050A: 10@ = distance_between_XYZ 1@ 2@ 3@ and_XYZ 7@ 8@ 9@ GhostRiderSA 1 CLEO MODS CLEO Script Tutorial Link to comment Share on other sites More sharing options...
GhostRiderSA Posted December 24, 2020 Author Share Posted December 24, 2020 (edited) {$CLEO .cs} 0000: WHILE TRUE WAIT 0 IF 0AB0: key_pressed 32 // space THEN IF 0AD2: 0@ = player $PLAYER_CHAR targeted_actor THEN Actor.StorePos(0@, 1@, 2@, 3@) 0AB1: @AIM_AT_POS 4 XYZ: 1@ 2@ 3@ WAIT 1000 // to avoid constantly overwriting the calculated angle, and see the calculated angle visually. END END END //0AB1: @AIM_AT_POS 3 XYZ: [email protected] [email protected] [email protected] // by Opcode :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@ 0AB2: 0 @ZAZ thanks for your reply! maybe u can tell me, why this script doesnt aim directly on the targeted actor pos, ( added wait of 1000 to see the differe ) inside a while without WAIT, its instantly flicking to that position. i need the correct angle directly, without writing to the camera. this script is only for testing purposes . ( in this case not weapon sensitive, just the correct angle ) , on the first execution of the function. hope u can help Edited December 24, 2020 by GhostRiderSA Link to comment Share on other sites More sharing options...
ZAZ Posted December 27, 2020 Share Posted December 27, 2020 read here and here aldrinjohnom 1 CLEO MODS CLEO Script Tutorial Link to comment Share on other sites More sharing options...
GhostRiderSA Posted December 28, 2020 Author Share Posted December 28, 2020 thanks, but this is not what i wanted to do, its just about to get correct angle to the target ( in this case weapons weapon offsets are not needed ) u can test the code, u can press space like 4, 5, 6 times, until it stops to do the steps towards the target. as i told inside a loop it works fine, but for my things i need the correct angle towards the player. seems that the axis of rotation is not correct. problem is u need to run //0AB1: @AIM_AT_POS 3 XYZ: [email protected] [email protected] [email protected] // 5 times, to get to the right angle. can we speak german together? @ZAZ Link to comment Share on other sites More sharing options...
ZAZ Posted December 29, 2020 Share Posted December 29, 2020 (edited) On 12/24/2020 at 5:53 PM, GhostRiderSA said: 0AB1: @AIM_AT_POS 4 XYZ: 1@ 2@ 3@ :AIM_AT_POS 0087: 8@ = 3@ Wrong use of 0AB1: cleo_call and mistake by handing over parameter of 0AB1: 0AB1: @AIM_AT_POS 4 XYZ: [email protected] [email protected] [email protected] XYZ: = invalid and will be ignored so only 3 params will be send it should be 0AB1: cleo_call @AIM_AT_POS 3 1@ 2@ 3@ The function block recieves the submitted parameter by new variables :@AIM_AT_POS 1. param (you gave [email protected]) becomes [email protected] 1. param (you gave [email protected]) becomes [email protected] 1. param (you gave [email protected]) becomes [email protected] so it should be :AIM_AT_POS 0087: 8@ = 2@ (but i don't know the use of [email protected] in any way [email protected] = 0 and [email protected] will then also be 0) here it is correct 068D: get_camera_position_to [email protected] [email protected] [email protected] 0063: [email protected] -= [email protected] 0063: [email protected] -= [email protected] but, this calculation 0063: [email protected] -= [email protected] 0063: [email protected] -= [email protected] 0604: get_Z_angle_for_point [email protected] [email protected] store_to [email protected] is too easy, because it returns different result depending the quater of the coords system west-north quater have -x/+y coords east-north quater have +x/+y coords west-south quater have -x/-y coords east-south quater have +x/-y coords Edited December 29, 2020 by ZAZ CLEO MODS CLEO Script Tutorial Link to comment Share on other sites More sharing options...
GhostRiderSA Posted December 29, 2020 Author Share Posted December 29, 2020 (edited) @ZAZ, with that changes, the script doesnt even work anymore. it gets totally wrong angles. so what can we do for the quater calculation? Edited December 29, 2020 by GhostRiderSA Link to comment Share on other sites More sharing options...
ZAZ Posted December 30, 2020 Share Posted December 30, 2020 14 hours ago, GhostRiderSA said: so what can we do for the quater calculation? First explain your plan: What purpose do you want to code a camera view? As aiming view for a weapon? As substitute of the default camera? As first person cam? Then explain what content this memory adress hold: 0xB6F248 CLEO MODS CLEO Script Tutorial Link to comment Share on other sites More sharing options...
GhostRiderSA Posted December 30, 2020 Author Share Posted December 30, 2020 (edited) 5 hours ago, ZAZ said: First explain your plan: What purpose do you want to code a camera view? As aiming view for a weapon? As substitute of the default camera? As first person cam? Then explain what content this memory adress hold: 0xB6F248 i want to calculate the correct angles from my crosshair to the targetted ped position. these correct angles are needed to generate the new camera mFront vector for that target position with respect to the actual weapon. 0xB6F248 holds the actual camera X Angle in radian. so, i wanted to get the angles X & Z to target ped with respect of the actual holding weapon, without writing to the camera itself, that above is just an debugging thing, to see if its correct. Edited December 30, 2020 by GhostRiderSA Link to comment Share on other sites More sharing options...
ZAZ Posted December 31, 2020 Share Posted December 31, 2020 you didn't explain everything what do you wanna do with the angle? send M4_ray or throw an object or what? CLEO MODS CLEO Script Tutorial Link to comment Share on other sites More sharing options...
GhostRiderSA Posted December 31, 2020 Author Share Posted December 31, 2020 6 hours ago, ZAZ said: you didn't explain everything what do you wanna do with the angle? send M4_ray or throw an object or what? in the end it should be a headshot mod, which snaps instantly to target peds head. Link to comment Share on other sites More sharing options...
ZAZ Posted January 1, 2021 Share Posted January 1, 2021 (edited) 0604: get_angle_for_point [email protected] [email protected] [email protected] opcode 0604: have 2 params as input and 1 as angle output so we can give only one 2d crossing then the other crossing for the calculation must be the center 0.0 0.0 if we calculate the coords to bring the CROSSHAIR position to the center 0.0 0.0 and the aimpoint in relation to the center, can we give the aimpoint caculation to opcode 0604: store_coords_to 4@ 5@ 6@ from_CROSSHAIR GET_AIMPOINT_to 10@ 11@ 12@ 0087: 15@ = 5@ // floating-point values only 0087: 16@ = 6@ // floating-point values only 0063: 15@ -= 11@ // floating-point values 0063: 16@ -= 12@ // floating-point values 0013: 15@ *= -2.0 // floating-point values 0013: 16@ *= -2.0 // floating-point values 005B: 5@ += 15@ // floating-point values 005B: 6@ += 16@ // floating-point values 0063: 5@ -= 11@ // floating-point values 0063: 6@ -= 12@ // floating-point values 0604: get_angle_for_point 5@ 6@ 21@// <<<<--- X ANGLE I've expanded this script Now a bar object shows the X_angle Press backspace to show a light beam and a bar object, fixed for 2 seconds light beam have the aimpoint as target bar object shows X angle IMPORTANT: LOOK WITH PLAYER_ACTOR EXACTLY IN DIRECTION NORTH OR SOUTH because the object rotates only by X_ANGLE {$CLEO} thread 'Fn514970' wait 1000 //968, barrierturn, CJ_BARR_SET_1, 60, 0 0247: request_model 968 038B: load_requested_models 0107: 20@ = create_object 968 at -1658.9912 1213.2888 7.25 0382: set_object 20@ collision_detection 0 //Press backspace to show a light beam and a bar object, fixed for 2 seconds //light beam have the aimpoint as target //bar object shows X angle while true wait 0 if 0256: player $PLAYER_CHAR defined then if and 0AB0: key_pressed 8//----------------------------key = Backspace 044B: actor $PLAYER_ACTOR on_foot 84AD: not actor $PLAYER_ACTOR in_water then 0470: 0@ = actor $PLAYER_ACTOR current_weapon 0@ *= 0x70 0@ += 0xC8AAB8 0@ += 0x8 0A8D: 0@ = read_memory 0@ size 4 virtual_protect 0 // weapon range 00A0: store_actor $PLAYER_ACTOR position_to 1@ 2@ 3@ 0AB1: call_scm_func @getAimPoint 4 range 0@ from 1@ 2@ 3@ camera_to 4@ 5@ 6@ point_to 7@ 8@ 9@ 0AB1: call_scm_func @getLaserPoint 6 from 4@ 5@ 6@ to 7@ 8@ 9@ store_to 10@ 11@ 12@ 06B1: 31@ = create_searchlight_at 4@ 5@ 6@ radius 0.1 target 10@ 11@ 12@ radius 0.2 01BC: put_object 20@ at 4@ 5@ 6@ 0087: 14@ = 4@ // floating-point values only 0087: 15@ = 5@ // floating-point values only 0087: 16@ = 6@ // floating-point values only 0063: 14@ -= 10@ // floating-point values 0063: 15@ -= 11@ // floating-point values 0063: 16@ -= 12@ // floating-point values 0013: 14@ *= -2.0 // floating-point values 0013: 15@ *= -2.0 // floating-point values 0013: 16@ *= -2.0 // floating-point values 005B: 4@ += 14@ // floating-point values 005B: 5@ += 15@ // floating-point values 005B: 6@ += 16@ // floating-point values 0063: 4@ -= 10@ // floating-point values 0063: 5@ -= 11@ // floating-point values 0063: 6@ -= 12@ // floating-point values 0604: get_angle_for_point 4@ 5@ 23@// <- Z Angle 0604: get_angle_for_point 5@ 6@ 21@// <<<<--- X ANGLE 0453: object 20@ set_rotation 21@ 0.0 0.0 wait 2000 06B2: destroy_searchlight 31@ end end end :getAimPoint 0A9F: 12@ = current_thread_pointer 0AB1: call_scm_func @getLocalVarOffset 2 thread 12@ var 4 store_to 10@ 0AB1: call_scm_func @getLocalVarOffset 2 thread 12@ var 7 store_to 11@ 0AA6: call_method 0x514970 struct 0xB6F028 num_params 6 pop 0 pPoint 11@ pCamera 10@ fOriginZ 3@ fOriginY 2@ fOriginX 1@ fRange 0@ // CCamera__Find3rdPersonCamTargetVector 0AB2: ret 6 4@ 5@ 6@ 7@ 8@ 9@ :getLaserPoint 0A96: 11@ = actor $PLAYER_ACTOR struct 0AB1: call_scm_func @getCollisionBetweenPoints 17 from 0@ 1@ 2@ to 3@ 4@ 5@ solid 1 car 1 actor 1 object 1 particle 1 cartyre 1 water 0 ignore_entity 11@ see_through 0 camera_objects 0 shoot_through 0 store_to 6@ 7@ 8@ distance_to 9@ entity_to 10@ 0AB2: ret 3 6@ 7@ 8@ :getCollisionBetweenPoints if 13@ <> 0x0 then 0A8C: write_memory 0xB7CD68 size 4 value 13@ virtual_protect 0 end 0A8C: write_memory 0xB7CD70 size 1 value 11@ virtual_protect 0 0A9F: 26@ = current_thread_pointer 0AB1: call_scm_func @getLocalVarOffset 2 thread 26@ var 0 store_to 22@ 0AB1: call_scm_func @getLocalVarOffset 2 thread 26@ var 3 store_to 23@ 0AB1: call_scm_func @getLocalVarOffset 2 thread 26@ var 17 store_to 24@ 0AB1: call_scm_func @getLocalVarOffset 2 thread 26@ var 21 store_to 25@ 0AA7: call_function 0x56BA00 num_params 12 pop 12 bIgnoreShootThroughStuff 16@ bIgnoreSomeObjectsForCamera 15@ bIgnoreSeeThroughStuff 14@ bDummy 10@ bObject 9@ bActor 8@ bCar 7@ bBuilding 6@ pEntity 25@ pPoint 24@ pTarget 23@ pOrigin 22@ bReturn 31@ // CWorld__ProcessLineOfSight if 13@ <> 0x0 then 0A8C: write_memory 0xB7CD68 size 4 value 0x0 virtual_protect 0 end if 31@ <> 0 then if and 17@ <> 0.0 18@ <> 0.0 19@ <> 0.0 then 050A: 20@ = distance_between_XYZ 0@ 1@ 2@ and_XYZ 17@ 18@ 19@ if 12@ == 1 then 0A9F: 26@ = current_thread_pointer 0AB1: call_scm_func @getLocalVarOffset 2 thread 26@ var 27 store_to 30@ 0AA7: call_function 0x6E61B0 num_params 7 pop 7 pPoint 30@ fTargetZ 5@ fTargetY 4@ fTargetX 3@ fOriginZ 2@ fOriginY 1@ fOriginX 0@ bResult 31@ // CWorld__TestLineAgainstWater if 31@ <> 0 then 0087: 17@ = 27@ 0087: 18@ = 28@ 0087: 19@ = 29@ 050A: 20@ = distance_between_XYZ 0@ 1@ 2@ and_XYZ 27@ 28@ 29@ end end 0AB2: ret 5 17@ 18@ 19@ 20@ 21@ end end 0AB2: ret 5 3@ 4@ 5@ 0.0 0x0 :getLocalVarOffset if 0@ <> 0 then 1@ *= 0x4 0A8E: 2@ = 0@ + 0xDC // mission flag if 2@ == 1 then 1@ += 0xA48960 // mission locals else 005A: 1@ += 0@ 1@ += 0x3C end else 1@ = 0 end 0AB2: ret 1 1@ Edited January 1, 2021 by ZAZ CLEO MODS CLEO Script Tutorial Link to comment Share on other sites More sharing options...
Jack Posted January 2, 2021 Share Posted January 2, 2021 On 12/31/2020 at 11:00 AM, GhostRiderSA said: in the end it should be a headshot mod, which snaps instantly to target peds head. You can use functions to make actors headshoted by any firearm. It's hardcoded but it has been done before:Overdose Effects Function-X used: CPed::GetBonePosition(RwV3d& outPosition, unsigned int boneId, bool updateSkinBones); to get the position of the peds bone. When it comes to weapons and their effects on peds we can also use: CEventDamage::ComputeBodyPartToRemove(CEventDamage *this, int *pBoneId); This function controlls which weapon can do headshots. Although the main goal of the function was to produce a gore level similar as in gta3 where ped can loose any bone. That's the alternative (should you choose to accept it). Tank Fire [SA] New Police Helicopter [VC & III] My YouTube Channel Link to comment Share on other sites More sharing options...
GhostRiderSA Posted January 3, 2021 Author Share Posted January 3, 2021 On 1/2/2021 at 10:13 AM, Jack said: You can use functions to make actors headshoted by any firearm. It's hardcoded but it has been done before:Overdose Effects Function-X used: CPed::GetBonePosition(RwV3d& outPosition, unsigned int boneId, bool updateSkinBones); to get the position of the peds bone. When it comes to weapons and their effects on peds we can also use: CEventDamage::ComputeBodyPartToRemove(CEventDamage *this, int *pBoneId); This function controlls which weapon can do headshots. Although the main goal of the function was to produce a gore level similar as in gta3 where ped can loose any bone. That's the alternative (should you choose to accept it). sadly that isnt what i search for. it needs to change to angle of camera to the player. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now