hi i am doing a project for university where i have to have a static first person controller and move it from one position on the map with the click of the right mouse button. this is the code that i have at the moment.
var CurrentPosition : String = “spawn1”;
if(Input.GetMouseButtonDown(1)){
function Update() ;{
if(CurrentPosition == "spawn1");}
}
else Transform.Postion (-10.37832,-8.181992,-25.7733);
that code is just bizarre but whatever where do you want to move it to? those positions?
you have a position which should be a vector3 shown as a string, you have an oddly specific coordinates to move to. but whatever.
anyways your code should be something like.
void Update(){
if(input.GetMouseButtonDown(1))
{
transform.position = new vector3(-10.37832,-8.181992,-25.7733);
}
}
bear in mind thats in C# not JS so for example
void update
should be
function update
other than that this is of course not a homework site. But im feeling generous and all that.