Jump to content
Sign in to follow this  
TakanoFukada

Camera to follow bullet's view (literally)...

Recommended Posts

what i'm would like to do is to lock the camera onto a missile that has IRLOCK... so after the missile is fired without a LOCKED target, the user would be able to steer the missile to a target in real-time...  much like a Stinger missile... but I can't seem to find anything like that ! has this been done before?

i found this piece of code somewhere but I'm not quite sure how to implement it properly...

-this addeventhandler ["Fired", {if ((_this select 1) == "TOWLauncher") then {TOW switchcamera "internal"}}]

any assistance will be greatly appreciated...

Share this post


Link to post
Share on other sites

Hehe, you must've read my mind (or the other way round wink.gif ). I recently had an idea doing a script just like that. The camera part is easy. Just put

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">this addEventHandler ["fired", {_this exec "fired.sqs"}];<span id='postcolor'>

to the init field of the player. Then make a script called fired.sqs:

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">_ammoname = _this select 4;

_bullet = nearestObject [getpos player,_ammoname];

_bullet switchCamera "internal";

setAccTime 0.2

#flying

~0.1

?(alive _bullet) : goto "flying";

setAccTime 1

~0.5

player switchCamera "internal";

exit;<span id='postcolor'>

That script works with any fired object: bullet, LAW missile, grenade, whatever. The tricky part is to make steering the missile possible. AFAIK, it can only be done with ProSphere controller or another script using similar technique. However, I've ran into troubles implementing ProSphere to the script since camera switching is conflicting with the camera tricks ProSphere is using. I'm sure it can be worked out, though.

Share this post


Link to post
Share on other sites

More or less as Spitfire says. I'd add that since the object to be controlled is neither the player nor the actual vehicle in which the player is, but rather a totally independent missile / rocket / bomb, there shouldn't be a problem with control conflicts depending on how elegantly you need to lock out "normal" player control while you're steering the missile (usually via setPos or setVelocity, or a combination thereof), and where you want to place the camera.

I hope that makes sense. Basically, if you can get away from the "normal" control lockout method using cameraEffect used in the ProSphere scripts, you'll be fine. You'll probably be able to just switchCamera to the missile.

Prospero

Share this post


Link to post
Share on other sites

thanks for the reply guys! smile.gif

can someone provide a valid link to the ProSphere controller script here? i can't seem to find it....

also is there a way to use the in-game's laser designator to mark the target and fire my missile addon?

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
Sign in to follow this  

×