Jump to content
Sign in to follow this  
Einherj

Dialog controls on 3D object surface

Recommended Posts

Couldn't find a thread about this on the ArmA 3 categories.

I'm trying to use the old Radio or GPS models which were used in previous ArmA installations (and are still included in ArmA 3, but not used) and display dialog controls on their display areas but I'm having no luck.

I can get the radio model to display but can't get any controls to show on it's surface. Here's my code from my mission's description.ext:

class Dialog3DTest
{
   idd = -1;
   movingEnable = true;

   controlsBackground[] = {}; 

   class Objects
   {
       class RadioTest
       {
           access = ReadAndWrite;
           scale = 0.5;
           direction[] = {0,1,0};
           up[] = {0,0,-1};
           shadow = 1;
           idc = 101;
           type = 80;
           model = "\A3\ui_f\objects\radio.p3d";
           selectionDate1 = "date1";
           selectionDate2 = "date2";
           selectionDay = "day";
           x = 0.5;
           xBack = 0.5;
           y = 0.5;
           yBack = 0.5;
           z = 0.22;
           zBack = 0.22;
           inBack = 0;
           enableZoom = 0;
           zoomDuration = 1;
           waitForLoad = 0;

		class Areas
		{
			class Papir
			{
				class controls
				{
					class ControlTest
					{
						idc = 66;

						type = 0;
						style = 0;

						x = 0;
						y = 0;
						w = 1;
						h = 1;

						colorBackground[] = {0, 0, 0, 0};

						colorText[] = {1, 1, 1, 1};
						font = "PuristaMedium";
						sizeEx = 0.4;
						linespacing = 1;
						text = "Control Test";							

						tooltipColorText[] = {1, 1, 1, 1};
						tooltipColorBox[] = {1, 1, 1, 1};
						tooltipColorShade[] = {0, 0, 0, 0.65};

						shadow = true;
						colorShadow[] = {0, 0, 0, 0.5};
					};
				};
			};
		};
       };
   };

   class Controls
   {

   };
};

Has anyone done this in ArmA 3? Do you have any suggestions what I should try?

Thank you for your interest.

Share this post


Link to post
Share on other sites

Got it working!

Here's the class in description.ext:

class Radio3DTestDialog
{
idd = -1;

movingEnable = 0;
enableSimulation = 0;

controlsBackground[] =
{

};

objects[] =
{
	Radio3DObject
};

controls[] =
{

};

class Radio3DObject
{
	idc = -1;

	type = 82;

	model = "\A3\ui_f\objects\radio.p3d";

	scale = 1;

	direction[] = {0, 1, 0};
	up[] = {1, 0, -1};

	position[] = {0, -0.043, 0.25};
	positionBack[] = {0, 0, 0.625};

	inBack = 1;
	enableZoom = 1;
	zoomDuration = 0.5;

	class Areas
	{
		class ThisClassCanBeNamedWhatever
		{
			selection = "papir";

			class Controls
			{
				class EditBoxMultiLine
				{
					idc = 1;

					type = 2;
					style = 16;

					x = 0;
					y = 0;
					w = 1;
					h = 1.9;

					colorText[] = { 0 ,0 ,0 , 1 };
					colorSelection[] = { 1, 1, 1, 1 };
					colorDisabled[] = { 0, 0, 0, 0 };

					sizeEx = 0.2;
					font = "PuristaMedium";

					text = "";

					autocomplete = "";
				};
			};
		};
	};
};
};

Just run it with this from your script:

createDialog "Radio3DTestDialog";

And you should get this to play with:

http://skipgo.net/arma3/hvm/dialog3d.jpg (471 kB)

Happy editing!

Edited by Einherj

Share this post


Link to post
Share on other sites

Ew, I didn't even know ArmA could do that. oO

How does it handle interactive controls?

Share this post


Link to post
Share on other sites
How does it handle interactive controls?

Not very well from what I can tell - I could attach onObjectMoving, but not anything like onMouseZChanged for example - plus the object won't respond to commands like setVectorDirAndUp because it's not really an object but a control. I'll do some more testing tonight but I don't think there's much I can find.

(If that's what you mean by interactive - moving and rotating it).

Share this post


Link to post
Share on other sites

Oh I was actually thinking about buttons, listboxes or similar things.

I wonder if they still work normally when projected onto a model.

Share this post


Link to post
Share on other sites

Thanks for sharing man, this is awesome.

Edited by GID_Sacha

Share this post


Link to post
Share on other sites

Hm, that's really cool. Would be awesome if we could project controls to any object. Laptops, interactive whiteboards etc. My university owns more touchscreen whiteboards than Arma's NATO forces do I'm afraid.^^

Share this post


Link to post
Share on other sites

You have to keep in mind that the model is rendered onto the GUI layer so it's not a world model. That's why it can not be rotated or moved with script commands - it's just a control container inside the dialog.

Buttons and listboxes should work fine.

Share this post


Link to post
Share on other sites
Buttons and listboxes should work fine.

Woooh, thats awesome.

I'm going to have to give this a try. Thanks!

Share this post


Link to post
Share on other sites

I'm detecting color anomalies in some controls: buttons, editboxes, frames and backgrounds seem to be only rendered with primary colors (red, green, blue, yellow, cyan, magenta, black & white) nothing in between. Every value above zero in the color array is read as a one.

Text and pictures are rendered normally in all possible colors.

Also, map controls can't be rendered on the 3D surface. if you try to do it, the map is just rendered normally in 2D.

Edited by Einherj

Share this post


Link to post
Share on other sites

Hi guys,

I'm trying to use this technique on a self made model, but I can't find the right way to create the name selection on the model.

The model has only one LOD (0.000), with a named selection called "screen" (a single planar rectangular face).

I configured a controle as mentionned by Einherj. The model appears in game, but nothing is rendered on the "screen" selection.

Any ideas on how to do this on user made models ?

Thanks.

Share this post


Link to post
Share on other sites

Hi Sacha,

You need four vertices in the Memory LOD each representing a corner of the screen area. In my example they would be named "papir tl", "papir tr", "papir bl" and "papir br". tl is for Top Left, tr for Top Right, bl for Bottom Left and br for Bottom Right.

I hope that helps.

Edited by Einherj

Share this post


Link to post
Share on other sites
Hi Sacha,

You need four vertices in the Memory LOD each representing a corner of the screen area. In my example they would be named "papir tl", "papir tr", "papir bl" and "papir br". tl is for Top Left, tr for Top Right, bl for Bottom Left and br for Bottom Right.

I hope that helps.

Yep, that was exactly it ! Thanks a lot.

One point thow, the control rendered on texture doesn't seem to be clickable, i have to use tab to cycle focus between controls. Maybe the points in memory LOD have to be slightly in front of the model.

Edited by GID_Sacha

Share this post


Link to post
Share on other sites
Maybe the points in memory LOD have to be slightly in front of the model.

That might be it. That's how it's done in the BIS models.

Share this post


Link to post
Share on other sites

Got it to work !

So here's how the model has to be configured to be able to map controls on it, and to be able to click them :

- A view LOD (0.000, 1.000, whatever)

- A Geometry LOD (apparently this will define the bounding box that will be clickable)

- A Memory LOD with the following named selections (given you want to name it "screen") :

* screen tl (top-left)

* screen tr (top-right)

* screen bl (bottom-left)

* screen br (bottom-right)

* screen (the 4 above points)

That's it.

Share this post


Link to post
Share on other sites

Have you got a picture/video that shows this Sacha? Would be cool to see it in action.

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  

×