4DIS - Camera Controller

From Unify Community Wiki
(Difference between revisions)
Jump to: navigation, search
(Camera Controllers)
Line 1: Line 1:
 
== '''Camera Controllers''' ==
 
== '''Camera Controllers''' ==
 +
 +
[[4D IS]] - Back
  
 
----
 
----

Revision as of 16:20, 29 October 2011

Camera Controllers

4D IS - Back


Camera Controller A.js

<javascript>

public var target : Transform;

public var positionOffset : Vector3 = new Vector3 ( 0, 0, 0 ); public var rotationOffset : Vector3 = new Vector3 ( 0, 0, 0 ); public var positionForce : float = 5.0; public var rotationForce : float = 5.0;

private var position : Vector3 = new Vector3 ( 0, 0, 0 ); private var rotation : Quaternion = new Quaternion ( 0, 0, 0, 0 );

function Update ( ) { position = Vector3.Lerp ( position, target.position, Time.deltaTime * positionForce ); rotation = Quaternion.Lerp ( rotation, target.rotation, Time.deltaTime * rotationForce );

transform.position = position; transform.rotation = rotation;

transform.Rotate ( rotationOffset, Space.Self ); transform.Translate ( positionOffset, Space.Self ); }

</javascript>

Personal tools
Namespaces

Variants
Actions
Navigation
Extras
Toolbox