Hi there ,stupid question time lol I want to move an object including its two children down (say 1000) units instantly . at the moment I am positioning the object in the editor 1000 units UP ,then in my script It moves down 1000 units when triggered with this command
GameObject.Find(“Ckp2”).transform.position = Vector3(1070,67,530);
// it was at (1070,1067,530)
This works perfectly but ,and heres the stupid question lol how can i place my checkpoint objects anywhere (x,y,z) then move them downwards (-y) ?
I tried transform.localposition but it seemed to move the object elsewhere to just downward ,I know this is an obvious answer lol ,what am I doing wrong please
GameObject object = GameObject.find(“Ckp2”);
float distance = 1000;
object.transform.position += -object.transform.up * distance;
mark as answered and happy coding.
getting a couple of errors ? I should have said my code is JS is your snippet in C# by any chance ?
function OnTriggerEnter(hit : Collider){
if (hit.gameObject.name == "Cube1"){
ckp=ckp+1;
GameObject object = GameObject.find("Ckp2");
float distance = 1000;
object.transform.position += -object.transform.up * distance;
gives me — Assets/Checkpoint.js(76,22): UCE0001: ‘;’ expected. Insert a semicolon at the end. its the GameObject object = GameObject.find(“Ckp2”);
GameObject.Find(“Ckp2”).transform.Translate(0, -900, 0);
transform.Translate LOL ,I knew it was something obvious Admins feel free to delete my stupid question