gc8 981 Posted November 26, 2018 Hi I am trying to create a camera that follows helicopter maybe in third person style. But haven't been able to figure how to make the camera to follow the helo smoothly. Can some one help? Here's my camera code which is quite poor, I have tried different settings with it without satisfying result: private _man = vehicle player; // Tried vehicle here showCinemaBorder false; _cpos = getpos _man; _cam = "camera" camCreate _cpos; _cam camSetTarget _man; _cam camSetRelPos [2, 2, 2]; _cam cameraEffect ["internal", "BACK"]; _cam camCommit 0; helocam = _cam; [_cam,_man] spawn { params ["_cam","_man"]; while { !isnull helocam } do { //_cam camSetPos (getpos _man); _cam camSetRelPos [2, 2, 2]; _cam camCommit 2; sleep 0.5; }; }; thx! Share this post Link to post Share on other sites
Mr H. 402 Posted November 26, 2018 Use attachTo command to attach the cam to its target Share this post Link to post Share on other sites
gc8 981 Posted November 26, 2018 Ok I tried that but I get a lot of camera jitter Share this post Link to post Share on other sites
Harzach 2518 Posted November 26, 2018 Maybe try visibleposition/visiblePositionASL instead of getPos? You'll want to lose that sleep, though. Share this post Link to post Share on other sites
gc8 981 Posted November 26, 2018 7 minutes ago, Harzach said: Maybe try visibleposition/visiblePositionASL instead of getPos? With _cam camSetPos (visiblePosition _man); There's also jitter Share this post Link to post Share on other sites
Grumpy Old Man 3549 Posted November 26, 2018 2 hours ago, gc8 said: With _cam camSetPos (visiblePosition _man); There's also jitter Because you're setting the camera position every 0.5 seconds, of course it's not gonna look good. Try using an eachFrame eventhandler to set the camera position. Cheers 1 Share this post Link to post Share on other sites
Harzach 2518 Posted November 26, 2018 As I said, lose that sleep. I did fail to mention that it works best with onEachFrame or an EachFrame EH, as GOM says. Share this post Link to post Share on other sites
MKD3 27 Posted November 27, 2018 @gc8 Attach the camera to the helicopter, set the cameras target as the pilot or a unit within the helicopter. I accept donations and gifts. Share this post Link to post Share on other sites
gc8 981 Posted November 27, 2018 Ok got it working. thx Share this post Link to post Share on other sites
Grumpy Old Man 3549 Posted November 27, 2018 3 hours ago, gc8 said: Ok got it working. thx Always nice to post your final solution, so others might benefit instead of opening another thread to the same/similar problem. Cheers 2 Share this post Link to post Share on other sites
gc8 981 Posted November 27, 2018 Yeah I think this is all you need for the camera (It's not perfect but shows how to do it) showCinemaBorder false; _cpos = getpos _helo; _cam = "camera" camCreate _cpos; _cam camSetTarget (driver _helo); _cam camSetRelPos [0, -5, 7.5]; _cam cameraEffect ["internal", "BACK"]; _cam camCommit 0; _cam attachTo [_helo]; _heli variable must be defined somewhere Share this post Link to post Share on other sites