Creare Videogiochi - Game Developer
Player piccolo, piccolo - Versione stampabile

+- Creare Videogiochi - Game Developer (https://www.making-videogames.net/giochi)
+-- Forum: Unity3D Italia (https://www.making-videogames.net/giochi/Forum-Unity3D-Italia)
+--- Forum: Unity3D Discussioni Generali (https://www.making-videogames.net/giochi/Forum-Unity3D-Discussioni-Generali)
+--- Discussione: Player piccolo, piccolo (/thread-Player-piccolo-piccolo)



Player piccolo, piccolo - Kuroko - 07-12-2012

Salve, volevo chiedervi come potevo fare a rimpicciolire i player.
Per capirci meglio, ho creato una stanza, voglio fare in modo che i giocatori si muovano in questa stanza come fossero della grandezza di una formica.
Ovviamente ho gia provato a rimpicciolire con il ridimensionamento standard di Unity, ma non basta, rimane comunque troppo grande, e se ingrandisco ulteriormente la stanza, questa sparisce dalla scena.
Qualche idea?
Grazie in anticipo ^^


RE: Player piccolo, piccolo - Exorcist - 07-12-2012

Prova cosi
Codice:
function ResizeUnity()

    {

        //This function properly assigns innerWidth and Height to winWidth and winHeight

        GetWindowSize();



        var unity = document.getElementById('unityPlayer');

        if(unity != null)

            {                  

                unity.style.width = winWidth + "px";

                unity.style.height = winHeight + "px";

            }

    }



RE: Player piccolo, piccolo - Kuroko - 07-12-2012

(07-12-2012, 12:56 PM)Exorcist Ha scritto: Prova cosi
Codice:
function ResizeUnity()

    {

        //This function properly assigns innerWidth and Height to winWidth and winHeight

        GetWindowSize();



        var unity = document.getElementById('unityPlayer');

        if(unity != null)

            {                  

                unity.style.width = winWidth + "px";

                unity.style.height = winHeight + "px";

            }

    }


Intanto grazie mille per la risposta rapida, molto gentile.
Ti chiedo se puoi perdonare la mia ignoranza, ma lo script a cosa lo assegno?
E ancora uan doamnda se mi è permesso. Come faccio ad aumentare langolo di visualizazione in lontananza? ( il limite di dove puo vedere il player per intenderci)
Grazie ancora, molto gentile ^^

(07-12-2012, 02:01 PM)Kuroko Ha scritto:
(07-12-2012, 12:56 PM)Exorcist Ha scritto: Prova cosi
Codice:
function ResizeUnity()

    {

        //This function properly assigns innerWidth and Height to winWidth and winHeight

        GetWindowSize();



        var unity = document.getElementById('unityPlayer');

        if(unity != null)

            {                  

                unity.style.width = winWidth + "px";

                unity.style.height = winHeight + "px";

            }

    }


Intanto grazie mille per la risposta rapida, molto gentile.
Ti chiedo se puoi perdonare la mia ignoranza, ma lo script a cosa lo assegno?
E ancora uan doamnda se mi è permesso. Come faccio ad aumentare langolo di visualizazione in lontananza? ( il limite di dove puo vedere il player per intenderci)
Grazie ancora, molto gentile ^^

Ok, credo daver capito che lo script non devo assegnarlo a nessun oggetto. Pero mi da 4 errori:

Assets/(Z) CAnttina/Script/Resising.js(7,9): BCE0005: Unknown identifier: 'GetWindowSize'.

Assets/(Z) CAnttina/Script/Resising.js(11,21): BCE0005: Unknown identifier: 'document'.

Assets/(Z) CAnttina/Script/Resising.js(17,37): BCE0005: Unknown identifier: 'winWidth'

Assets/(Z) CAnttina/Script/Resising.js(19,38): BCE0005: Unknown identifier: 'winHeight'.


RE: Player piccolo, piccolo - Exorcist - 07-12-2012

Ciao scusa la tarda risposta:
dove sto leggendo io un utente manda questo codice che gli da questi errori:
From various alert()s in the code, I can verify that ResizeUnity() is being called when I change the size of the window. I can verify that winWidth and winHeight are getting proper values assigned to them upon resizing. But, no matter what I do to the browser window, the Unity WebPlayer object stays the same size it was when it was loaded.

Codice PHP:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<
html xmlns="http://www.w3.org/1999/xhtml">

    <
head>

       <
script type="text/javascript">

       <!--

       function 
GetUnity() 

       {

         if (
typeof unityObject != "undefined"

         {

          return 
unityObject.getObjectById("unityPlayer");

         }

         return 
null;

       }

 

       function 
ResizeUnity()

       {

         
//This function properly assigns innerWidth and Height to winWidth and winHeight

         
GetWindowSize();

 

         var 
unity GetUnity();

         if(
unity != null)

         {

          
//This does not properly resize anything at all

          
unity.width winWidth;

          
unity.height winHeight;

         }

       }

    }

 

    if (
typeof unityObject != "undefined"

    {

       
GetWindowSize();

       
unityObject.embedUnity("unityPlayer""WebPlayer.unity3d"winWidthwinHeightparams);       

    }

    -->

    </
script>

    <
style type="text/css">

    <!--

    
div#unityPlayer {

       
cursor: default;

       
height100%;

       
width100%;

    }

    -->

    </
style>

    </
head>

    <
body margin="0" marginwidth="0" marginheight="0" scroll="no" onResize="ResizeUnity()">

       <
div class="content">

         <
div id="unityPlayer">

          <
div class="missing">

              <
a href="http://unity3d.com/webplayer/" title="Unity Web Player. Install now!">

              </
a>

          </
div>

         </
div>

       </
div>

    </
body>

</
html

quindi un utente gli manda quel script che ti ho dato prima:
It seems the GetUnity() function wasn't grabbing an element high enough up its div hierarchy for me to resize the correct element. Updating my ResizeUnity() function with this did the trick(codice sopra)
ps: questo script è per ridimensionare il player quindi penso che lo puoi fare delle misure che ti servono.