- Home /
Question by
Vicent_7 · Jul 27, 2016 at 07:05 PM ·
transformpositiontransform.positionpositioning
Transform.position not working ???
public class PlaneScript : MonoBehaviour
{
Vector3 velocidad = Vector3.zero;
public float Gravedad;
public float VelocidadSalto;
bool Salto = false, IsAlive = true;
public float velMax;
void Update ()
{
if (IsAlive && Input.GetKeyDown(KeyCode.Space))
{
Salto = true;
}
else if(IsAlive && Input.touchCount >= 1)
{
Touch myT = Input.GetTouch(0);
if(myT.phase == TouchPhase.Began)
{
Salto = true;
}
}
}
void FixedUpdate()
{
//Gravity
velocidad.y += Gravedad * Time.deltaTime;
//JumpVelocity
if (Salto)
{
Salto = false;
//if(transform.position.y < 1.5f)
//{
velocidad.y = VelocidadSalto;
//}
}
//SetTheVelocity
transform.position += velocidad * Time.deltaTime;
}
}
Comment
Your answer
Follow this Question
Related Questions
Getting Transform position using mouse position 3 Answers
seperation of prefabs with two dimensional terrain generation 0 Answers
Changing water level 0 Answers
Object with many children will not show up in the center although its coordinates are set to 0, 0, 0 1 Answer
Place object in front of me with given Translation Vector 0 Answers