Jump to content
BomosBoy

Possible Inventory Menu like in Dayz (3d Character)

Recommended Posts

Is it possible to code a menu like in DayZ where you have a 3d Model of the Character in the middle? Because I tried to use CT_OBJECT but it cant show the character because it can only show clean p3d models. Are there other options? I thought its (maby) possible to render the character without the terrain on a different camera.

Thanks for help!

Share this post


Link to post
Share on other sites

I think an easy way would be to Spawn a npc somewhere with the same Gear and face etc..

In my Opinion the drag n' drop and Tetris styled size system of DayZ is way harder to get rigth ;)

Share this post


Link to post
Share on other sites
Guest

You can change the camera pos like in the arsenal. Or do you really want the model to be in the UI directly ? Take a look for PIP I think there is a UI Element where you can display pip.

Share this post


Link to post
Share on other sites

You can change the camera pos like in the arsenal. Or do you really want the model to be in the UI directly ? Take a look for PIP I think there is a UI Element where you can display pip.

 If possible i want it to be in the ui ( cause i draw something behind the character). I thought you can use a new camera thats positioned in front of the player and renders only the character.

Share this post


Link to post
Share on other sites

You can change the camera pos like in the arsenal. Or do you really want the model to be in the UI directly ? Take a look for PIP I think there is a UI Element where you can display pip.

pip can be disabled by the user

Share this post


Link to post
Share on other sites

pip can be disabled by the user

 

Good to know!

Mh, iam running out of ideas....

Currently i try to use different cameras but i have no working solution.

Share this post


Link to post
Share on other sites

Seeing as PiP( render to texture) can be disabled, and its grainy even on highest settings, about the only way around this is to fake it with a full screen ui and a camera facing a dummy unit much like how the arsenal works in Eden.

Although the Eden Arsenal places the dummy unit inside a sphere which is textured on the inside of which you can find an example of here, but as you said you needed to draw something behind the player I thought a sphere would skew your image so instead I've opted for a userTexture10m_F behind the unit.

//initPlayerLocal.sqf
h = []  spawn {
	private[ "_display" ];
	
	disableSerialization;
	waitUntil { !isNull player };
	
	_loadout = getUnitLoadout player;
	
	_dummyPos = player getPos[ 10, getDir player ] vectorAdd [ 0, 0, 10 ];
	dummy = createGroup side player createUnit [ typeOf player, _dummyPos, [], 0, "NONE" ];
	dummy enableSimulationGlobal false;
	dummy setDir 0;
	dummy setUnitLoadout _loadout;
	
	_hips = dummy selectionPosition "pelvis";
	_hipsWorldPos = dummy modelToWorldVisual _hips;
	
	_backboardPos = _hipsWorldPos vectorAdd [ 0, -0.5, 0 ];
	_backboard = createVehicle [ "UserTexture10m_F", _backboardPos, [], 0, "CAN_COLLIDE" ];
	_backboard setObjectTexture [ 0, "#(rgb,8,8,3)color(0.2,0.2,0.2,1)" ];
	_backboard setDir (( getDir dummy ) - 180 );
	
	_camPos = _hipsWorldPos vectorAdd[ 0, 4, 0 ];
	cam = "camera" camCreate _camPos;
	cam camSetDir (getPos cam vectorFromTo _hipsWorldPos);
	cam cameraEffect [ "Internal", "BACK" ];
	cam camCommit 0;
	
	selectPlayer cam;
	
	//*****
	//Ignore from here down
	//*****
	createDialog "RscDisplayNotFreezeBig";
	waitUntil { _display = findDisplay 100002; !isNull _display };

	{
		_ctrl = _display displayCtrl _x;
		_ctrl ctrlSetPosition [ 0, 0, 0, 0 ];
		_ctrl ctrlCommit 0;
	}forEach [ 101, 1080, 1081, 1082, 1083 ];
		
	_picHeight = 0.1;
	
	{
		_pic = _display ctrlCreate [ "RscPicture", 120 + _forEachIndex ];
		_pic ctrlSetPosition _x;
		_pic ctrlCommit 0;
		_pic ctrlSetText "#(rgb,8,8,3)color(0,0,0,1)";
	}forEach[
		[ safeZoneX, safeZoneY, safeZoneWAbs, abs safeZoneY ], //Top
		[ safeZoneX, 1, safeZoneWAbs, abs safeZoneY ], //Bottom
		[ safeZoneX, 0, abs safeZoneX + _picHeight, 1 ], //Left
		[ 1 - _picHeight, 0, abs safeZoneX + _picHeight, 1 ] //Right
	];
	
	_pics = [
		"\a3\ui_f\data\gui\rsc\rscdisplayarsenal\goggles_ca.paa",
		"\a3\ui_f\data\gui\rsc\rscdisplayarsenal\backpack_ca.paa",
		"\a3\ui_f\data\gui\rsc\rscdisplayarsenal\binoculars_ca.paa",
		"\a3\ui_f\data\gui\rsc\rscdisplayarsenal\cargomag_ca.paa",
		"\a3\ui_f\data\gui\rsc\rscdisplayarsenal\cargomagall_ca.paa",
		"\a3\ui_f\data\gui\rsc\rscdisplayarsenal\cargomisc_ca.paa",
		"\a3\ui_f\data\gui\rsc\rscdisplayarsenal\cargoput_ca.paa",
		"\a3\ui_f\data\gui\rsc\rscdisplayarsenal\cargothrow_ca.paa",
		"\a3\ui_f\data\gui\rsc\rscdisplayarsenal\compass_ca.paa",
		"\a3\ui_f\data\gui\rsc\rscdisplayarsenal\face_ca.paa",
		"\a3\ui_f\data\gui\rsc\rscdisplayarsenal\map_ca.paa",
		"\a3\ui_f\data\gui\rsc\rscdisplayarsenal\gps_ca.paa",
		"\a3\ui_f\data\gui\rsc\rscdisplayarsenal\handgun_ca.paa",
		"\a3\ui_f\data\gui\rsc\rscdisplayarsenal\headgear_ca.paa",
		"\a3\ui_f\data\gui\rsc\rscdisplayarsenal\icon_ca.paa",
		"\a3\ui_f\data\gui\rsc\rscdisplayarsenal\insignia_ca.paa",
		"\a3\ui_f\data\gui\rsc\rscdisplayarsenal\itemacc_ca.paa",
		"\a3\ui_f\data\gui\rsc\rscdisplayarsenal\itembipod_ca.paa",
		"\a3\ui_f\data\gui\rsc\rscdisplayarsenal\itemmuzzle_ca.paa",
		"\a3\ui_f\data\gui\rsc\rscdisplayarsenal\itemoptic_ca.paa"
	];
	
	{
		_index = _forEachIndex * 10;
		_posX = _x;
		{
			_pic = _display ctrlCreate [ "RscActivePictureKeepAspect", 100 + ( _forEachIndex + _index ) ];
			_pic ctrlSetPosition[ _posx, _forEachIndex * _picHeight, _picHeight, _picHeight ];
			_pic ctrlCommit 0;
			_pic ctrlSetText ( _pics select ( _forEachIndex + _index ));
		}forEach [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 0 ];
	}forEach [ 0, 1-_picHeight ];
	
	{
		_x params[ "_image", "_pos" ];
		_rotScalePics = _display ctrlCreate [ "RscActivePictureKeepAspect", 120 ];
		_rotScalePics ctrlSetPosition _pos;
		_rotScalePics ctrlCommit 0;
		_rotScalePics ctrlSetText _image;
	}forEach[
		[ "\a3\3den\data\displays\display3den\toolbar\widget_rotation_off_ca.paa", [ 0.5 - ( _picHeight/2 ), 1 - ( _picHeight/2 ), ( _picHeight/2 ), ( _picHeight/2 ) ] ],
		[ "\a3\3den\data\displays\display3den\toolbar\widget_scaling_off_ca.paa", [ 0.5, 1 - ( _picHeight/2 ) , ( _picHeight/2 ), ( _picHeight/2 ) ] ]
	];
	
	_btn = _display ctrlCreate [ "RscActivePictureKeepAspect", 130 ];
	_btn ctrlSetPosition[ _picHeight, 0, 0.8, 1 ];
	_btn ctrlCommit 0;
	_btn ctrlSetText "#(rgb,8,8,3)color(0,0,0,0)";
	_btn buttonSetAction "call LARs_fnc_toggleButton";
	
	LARs_fnc_toggleButton = {
		if ( isNil "LARs_toggleButton" ) then {
			LARs_toggleButton = true;
		}else{
			LARs_toggleButton = !LARs_toggleButton;
		};
		
		if ( LARs_toggleButton ) then {
			LARs_toggleButton_EH = [] spawn {
				disableSerialization;
				_ctrl = findDisplay 100002 displayctrl 130;
				_pos = ctrlPosition _ctrl;
				_pos params[ "_posX", "_posY", "_width", "_height" ];
				_posXMax = _posX + _width;
				_posYMax = _posY + _height;
				_initRot = getDir dummy;
				getMousePosition params[ "_mX", "_mY" ];
				_initX = _mX - ( _posX + ( _width/2 ));
				while{ LARs_toggleButton } do {
					getMousePosition params[ "_mX", "_mY" ];
					if ( _mX > _posX && _mX < _posXMax && _mY > _posY && _mY < _posYMax ) then {
						_rot = linearConversion[ _posX, _posXMax, _mX - _initX, _initRot + 360, _initRot - 360 ];
						dummy setDir _rot;
						
						_hipsWorldPos = dummy modelToWorld ( dummy selectionPosition "pelvis" );
						_hipsPosZ = _hipsWorldPos select 2;
						_headPosZ = ( dummy modelToWorld ( dummy selectionPosition "head" ) select 2 ) + 0.2;
						
						_targetZ = linearConversion[ _posY, _posYMax, _mY, _headPosZ, _hipsPosZ ];
						cam camSetTarget [ _hipsWorldPos select 0, _hipsWorldPos select 1, _targetZ ];
						
						_camFov = linearConversion[ _posY, _posYMax, _mY, 0.1, 0.7 ];
						cam camSetFov _camFov;
						
						cam camCommit 0;
					}else{
						LARs_toggleButton = false;
					};
				};
			};
		};
	};
};
You can ignore anything below selectPlayer _cam as all it is doing is creating a fake ui for demonstration purposes.

So all you would need to do is set the texture on the userTexture object and then create a full screen UI to hide it all behind, just leaving a hole in the center where the camera views the dummy unit.

If you need to change the current view of the dummy unit instead of rotating the camera around the dummy like the Arsenal, just rotate the dummy unit instead so the userTexture is always in place as the backdrop. Try clicking on the unit view in the example to see what i mean.

  • 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

×