V
V
Voron_142020-08-02 03:14:25
Unity
Voron_14, 2020-08-02 03:14:25

Why does my character only move in one direction and not in the other?

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class playar : MonoBehaviour {

     public GameObject goal1;
     public GameObject goal2;

     bool check = false;

     void Update(){

     if(check) transform.position = Vector3.MoveTowards(transform.position, goal1.transform.position, 2f * Time.deltaTime);
     if(!check) transform.position = Vector3.MoveTowards(transform.position, goal2.transform.position, 2f * Time.deltaTime);

     transform.rotation *= Quaternion.Euler(0f,0f,1.9f);

     }
     
     public void change(){
          check = !check;
     }
}

Answer the question

In order to leave comments, you need to log in

5 answer(s)
D
DevMan, 2015-02-18
@newbie67

ping has nothing to do with the functioning of other services.

D
Dee Key, 2015-02-18
@Dee_Key

ping "dnsname"

I
index0h, 2015-02-18
@index0h

To rephrase your question: why is the car not moving? The wipers work, the wheels are inflated, even when the wife is behind the wheel, she does not drive.
I lead to the fact that the site may "not work" for dohrenallion reasons, and you are looking for the answer in the wrong place.
ping - answers the questions:
* is the server at the network level accessible from the client machine in principle
* how long does the request / response take

Z
zhogar, 2015-02-18
@zhogar

http is down.

A
Alexey Tutubalin, 2015-02-18
@Kennius

Now you should ideally hire a freelance system administrator who will set it up once, find the cause of the fall from the logs, eliminate it and explain what and why happened so that in the future they could raise it themselves

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question