4DIS - Character Controllers

From Unify Community Wiki
(Difference between revisions)
Jump to: navigation, search
(Character Controllers)
Line 17: Line 17:
 
{
 
{
 
      
 
      
 +
   
 +
    rigidbody.velocity = Vector3.Lerp ( rigidbody.velocity, motion, Time.deltaTime * force );
 
}
 
}
  
 
</javascript>
 
</javascript>

Revision as of 15:56, 29 October 2011

Character Controllers


Roll a ball :

<javascript>

@script RequireComponent ( Rigidbody )

public var speed : float = 5.0; public var force : float = 7.5;

private var motion : Vector3 = new Vector3 ( 0, 0, 0 );

function Update ( ) {


   rigidbody.velocity = Vector3.Lerp ( rigidbody.velocity, motion, Time.deltaTime * force );

}

</javascript>

Personal tools
Namespaces

Variants
Actions
Navigation
Extras
Toolbox