Jump to content
HazJ

selectionPosition + door (offset issue)

Recommended Posts

Hi,

I am using the below code to draw an icon on a door. It works fine but there is a weird offset issue. Is there a fix for this or just a manual offset work-around? Maybe I could get position between Door_2_trigger and Door_2? See pictures below.

// for quick testing
drawIcon3D [MISSION_ROOT + "client\visual\unlocked.paa", [1, 1, 1, 1], [((warehouse modelToWorld (warehouse selectionPosition "Door_2_trigger")) select 0), ((warehouse modelToWorld (warehouse selectionPosition "Door_2_trigger")) select 1), ((warehouse modelToWorld (warehouse selectionPosition "Door_2_trigger")) select 2)], 1, 1, 0, "", 1, 0, "PuristaMedium"];

Door_2

rCAbpRM.jpg

Door_2_trigger

cLYdzUB.jpg

  • Like 1

Share this post


Link to post
Share on other sites

I get the same, Harry. It's not just you. I gave up and got a position by hand.

  • Thanks 1

Share this post


Link to post
Share on other sites

ArmA'd. Everytime. :down:

  • Haha 1

Share this post


Link to post
Share on other sites

@HazJ What exactly are you trying to get there?

5 hours ago, HazJ said:

Maybe I could get position between Door_2_trigger and Door_2?

The middle of the small door?

 

If so then that is door 7, door 2 is the large righthand door.

"Door_7_trigger" will give you roughly the middle of the letterbox on the small door.

Land_i_Shed_Ind_F_door_7_trigger.png?raw

  • Like 2

Share this post


Link to post
Share on other sites

DAMN! Thank you @Larrow once again! Larrow'd...:rofl:

This works perfectly but when I open the door, the icon stays in the middle, is there a way to properly attach it so when the door opens, the icon moves with it?

Share this post


Link to post
Share on other sites

Still looking for a way to properly attach it so it stays on door regardless of animation phase (open/closed).

Share this post


Link to post
Share on other sites

Maybe this will give you some idea to go by, just quickly thrown together so not spot on (vector math makes my brain hurt)...


removeAllMissionEventHandlers "Draw3D";
addMissionEventHandler [ "Draw3D", {

	_door7Pos = warehouse selectionPosition "Door_7";
	_door7AxisPos = warehouse selectionPosition "Door_7_axis";
	_door7AxisPos set[ 2, _door7Pos select 2 ];
	_vectorDir7 = vectorNormalized( _door7Pos vectorDiff _door7AxisPos );

	_door7CenterPos = warehouse selectionPosition "Door_7_trigger";
	_door7AxisPos set[ 2, _door7CenterPos select 2 ];
	_door7CenterOffest = _door7AxisPos vectorDiff _door7CenterPos;

	_position = ( _door7AxisPos vectorAdd ( _vectorDir7 vectorMultiply ( _door7CenterOffest select 1 )));

	{
		private [ "_pos" ];
		_x params[ "_selection", "_color" ];

		_name = if ( _selection isEqualType "" ) then {
			_pos = warehouse selectionPosition _selection;
			_selection
		}else{
			_pos = _selection;
			""
		};

		drawIcon3D [
			"\a3\modules_f\data\iconunlock_ca.paa",
			_color,
			warehouse modelToWorldVisual _pos,
			1,
			1,
			1,
			_name,
			0,
			0.05,
			"PuristaMedium"
		];
	}forEach [
		[ _position, [ 1, 1, 1, 1 ] ],

		[ "Door_7", [ 1, 0, 0, 1 ] ],
		[ "Door_7_trigger", [ 0, 1, 0, 1 ] ],
		[ "Door_7_axis", [ 0, 0, 1, 1 ] ],

		[ "Door_2", [ 1, 0, 0, 1 ] ],
		[ "Door_2_trigger", [ 0, 1, 0, 1 ] ],
		[ "Door_2_axis", [ 0, 0, 1, 1 ] ]
	];

}];

Then you just need to work out the door7 axis position for when door2 is opened so as the icon remains in the right place when the large door is opened. Could of picked an easier door to work with :icon_biggrin:

  • Like 2

Share this post


Link to post
Share on other sites

Thank you @Larrow! I will mess with that a bit later.  I sent you a beer by the way! :drinking2:

  • Thanks 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

×