Jump to content
sinny

AttachTo, trying to attch a lamp on torret

Recommended Posts

Hi all,

 

Im going crazy here, im trying to attach a lamp [ Land_PortableLight_single_F ] to [i_MRAP_03_hmg_F]´s turret.

 

Ive been using this:

Lamp attachTo [Car,[0,0,0], "vez"];

Lamp setDir 180; Lamp setPos getPos vez;

 

I have tried some variants but the light does not follow the turrets movement, it just points at the cars direction... 

Anyone know how to solve this?

 

Many thanks!

Share this post


Link to post
Share on other sites

Try this in debug console

MRAP = "I_MRAP_03_hmg_F" createVehicle position player;
light = "Land_PortableLight_single_F" createVehicle [0,0,0];
light attachTo [MRAP, [0,0,0], "vez"];  
addMissionEventHandler ["EachFrame", {
	light setVectorDirAndUp [
		(MRAP selectionPosition "otochlaven") vectorFromTo (MRAP selectionPosition "pohon"), 
		[0,0,1]
	];
}];
setDate [4804,7,13,0,0];
player moveInGunner MRAP;
player switchCamera "EXTERNAL";
  • Like 3

Share this post


Link to post
Share on other sites

 

Try this in debug console

MRAP = "I_MRAP_03_hmg_F" createVehicle position player;
light = "Land_PortableLight_single_F" createVehicle [0,0,0];
light attachTo [MRAP, [0,0,0], "vez"];  
addMissionEventHandler ["EachFrame", {
	light setVectorDirAndUp [
		(MRAP selectionPosition "otochlaven") vectorFromTo (MRAP selectionPosition "pohon"), 
		[0,0,1]
	];
}];
setDate [4804,7,13,0,0];
player moveInGunner MRAP;
player switchCamera "EXTERNAL";

 

I tested ur code in debug console but the light is not moving with turrets movement.

Share this post


Link to post
Share on other sites

I tested ur code in debug console but the light is not moving with turrets movement.

try on dev branch or replace eachframe eh with oneachframe

Share this post


Link to post
Share on other sites

I took a Draw3D EH with ur code and it worked very well...

MRAP = "I_MRAP_03_hmg_F" createVehicle position player;
light = "Land_PortableLight_single_F" createVehicle [0,0,0];
light attachTo [MRAP, [0,0,0], "vez"];  
addMissionEventHandler ["Draw3D", {
	light setVectorDirAndUp [
		(MRAP selectionPosition "otochlaven") vectorFromTo (MRAP selectionPosition "pohon"), 
		[0,0,1]
	];
}];
setDate [4804,7,13,0,0];
player moveInGunner MRAP;
player switchCamera "EXTERNAL";

Share this post


Link to post
Share on other sites

Amazing! Thanks!

:love:

 

 

 

* Hmm it works just perfect on the I_MRAP_03_hmg_F

But when i try the same setup on a B_APC_Tracked_01_CRV_F ,the light is out of place

I dont think i understand the logic... Can someone please explain?

 

 

Where C_11 is the bobcat and SearchLight2 is the light

SearchLight2 attachTo [C_11, [0,0,0], "vez"];   
addMissionEventHandler ["Draw3D", { 
 SearchLight2 setVectorDirAndUp [ 
  (C_11 selectionPosition "otochlaven") vectorFromTo (C_11 selectionPosition "pohon"),  
  [0,0,1] 
 ]; 
}];

Share this post


Link to post
Share on other sites

Seems vehicles may be using different axis and turret selections , this seems to work a little better for the  B_APC_Tracked_01_CRV_F  but the light seems to lean back a bit.

SearchLight2 attachTo [C_11, [0,0,0.3], "OsaVeze"];     
addMissionEventHandler ["Draw3D", {   
 SearchLight2 setVectorDirAndUp [   
  (C_11 selectionPosition "usti hlavne") vectorFromTo (C_11 selectionPosition "OsaHlavne"),    
  [0,0,1]   
 ];   
}];
  • Like 1

Share this post


Link to post
Share on other sites

 

Seems vehicles may be using different axis and turret selections , this seems to work a little better for the  B_APC_Tracked_01_CRV_F  but the light seems to lean back a bit.

SearchLight2 attachTo [C_11, [0,0,0.3], "OsaVeze"];     
addMissionEventHandler ["Draw3D", {   
 SearchLight2 setVectorDirAndUp [   
  (C_11 selectionPosition "usti hlavne") vectorFromTo (C_11 selectionPosition "OsaHlavne"),    
  [0,0,1]   
 ];   
}];

 

SUPER! Thanks man!

And thanks all in this thread!

 

:wub:

 

 

Here is the awesome result: 

 

350EB3DF35994AE83AE3FBFCE0CBC7E2C7E56F04

D5C6C70317B4B8DDF72153DEC88B1A23A937B3AB

  • 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

×