In45do Posted October 24, 2018 Share Posted October 24, 2018 I'm having a hard time how to make object looking at target position. Can someone tell me step by step to make it happen? Link to comment Share on other sites More sharing options...
ZAZ Posted October 24, 2018 Share Posted October 24, 2018 (edited) what should be the target position ? do you mean the aim point? btw. post your script Edited October 24, 2018 by ZAZ CLEO MODS CLEO Script Tutorial Link to comment Share on other sites More sharing options...
In45do Posted October 25, 2018 Author Share Posted October 25, 2018 Let say my target is a vehicle with its x,y,z coord and I have my object randomly placed. How do I make this object to look at vehicle coordinates? I was thinking to use opcode 0177 to set my object's angle but I don't know how to convert vehicle's position into angle variable. Do you have an alternative way to make it happen? Link to comment Share on other sites More sharing options...
ZAZ Posted October 25, 2018 Share Posted October 25, 2018 you can calculate it with opcode 0604: get_Z_angle_for_point CLEO MODS CLEO Script Tutorial Link to comment Share on other sites More sharing options...
In45do Posted October 26, 2018 Author Share Posted October 26, 2018 00AA: store_car [email protected] position_to [email protected] [email protected] [email protected] 0604: get_Z_angle_for_point [email protected] [email protected] store_to [email protected] 0177: set_object [email protected] Z_angle_to [email protected] Am I doing it right? It's changing angle but it doesn't looking at the target. Link to comment Share on other sites More sharing options...
Strs Posted October 26, 2018 Share Posted October 26, 2018 (edited) be more specific what you want the way you showing this part of your script this is the way it should be 0174: [email protected] = car [email protected] Z_angle 0177: set_object [email protected] Z_angle_to [email protected] if it is not what you looking for .. then ask me i have other way to set object the way you want Edited October 26, 2018 by Strs clarifying Link to comment Share on other sites More sharing options...
In45do Posted October 26, 2018 Author Share Posted October 26, 2018 It basically copying target angle into object angle. The way I want it is to make this object looking at target position. Link to comment Share on other sites More sharing options...
Strs Posted October 26, 2018 Share Posted October 26, 2018 target target what target ? you are the one who targeting some one or somewhere or some one targeting you ? be more specific you trying to make missile mod ? if yes ill give you whole script and you can edit or do what ever you want to do https://youtu.be/URa2ch1lXk0 Link to comment Share on other sites More sharing options...
ZAZ Posted October 26, 2018 Share Posted October 26, 2018 (edited) On 10/26/2018 at 10:16 AM, In45do said: 00AA: store_car 0@ position_to 1@ 2@ 3@ 0604: get_Z_angle_for_point 1@ 2@ store_to 3@ 0177: set_object 4@ Z_angle_to 3@ Am I doing it right? No. To calculate an angle requires 2 points (4 coords), x,y of object and x,y of car But you can enter only 1 point (2 coords) to opcode 0604: get_Z_angle So what do we need to do? We need to bring the constellation in relation to the game center 0.0 subtract car_position from car_position = 0.0 subtract car_position from object_position = 2 coords for opcode 0604: get_Z_angle test the script below, consider that it use player position instead car position {$CLEO .cs} :Object_rotate thread 'OBJROT' // 1581, keycard, while true wait 0 if 0256: player $PLAYER_CHAR defined then if 0AB0: key_pressed 8//-----------------------press Backspace then 0247: request_model 1581 038B: load_requested_models 04C4: create_coordinate 11@ 12@ 13@ from_actor $PLAYER_ACTOR offset 0.0 3.5 0.0 0107: 0@ = create_object 1581 at 11@ 12@ 13@ while 0256: player $PLAYER_CHAR defined wait 0 04C4: create_coordinate 11@ 12@ 13@ from_actor $PLAYER_ACTOR offset 0.0 0.0 0.0 0400: store_coords_to 21@ 22@ 23@ from_object 0@ with_offset 0.0 0.0 0.0 0063: 21@ -= 11@ // (float) 0063: 22@ -= 12@ // (float) 0604: get_Z_angle_for_point 21@ 22@ store_to 30@ 0453: object 0@ set_rotation 0.0 0.0 30@ if or 8474: not actor $PLAYER_ACTOR near_object_in_cube 0@ radius 100.0 100.0 100.0 flag 0 0AB0: key_pressed 48// ------------ 0 key then break end end 0108: destroy_object 0@ end end end Edited October 27, 2018 by ZAZ In45do 1 CLEO MODS CLEO Script Tutorial Link to comment Share on other sites More sharing options...
In45do Posted October 27, 2018 Author Share Posted October 27, 2018 It worked, thanks alot ZAZ! It's direction was flipped so I added 180.0 and it finally facing the target. Although I don't understand why did you add [email protected] = 0.0 in that script. Link to comment Share on other sites More sharing options...
ZAZ Posted October 27, 2018 Share Posted October 27, 2018 15 hours ago, In45do said: I don't understand why did you add [email protected] = 0.0 in that script. ups, useless, maybe a leftover from copying CLEO MODS CLEO Script Tutorial Link to comment Share on other sites More sharing options...