- Home /
Change of location to move a first person controler
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);
Answer by sparkzbarca · Nov 07, 2012 at 12:47 AM
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.
Your answer
Follow this Question
Related Questions
First Person Controler and Water wont effect gravity 1 Answer
How do you add a fixed joint to a first person controller 1 Answer
Default First Person Controller; turn off mouse look, view still moves 1 Answer
Problem With First Person View Controller 1 Answer
Is there a way to set or entirely cancel the velocity of a character controller? 1 Answer