<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="sr">
	<id>https://sr.doc.boardgamearena.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Galehar</id>
	<title>Board Game Arena - Кориснички доприноси [sr]</title>
	<link rel="self" type="application/atom+xml" href="https://sr.doc.boardgamearena.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Galehar"/>
	<link rel="alternate" type="text/html" href="https://sr.doc.boardgamearena.com/%D0%9F%D0%BE%D1%81%D0%B5%D0%B1%D0%BD%D0%BE:%D0%94%D0%BE%D0%BF%D1%80%D0%B8%D0%BD%D0%BE%D1%81%D0%B8/Galehar"/>
	<updated>2026-09-16T00:25:41Z</updated>
	<subtitle>Кориснички доприноси</subtitle>
	<generator>MediaWiki 1.39.0</generator>
	<entry>
		<id>https://sr.doc.boardgamearena.com/index.php?title=3D&amp;diff=2540</id>
		<title>3D</title>
		<link rel="alternate" type="text/html" href="https://sr.doc.boardgamearena.com/index.php?title=3D&amp;diff=2540"/>
		<updated>2017-07-09T20:19:18Z</updated>

		<summary type="html">&lt;p&gt;Galehar: Fix formatting&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
= Overview =&lt;br /&gt;
&lt;br /&gt;
Board Game Arena is using CSS 3D features to provide a basic 3D view of the games.&lt;br /&gt;
&lt;br /&gt;
This is not a &amp;quot;100% real&amp;quot; 3D as this is very difficult to play with real 3D model with CSS, but most of the time it provides a satisfying 3D view of the game.&lt;br /&gt;
&lt;br /&gt;
The objective of 3D is to provide a nice view of the game : 90% of the time, 2D is more suitable for playing. So we don&#039;t force developers to make sure games can be played in 3D : this is just a &amp;quot;bonus&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
= Enabling 3D =&lt;br /&gt;
&lt;br /&gt;
3D is enabled by default for your game.&lt;br /&gt;
&lt;br /&gt;
You can click on the &amp;quot;3D&amp;quot; button at the top right and see your game in 3D.&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t want to allow players to use 3D with your game, you can add this to you &amp;quot;gameinfos.inc.php&amp;quot; file :&lt;br /&gt;
&lt;br /&gt;
&#039;enable_3d&#039; =&amp;gt; false,&lt;br /&gt;
&lt;br /&gt;
= Detecting 3D =&lt;br /&gt;
&lt;br /&gt;
When 3D is &amp;quot;on&amp;quot;, BGA adds CSS class &amp;quot;mode_3d&amp;quot; to the body element.&lt;br /&gt;
&lt;br /&gt;
In CSS, you should prefix all your 3D mode specific directives by &amp;quot;.mode_3d&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
  .mode_3d .board {&lt;br /&gt;
      overflow: visible;&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
In Javascript, you can detect 3D by using the following :&lt;br /&gt;
&lt;br /&gt;
  if( this.control3dmode3d )&lt;br /&gt;
  {&lt;br /&gt;
     // Only executed in 3d mode&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
= Built-in 3D enhancements =&lt;br /&gt;
&lt;br /&gt;
BGA is doing some built-in 3D enhancements with your 3D adaptations, so your adaptation will have some 3D effects without any efforts :&lt;br /&gt;
&lt;br /&gt;
* When executing a slideToObject, a slideToObjectPos or a slideTemporaryObject, BGA is moving the objects vertically (up, then down).&lt;br /&gt;
* It also happens when moving elements of a Stock module, or to a Zone module.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Enhance your adaptation for 3D =&lt;br /&gt;
&lt;br /&gt;
== Use Z axis ==&lt;br /&gt;
&lt;br /&gt;
Using CSS transform: translateZ, you can translate your HTML elements along the Z axis. Example :&lt;br /&gt;
&lt;br /&gt;
  .floating_element {&lt;br /&gt;
      transform: translateZ( 20px );  /* This element is going to float 20px above the surface */&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
The framework will add the following to all your divs:&lt;br /&gt;
      transform-style: preserve-3d; &lt;br /&gt;
&lt;br /&gt;
So they will keep their position in 3D space relative to other elemens with the transformation defined.  Note that some CSS artifacts can break the css inheritance of the &amp;quot;preserve-3d&amp;quot; like &amp;quot;overflow:auto&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
At any moment, you can know the Z position of an element from javascript using :&lt;br /&gt;
&lt;br /&gt;
  this.getComputedTranslateZ( html_element );&lt;br /&gt;
&lt;br /&gt;
== Use pre-build BGA 3D CSS classes ==&lt;br /&gt;
&lt;br /&gt;
By adding the following classes to your objects, they will look nicer in 3D:&lt;br /&gt;
&lt;br /&gt;
* thickness: add a (3px) black thickness to your HTML element.&lt;br /&gt;
  &lt;br /&gt;
* roundthickness: (to be used with thickness) if your element is a circle, you should add roundthickness so your element thickness can be a circle too.&lt;br /&gt;
  &lt;br /&gt;
* whitethickness: (to be used with thickness) if you prefer to have a whitethickness instead of black.&lt;br /&gt;
  &lt;br /&gt;
* floatingabove: make your element &amp;quot;float&amp;quot; 10px above the surface, with a nice shadow.&lt;br /&gt;
  &lt;br /&gt;
* roundfloatingabove: (to be used with floatingabove) if your element is a circle, use roundfloatingabove in addition to floatingabove.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note: if you found some generic CSS that may help some other developers for 3D enhancements, please send it to us so we can add it there.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Setting the default point of view and enabling 3d by default ==&lt;br /&gt;
&lt;br /&gt;
Your game may require to use 3D mode enabled by default and also with a certain custom default PoinOfView. You can achieve this setting in your constructor section of your game:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        if (!dojo.hasClass(&amp;quot;ebd-body&amp;quot;, &amp;quot;mode_3d&amp;quot;)) {&lt;br /&gt;
        dojo.addClass(&amp;quot;ebd-body&amp;quot;, &amp;quot;mode_3d&amp;quot;);&lt;br /&gt;
        dojo.addClass(&amp;quot;ebd-body&amp;quot;, &amp;quot;enableTransitions&amp;quot;);&lt;br /&gt;
        $(&amp;quot;globalaction_3d&amp;quot;).innerHTML = &amp;quot;2D&amp;quot;;   // controls the upper right button &lt;br /&gt;
        this.control3dxaxis = 30;  // rotation in degrees of x axis (it has a limit of 0 to 80 degrees in the frameword so users cannot turn it upsidedown)&lt;br /&gt;
        this.control3dzaxis = 0;   // rotation in degrees of z axis&lt;br /&gt;
        this.control3dxpos = 100;   // center of screen in pixels&lt;br /&gt;
        this.control3dypos = 300;   // center of screen in pixels&lt;br /&gt;
        this.control3dscale = 1.4;   // zoom level, 1 is default 2 is double normal size, &lt;br /&gt;
        this.control3dmode3d = true ;  			// is the 3d enabled	&lt;br /&gt;
        $(&amp;quot;game_play_area&amp;quot;).style.transform = &amp;quot;rotatex(&amp;quot; + this.control3dxaxis + &amp;quot;deg) translate(&amp;quot; + this.control3dypos + &amp;quot;px,&amp;quot; + this.control3dxpos + &amp;quot;px) rotateZ(&amp;quot; + this.control3dzaxis + &amp;quot;deg) scale3d(&amp;quot; + this.control3dscale + &amp;quot;,&amp;quot; + this.control3dscale + &amp;quot;,&amp;quot; + this.control3dscale + &amp;quot;)&amp;quot;;&lt;br /&gt;
			}&lt;/div&gt;</summary>
		<author><name>Galehar</name></author>
	</entry>
</feed>