This is a documentation for Board Game Arena: play board games online !

Diferenzas entre revisións de «3D»

De Board Game Arena
Saltar ata a navegación Saltar á procura
Liña 29: Liña 29:
   {
   {
     // Only executed in 3d mode
     // Only executed in 3d mode
  }
= Built-in 3D enhancements =
BGA is doing some built-in 3D enhancements with your 3D adaptations, so your adaptation will have some 3D effects without any efforts :
* When executing a slideToObject, a slideToObjectPos or a slideTemporaryObject, BGA is moving the objects vertically (up, then down).
* It also happens when moving elements of a Stock module, or to a Zone module.
= Enhance your adaptation for 3D =
== Use Z axis ==
Using CSS transform: translateZ, you can translate your HTML elements along the Z axis. Example :
  .floating_element {
      transform: translateZ( 20px );  /* This element is going to float 20px above the surface */
   }
   }

Revisión como estaba o 20 de xuño de 2017 ás 10:27

Overview

Board Game Arena is using CSS 3D features to provide a basic 3D view of the games.

This is not a "100% real" 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.

The objective of 3D is to provide a nice view of the game : 90% of the time, 3D is more suitable for playing. So we don't force developers to make sure games can be played in 3D : this is just a "bonus".

Enabling 3D

3D is enabled by default for your game.

You can click on the "3D" button at the top right and see your game in 3D.

If you don't want to allow players to use 3D with your game, you can add this to you "gameinfos.inc.php" file :

'enable_3d' => false,

Detecting 3D

When 3D is "on", BGA adds CSS class "mode_3d" to the body element.

In CSS, you should prefix all your 3D mode specific directives by ".mode_3d".

In Javascript, you can detect 3D by using the following :

 if( this.control3dmode3d )
 {
    // Only executed in 3d mode
 }


Built-in 3D enhancements

BGA is doing some built-in 3D enhancements with your 3D adaptations, so your adaptation will have some 3D effects without any efforts :

  • When executing a slideToObject, a slideToObjectPos or a slideTemporaryObject, BGA is moving the objects vertically (up, then down).
  • It also happens when moving elements of a Stock module, or to a Zone module.


Enhance your adaptation for 3D

Use Z axis

Using CSS transform: translateZ, you can translate your HTML elements along the Z axis. Example :

 .floating_element {
     transform: translateZ( 20px );  /* This element is going to float 20px above the surface */
 }