donald 10 Posted July 10, 2014 (edited) Hello, I tried to write a small CamSat script and detected a Bug, I just don´t get. I use this as my SatInit.sqf Sat_x = getPos _this select 0; Sat_y = getPos _this select 1; sat_z = getpos _this select 2; sat_alt = (getPosASL _this select 2) + 1000; Sat_GCS = _this; Sat_Zoom = 0.200; Sat_abort = false; waituntil {!(IsNull (findDisplay 46))}; _keyDown = (findDisplay 46) displayAddEventHandler ["KeyDown", "null = (_this select 1) ExecVM 'Satcam\keyspressed.sqf'"]; nul = _this addAction ["SatCam","SatCam\openSatCam.sqf"]; This one is not a problem. The following is my "OpenSatCam.sqf" Sat_abort = false; setviewdistance = 3000; //Preload Camera waitUntil {preloadCamera [sat_x,Sat_y,Sat_alt]}; _camera = "camera" camcreate [sat_x,Sat_y,Sat_alt]; _camera cameraeffect ["internal", "back"]; waitUntil{camCommitted _camera}; sat_test = 3624; while {!Sat_abort} do { //;comment "11:41:57"; _camera camPrepareTarget [sat_x,sat_y,sat_z]; _camera camPreparePos [sat_x,Sat_y,Sat_alt]; _camera camPrepareFOV Sat_Zoom; _camera camCommitPrepared 0; sleep 0.2; }; player cameraEffect ["terminate","back"]; CamDestroy _camera; And here comes the funny thing. The Camera looks not to the ground. But, if I redefine sat_y with any integer Number, even with the same as (getpos Player select 1) it does. But if I use sat_y = getpos Player select 1. The camera Looks forward. I really don´t get it. In any way, the sat_y variable or the (getpos object select 1) thingy destroys it. Can you tell me any Idea, on how to get rid of it. Ah, and by the way. If I use Sat_y = (getPos Sat_GCS select 1) + 0.01; it Works. The SatInit is Executed in the Init of the Player. //Disregard the Idea above. As soon as I use getPos in anyway (e.g. sat_y = getpos....) It ignores Sat_z or any Value for the Height of camPrepareTarget. //Edit 2: Getting even more confused. If I use camCommitPrepared = 1 for example, It zooms into the correct Position. After one second, it looks straight ahead again. Edit3: Solved the problem. Camera can not be on the same x + y coordinates as the target. if I use a oblique angle it works Edited July 10, 2014 by donald Share this post Link to post Share on other sites
MrSanchez 243 Posted July 10, 2014 Could you debug the values and perhaps post them? Use this in the OpenSatCam.sqf. player sideChat format ["Sat_X: %1, Sat_Y: %2, Sat_Z: %3, Sat_Alt: %4", sat_x, sat_y, sat_z, sat_alt]; Secondly, are you sure your code ever gets past waitUntil{camCommitted _camera};? There is no cam committing happening before the line, hence my question. Although I do not know if creating the camera counts as a commit (without running camCommit). As well as, I am quite confused as you refer to Sat_Y as if it were the height variable, but shouldn't that be Sat_Z? And if nothing else works, perhaps try to remove the preparecam command and replace them. https://community.bistudio.com/wiki/camSetTarget https://community.bistudio.com/wiki/camSetPos But these may not work properly in ArmA, I don't do a lot of camera scripting in ArmA so I am not quite sure. Anyway, the most important thing is getting those values of the variables so you can see what's wrong with them. Kind regards, Sanchez Share this post Link to post Share on other sites
donald 10 Posted July 10, 2014 Hey, you are right, Sat_Z is the Height, but the confusing thing was, that changing the value of Sat_Y made the height working properly. But as I said in the Edit above, the problem is that the Camera does not work as intended, if the target x y coordinates are the same as the camera x y coords. Anyway, thanks for your help. Share this post Link to post Share on other sites
MrSanchez 243 Posted July 10, 2014 Oh I see, maybe some ArmA engine bug where it can't prepare a target that is directly underneith it. So why not just use +0.01 on one of the sat_x/sat_y variables, no-one will notice that 1 centimetre off center :) Kind regards, Sanchez Share this post Link to post Share on other sites
donald 10 Posted July 10, 2014 that´s what I did. But I used a little bit more offset. Can easily explain it with a Geostationary Orbit slightly south of the target Country :D Share this post Link to post Share on other sites
MrSanchez 243 Posted July 10, 2014 Well if the smallest offset (like 0.01) causes it to work, there's barely a visible difference between that and if it would have no offset at all. But either way, I understood you got it working, good ;) Kind regards, Sanchez Share this post Link to post Share on other sites