forked from github/game-off-2012
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added camera movement script along with another small component of that
which controls the intensity of the light based on the height of the camera.
- Loading branch information
Alex Morais
committed
Nov 14, 2012
1 parent
c33db17
commit d920a22
Showing
3 changed files
with
28 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#pragma strict | ||
|
||
var camHeight : int = 15; | ||
var camPos : Vector3 = Vector3(32,camHeight,32); | ||
var posMax : int = 5; | ||
var posMin : int = 0; | ||
var htMax : int = 15; | ||
var htMin : int = 5; | ||
var camOrigin : Transform; | ||
|
||
function Start () { | ||
gameObject.Find("Main Camera").transform.position = camOrigin.transform.position; | ||
gameObject.Find("Main Camera").transform.position.y = camHeight; | ||
} | ||
|
||
function Update () { | ||
|
||
camPos = gameObject.Find("Main Camera").transform.position; | ||
if(!Input.GetKey(KeyCode.LeftControl)) | ||
{ | ||
gameObject.Find("Main Camera").transform.position = Vector3(Mathf.Clamp(camPos.x + Input.GetAxis("Mouse X"), posMin, posMax), | ||
Mathf.Clamp(camPos.y + Input.GetAxis("Mouse ScrollWheel"), htMin, htMax), | ||
Mathf.Clamp(camPos.z + Input.GetAxis("Mouse Y"), posMin, posMax)); | ||
|
||
gameObject.Find("Point light").light.intensity = gameObject.Find("Main Camera").transform.position.y*0.2; | ||
} | ||
//.intensity = gameObject.Find("Main Camera").transform.position.y; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.