Jump to content
Tankbuster

Missile camera troubles

Recommended Posts

Guys,

I want to bolt a camera to a venator missile and see it in flight. Ultimately, I want to render this to a screen, but I've fallen at an earlier hurdle.

 

I spawned the missile in mission and, through lots of fiddling with camSetTarget and camSetRelPos I managed to achieve the look I wanted.

m= createvehicle ["ammo_Missile_Cruise_01", getpos player, [],0,"NONE"]; 
m enablesimulationglobal false;
[m,3] call BIS_fnc_setheight;
cam = "camera" camCreate [0,0,0];
cam cameraeffect ["internal","back"];
cam camsettarget (m modeltoworld [-0.2,10,-4]);cam camsetrelpos [-0.07,-10.2,3.9]; cam camcommit 0;

 

 

9817364ec4.png

 

But in the actual mission, when I run the camcreate, cameraeffect, camsettarget and camsetrelpos commands a script laucnhed through a fired eventhander on the VLS, the viewpoint is completely different. It moves with the missile, but the viewpoint isnt close to what I spent ages working out.

The result is never the same twice, here's just 2 screenshots,

5e34ef1999.png

 

Code launched from the EH; (adapted from 14 year old post by Big Dawg KS, who is long gone)

 __tky_starts
_myscript = "vlscam";
params ["_shooter","_wep","_mz","_firemode", "_ammo", "_mag","_r"];
diag_log format ["&&vlscam gets %1", _this];
_list = ["R_M136_AT","M_Javelin_AT","M_Stinger_AA","R_PG7V_AT","R_PG7VR_AT","M_Strela_AA","R_Hydra_HE","R_57mm_HE","R_80mm_HE","M_Sidewinder_AA","M_TOW_AT","M_AT5_AT","M_Hellfire_AT","M_Vikhr_AT","ammo_Missile_Cruise_01"];
if((_ammo) in _list)then{
_camera = "camera" camCreate [0,0,0];
_camera cameraeffect ["internal", "back"];
while{alive _r && alive _camera}do{
_camera camSetTarget (_r modelToWorld [-0.2,10,-4]);
_camera camSetRelPos [-0.07,-10.2,3.9];
_camera camCommit 0;
sleep 0.001;
};
if(alive _camera)then{sleep 1};
_camera cameraeffect ["terminate", "back"];
camdestroy _camera;
};

 

 

 

Share this post


Link to post
Share on other sites

OK, I fixed it - I think. I needed to attachto the camera to the missile. The attachto offset didn't make much sense and the missile always flies with a random amount of roll applied. The air intake is supposed to be underneath, but it usually flies with the airframe rolled so the intake is on the side of the hull.
f2ff6b3b61.png

Here you can see the aircraft is rolled 90 degrees left wing down as the air intake is on the right hand side.

Share this post


Link to post
Share on other sites

setVectorUp fixed the aircraft roll issue. Here's the finished thing.

 

 

  • Like 3

Share this post


Link to post
Share on other sites


Awesome! Cinematic and immersive. 
Question however: I'm a little confused on the text. If the camera is attached to the missile (instead of offset), will it not rotate as well?
Also: how many times have you made those poor citizens of Abdera homeless 😧?

  • Haha 1

Share this post


Link to post
Share on other sites

Thanks mate. This may or may not be ready for us to play this weekend. It's not adapted for multiplayer at the moment.

The camera is attached to the missile after the roll has been corrected.

The 'poor citizens of Abdera' were harbouring CSAT forces. You know... you've played that town with us and you know how tough it can be.

The mission was spawning enemy assets while the missile was in flight. You can see that the map was empty of markers when I called in the cruise missile, but by the time it's at the end of it's flight, in the last few frames, you can see there's a roadblock where the missile impacts.

 

640px-Obama_and_Biden_await_updates_on_b

Share this post


Link to post
Share on other sites

The above picture ^^^ couldn't be more fitting for a discussion about killing innocent civilians. These same people will be back in power in less then a week, God help us all.

 

Anyway, back on topic, nice little script, I like the immersion something like this adds to a mission, nice work.   

  • Like 1

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×