creazione siti ferrara

Unity 3D – Hide Mouse Cursor

Unity 3D – Hide Mouse Cursor

1. Load a Scene

2. Select MainCamera, assign HideCursor.JS

#pragma strict
  
function Start () {  
	// Hide the cursor
	Screen.showCursor = false;	
}
   

function Update () {  
}


3. Build it and run

NOTICE: If you try the game during production you will see the mouse cursor! You have to build to see the final result!

By |Unity3D, Video Games Development|Commenti disabilitati su Unity 3D – Hide Mouse Cursor

Unity 3D Game Engine – Frames per Seconds – JavaScript

Unity 3D Game Engine – Frames per Seconds – JavaScript

1. Create GUIText and attach:


// Attach this to a GUIText to make a frames/second indicator.
//
// It calculates frames/second over each updateInterval,
// so the display does not keep changing wildly.
//
// It is also fairly accurate at very low FPS counts (<10).
// We do this not by simply counting frames per interval, but
// by accumulating FPS for each frame. This way we end up with
// correct overall FPS even if the interval renders something like
// 5.5 frames.
 
var updateInterval = 0.5;
 
private var accum = 0.0; // FPS accumulated over the interval
private var frames = 0; // Frames drawn over the interval
private var timeleft : float; // Left time for current interval
 
function Start()
{
    if( !guiText )
    {
        print ("FramesPerSecond needs a GUIText component!");
        enabled = false;
        return;
    }
    timeleft = updateInterval;  
}
 
function Update()
{
    timeleft -= Time.deltaTime;
    accum += Time.timeScale/Time.deltaTime;
    ++frames;
 
    // Interval ended - update GUI text and start new interval
    if( timeleft <= 0.0 )
    {
        // display two fractional digits (f2 format)
        guiText.text = "" + (accum/frames).ToString("f2");
        timeleft = updateInterval;
        accum = 0.0;
        frames = 0;
    }
}

By |Unity3D, Video Games Development|Commenti disabilitati su Unity 3D Game Engine – Frames per Seconds – JavaScript

Unity 3D – Physic – Physics Materials – Standard Assets

Unity 3D – Physic – Physics Materials – Standard Assets

1. MAIN TOP MENU> Assets> Import Package> Physic Materials

2. Project> Assets> Standard Assets> Physic Materials>

– Bouncy
– Ice
– Metal
– Rubber
– Wood

By |Unity3D, Video Games Development|Commenti disabilitati su Unity 3D – Physic – Physics Materials – Standard Assets

3DS MAX – Biped to Unity Game Engine

3DS MAX – Biped to Unity Game Engine

Rigging a character using Biped and Skin in 3DS Max, animate and export it to Unity Game Engine.

Scene Setup

1. Setup the units using the parameters in the link below:

http://www.lucedigitale.com/blog/3ds-max-micro-reference-manual-unit-setup-interiors/

2. Create and animate a mesh with Biped + Skin Modifier.
You have not to use ‘Physique Modifier’ because ‘Skin Modifier’ has best support in FBX format.

3. Select the mesh and give it a name, this name will be the name of ‘Mesh’ component inside Unity

FBX Export

4. Select the mesh> MAIN TOP LEFT BUTTON> File> Export> Export Selected> FBX> give it a name, it will be the name of the Asset inside Unity.

FBX Export setup:

>Geometry
check TurboSmooth
check Convert Deforming Dummies to Bones
check Preserve edge orientation

>Animation
check Animation

>Deformations
check Deformations
check Skins
check Morphs

>Unroll Rotations
check Follow Y-Up

>Scale Factor
check Automatic (1 unity = 1 3DSMax meter)

>Axis Conversion
Up Axis = Y-up

>FBX File Format
Type: Binary
Version: FBX 2013

Unity – Import

1. Open Unity> MAIN TOP MENU> Assets> Import New Asset…> select the .FBX file

2. Project> the new Asset (the blue box icon) with the .FBX file name> DRAG AND DROP into Viewport the blue box icon

You will see:

Viewport>

1 unity = 1 3DSMax meter

Project>

Asset blue box icon (file name)
-> Inspector> Rig> Animation Type: Generic> ‘Apply’ button
-> Model> Scale Factor: 0.01 (the original 3DSMax scene was in centimeters), resize if you need> ‘Apply’ button
-> Animations> + or – to cut Takes, Loop Time
– Mesh
– Take 001 (the animation)
– Avatar
– Bip001
– Material

Hierarchy>

Asset (file name) -> Transform + Animator
– Bip001
— Bip001 Pelvis
— Bip001 Spine -> Transform, you can re-animate bones with the transform tools!
— …
– Mesh -> Transform + Skinned Mesh Renderer + Material

Unity – Apply Animation

1. Projects> RMB> Create> Animator Controller> name it ‘PlayerAnimator’

2. MAIN TOP MENU> Window> Animator

3. Project> Take 001 DRAG AND DROP into Animator window, ‘Take 001’ turn in yellow because it is the default animation

4. Project> Animator Controller ‘PlayerAnimator’ DRAG AND DROP into Hierarchy> Asset (file name)> Animator> Controller

5. MAIN TOP BUTTON ‘Play’

Unity – Multiple Takes

Solution one

1. Inside 3DSMax you can create multiple animations inside timeline, example

a. frame 0-25 walk
b. frame 26-50 run
c. frame 51-100 die

2. File> Export Selected> FBX

FBX Export setup:

>Bake Animation
check Bake Animation
Start: 0 – End: 25

Save as walk.fbx

3. Unity> MAIN TOP MENU> Assets> Import New Asset…> walk.fbx

Project> you will find the Take001 animation of 1-25

Repeat the operation for all the takes you need.

Solution two

1. Inside 3DSMax you can create multiple animations inside timeline, example

a. frame 0-25 walk
b. frame 26-50 run
c. frame 51-100 die

2. File> Export Selected> FBX

FBX Export setup:

>Bake Animation
check Bake Animation
Start: 0 – End: 100

Save as walk.fbx, alla animations will be stored in a single file.

3. Unity> MAIN TOP MENU> Assets> Import New Asset…> walk.fbx

Project> select the new Asset (blue box icon)> Inspector> Animations> Clips use + or – to cut the Take using the procedure below:

a. + icon
b. Give the name
c. setup ‘Start’ ‘End’
d. ‘Apply’ button

Repeat the operation for all the takes you need.

Project> you will find the Take001 animation of 1-25 – Take002 etc…

By |Unity3D, Video Games Development|Commenti disabilitati su 3DS MAX – Biped to Unity Game Engine

MySQL Quick Reference – Functions

MySQL Quick Reference – Functions

Tested on MySQL 5.5

SQL Aggregate Functions

SQL aggregate functions return a single value, calculated from values in a column.


/* SELECT AVG(column_name) FROM table_name */
SELECT AVG(column_name) FROM table_name

/* The COUNT() function returns the number of rows that matches a specified criteria */
SELECT COUNT(column_name) FROM table_name;

/* The COUNT(*) function returns the number of records in a table */
SELECT COUNT(*) FROM table_name;

/* The COUNT(DISTINCT column_name) function returns the number of distinct values of the specified column */
SELECT COUNT(DISTINCT column_name) FROM table_name;

/* The FIRST() function returns the first value of the selected column */
/* MySQL not support FIRST() but you can use: */
SELECT column_name FROM table_name
ORDER BY column_name ASC
LIMIT 1;

/* The LAST() function returns the first value of the selected column */
/* MySQL not support LAST() but you can use: */
SELECT column_name FROM table_name
ORDER BY column_name DESC
LIMIT 1;

/* The MAX() function returns the largest value of the selected column */
SELECT MAX(column_name) FROM table_name;

/* The MIN() function returns the smallest value of the selected column */
SELECT MIN(column_name) FROM table_name;

/* The SUM() function returns the total sum of a numeric column */
SELECT SUM(column_name) FROM table_name;

/* The GROUP BY statement is used in conjunction with the aggregate functions to group the result-set by one or more columns */
SELECT column_name, aggregate_function(column_name)
FROM table_name
WHERE column_name operator value
GROUP BY column_name;

/* The HAVING clause was added to SQL because the WHERE keyword could not be used with aggregate functions */
SELECT column_name, aggregate_function(column_name)
FROM table_name
WHERE column_name operator value
GROUP BY column_name
HAVING aggregate_function(column_name) operator value;

SQL Scalar functions

SQL scalar functions return a single value, based on the input value.


/* The UCASE() function converts the value of a field to uppercase */
SELECT UCASE(column_name) FROM table_name;

/* The LCASE() function converts the value of a field to lowercase */
SELECT LCASE(column_name) FROM table_name;

/* The MID() function is used to extract characters from a text field */
SELECT MID(column_name,start[,length]) AS some_name FROM table_name;

/* The LEN() function returns the length of the value in a text field */
SELECT LEN(column_name) FROM table_name;

/* The FORMAT() function is used to format how a field is to be displayed */
SELECT FORMAT(column_name,format) FROM table_name;

By |MySQL, Web Design|Commenti disabilitati su MySQL Quick Reference – Functions