- Home /
Vector 3.up error
Hi,
I wrote a script with a vector 3.up in it everything else with the script is fine, its just the vector3.up which is giving me the error. It says error CS1525: Unexpected symbol .', expecting
)', ,',
;', [', or
=' which i dont understand
CODE
using UnityEngine;
using System.Collections;
public class DeathPopUp1 : MonoBehaviour {
public GameObject player;
public float movementSpeed = 10;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
if (player == null) {
transform.position * Vector3.Up * Time.deltaTime*movementSpeed == new Vector3(0.09f, 1.57f, 0.0f);
}
}
}
Answer by Cherno · Jul 15, 2015 at 04:59 PM
You are using a false syntax. I suppose you are trying to change the transform.position so that it moves upwards.
transform.position = transform.position + Vector3.up * Time.deltaTime * movementSpeed;
how do i make the object stop at a certain point. Because it keeps going up would this work:
void Update () {
if (player == null) {
transform.position = transform.position + Vector3.up * Time.deltaTime * movementSpeed;
new Vector3(0.09f, 1.57f, 0.0f);
}
}
You just check if the y value of transform.position is below a certain value, and then only apply the movement if it is.
if(transform.position.y < 1.57f) {
transform.position = transform.position + Vector3.up * Time.deltaTime * movementSpeed;
}
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Trouble with Vector3.Angle() and RotateAround() 1 Answer
How do I programmatically specify direction from a given vector? 1 Answer
2D Platformer Bug 0 Answers