Home   Help Search Login Register  

Author Topic: Camera/Attachto  (Read 3713 times)

0 Members and 1 Guest are viewing this topic.

Offline desrat

  • Members
  • *
Camera/Attachto
« on: 25 Oct 2009, 12:46:37 »
I wondered if there is anyway to attach a camera to a chopper (or have it track from a simlilar view as 3rdperson) but force the camera to always face the direction the chopper is heading (boresighted).

I'm trying to create a custom benchmark to help me get the most from ArmA2 on my hardware...

Offline DeanosBeano

  • Addons Depot Staff
  • *****
  • SirDeanosbeano bstowed on me by sui ;)
    • Fraghaus
Re: Camera/Attachto
« Reply #1 on: 25 Oct 2009, 15:52:02 »

 camsestrelpos is what ya looking for  i think.

 http://community.bistudio.com/wiki/camSetRelPos

     the figures in the [ ]  are the position relative to the target .

I love ofp

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Camera/Attachto
« Reply #2 on: 28 Oct 2009, 10:36:55 »
Something like:
Code: [Select]
_cam camSetTarget mychopper;
while {true} do
{
   _cam camsetrelpos [0,-20,0];
   _cam camCommit 0;
   Sleep 0.002;
};

Offline Wolfrug

  • Addons Depot
  • Former Staff
  • ****
  • Official OFPEC Old Timer
Re: Camera/Attachto
« Reply #3 on: 28 Oct 2009, 14:14:43 »
Hey wait...aren't cameras objects that can often be manipulated more or less like any other object? Why not actually try attachTo? Just for a hoot! Sorry, cant test it myself now : Mandoble's solution would work otherwise.

Wolfrug out.
"When 900 years YOU reach, look as good you will not!"

Offline desrat

  • Members
  • *
Re: Camera/Attachto
« Reply #4 on: 08 Nov 2009, 02:47:59 »
my apologies for the delay in responding - I actually ended up using a script given as an answer by Mandoble in another thread as it was pretty much what I needed - although I wouldnt mind seeing an attachto example as well...

Code: [Select]
//followplane.sqf
_plane = _this select 0;
keepfollowing = true;
_cam = "camera" camcreate [0, 0, 0];
_cam cameraeffect ["internal", "back"];
_relpos = [0, -5, 5];
_cam camSetRelPos _relpos;
_cam camSetTarget _plane;
_cam camSetFov 1;
_cam camCommit 0;
while {keepfollowing} do
{
   _cam camSetRelPos _relpos;
   _cam camCommit 0.2;
   Sleep 0.01;
};
_cam cameraeffect ["terminate", "back"];
camDestroy _cam;

executed from init.sqf

Code: [Select]
res = [chopper] execVM "followplane.sqf";

Offline DeanosBeano

  • Addons Depot Staff
  • *****
  • SirDeanosbeano bstowed on me by sui ;)
    • Fraghaus
Re: Camera/Attachto
« Reply #5 on: 08 Nov 2009, 11:50:23 »
attachto would be more or less the same as relpos to be honest , with the added option of using a selection position to define where the cam is attached.

 without trying in game it would be something like

Code: [Select]
//followplane.sqf
_plane = _this select 0;
keepfollowing = true;
_cam = "camera" camcreate [0, 0, 0];
_cam cameraeffect ["internal", "back"];
//_relpos = [0, -5, 5];
//_cam camSetRelPos _relpos;
_cam attachto [_plane,[0, 0,0]];
// you could find a selection pos too i guess if it works [_plane,[0, 0,0],"zeleny pozicni"]
_cam camSetTarget _plane;
_cam camSetFov 1;
_cam camCommit 0;
sleep 12;
_cam cameraeffect ["terminate", "back"];
camDestroy _cam

 i have left out your while loop but you can put it back in , i am not sure  what you would want in there because your relpos would be redundant using attachto. maybe just

while {keepfollowing} do
{

   Sleep 0.01;
};

 will do for now.

 try that and especially the selection pos and let me know, i might find a need for it myself if it works.

 DB
I love ofp

Offline desrat

  • Members
  • *
Re: Camera/Attachto
« Reply #6 on: 09 Nov 2009, 04:34:49 »
well it worked and actually better than the setrelpos version (much smoother) also got rid of camSetTarget to ensure a forward facing camera - example attached

Quote
//followplane.sqf
_plane = _this select 0;
keepfollowing = true;
_cam = "camera" camcreate [0, 0, 0];
_cam cameraeffect ["internal", "back"];
_cam attachto [_plane,[0, 5,0]];
_cam camSetFov 1;
_cam camCommit 0;
while {keepfollowing} do
{

   Sleep 0.01;
};

_cam cameraeffect ["terminate", "back"];
camDestroy _cam
« Last Edit: 09 Nov 2009, 04:38:00 by desrat »

Offline nuxil

  • Members
  • *
Re: Camera/Attachto
« Reply #7 on: 09 Nov 2009, 09:11:52 »
interesting.

im updating my tv guided script and moving from switchcamera to camera.
camSetRelPos will not work for me.. but the attachto command would if i could get it to work.
problem. i cant attach the camera to my bombs/missiles.

can anyone test out and see if they can attach a camera to a ammo type? because i cant get it to work :(

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Camera/Attachto
« Reply #8 on: 09 Nov 2009, 14:44:56 »
Didnt test it, but might be you can attach the camera to a GL, and then attach the GL to the ammo (in case ammo accepts attachto with GLs).

Offline nuxil

  • Members
  • *
Re: Camera/Attachto
« Reply #9 on: 09 Nov 2009, 15:40:50 »
thanks for the suggestion. but it didnt work.

i tried creating a new bomb instead of grabing the fired one. but no go.
also tried with
Code: [Select]
_logic attachto [_bomb,[0,0,0],"gbu12"];
and
_logic attachto [_bomb,[0,0,0],"component01"];
seams like its not possible. or atleast i cant make it happen  :weeping:

Offline DeanosBeano

  • Addons Depot Staff
  • *****
  • SirDeanosbeano bstowed on me by sui ;)
    • Fraghaus
Re: Camera/Attachto
« Reply #10 on: 09 Nov 2009, 16:08:14 »
hmm thats strange ,
 i have attached ammo to a vehicle before ,so attachto does work with ammo the other way round ( atached two aa missiles to a hmmv to make it look like a rocket car for a laugh).
  I will have a go when i get home , i am not sure what memmory point ammo have to attach to but have you tried without the memmory points ? just a simple [_bomb,[0,0,0]] ?


 EDIT
 Tried it with created ammo , wouldnt attach ,must be a class thing i guess, i will enjoy trying to get a worrk around tho , its the best thing in bis games :)



« Last Edit: 09 Nov 2009, 20:00:16 by DeanosBeano »
I love ofp