2015年2月9日 星期一

difference between Update and FixedUpdate

 Update
update in the amount of Framerate

 FixedUpdate
update in the amount of 24fps

unity - showing instance object [System.Serializable]


[System.Serializable]

public class Boundary{
    public float minX,maxX,minZ,maxZ;
    }



public class PlayerControlor : MonoBehaviour {
    public Boundary boundary;



}

unity - rigidbody rotate






        rigidbody.velocity = movement*speed;


        rigidbody.rotation = Quaternion.Euler (0,0,-rigidbody.velocity.x *tilt);

unity - get keyboard arrow ,



        float moveX = Input.GetAxis ("Horizontal");
        float moveY = Input.GetAxis ("Vertical");



        Vector3 movement = new Vector3 (moveX, 0.0f, moveY);


        rigidbody.velocity = movement*speed;









unity - flight, plane control

[System.Serializable]

public class Boundary{
    public float minX,maxX,minZ,maxZ;
    }

public class PlayerControlor : MonoBehaviour {
    public Boundary boundary;
    public float speed=0.01f;
    public float tilt=4;

    void FixedUpdate(){
        float moveX = Input.GetAxis ("Horizontal");
        float moveY = Input.GetAxis ("Vertical");

        Vector3 movement = new Vector3 (moveX, 0.0f, moveY);
        rigidbody.velocity = movement*speed;
        rigidbody.rotation = Quaternion.Euler (0,0,-rigidbody.velocity.x *tilt);

        rigidbody.position = new Vector3 (
            Mathf.Clamp(rigidbody.position.x,boundary.minX,boundary.maxX),
            0.0f,
            Mathf.Clamp(rigidbody.position.z,boundary.minZ,boundary.maxZ)
                );
    }
}

2015年2月8日 星期日

unity 3d, texture material

3d model:
http://tf3dm.com/3d-models/unity

petergo
jy02927731@yahoo.com.hk
00423564


https://3dwarehouse.sketchup.com/?redirect=1
facebook




2015年2月6日 星期五

Unity - panel trigger

public class gameOverTrigger : MonoBehaviour {

    void OnTriggerEnter(){
        Debug.Log ("game over");

    }
}