- Home /
Question by
Chickenator · Dec 31, 2014 at 05:28 PM ·
vector3variablefloatnumber
How could I convert the y axis in a Vector 3 into a float?
Here's my script :
#pragma strict
var forwardSpeed : float = 20;
var leftRotate : float = 5;
var rightRotate : float = 5;
var upLift : Vector3;
var number : float = 0;
function Update () {
upLift = transform.InverseTransformDirection(rigidbody.velocity);
if (Input.GetKey(KeyCode.Space)) {
rigidbody.AddForce (transform.forward * forwardSpeed);
}
}
So I want the y axis of upLift to be turned into a float and used in the variable "number"
Comment
Your answer
Follow this Question
Related Questions
Using a variable as a components for Vector3 1 Answer
IntVector2 Struct useful? 1 Answer
Lottery system 1 Answer
summing up items price in runtime 1 Answer
make my gameobject lerp between points more smoothly 0 Answers