Why is transform.translate not working?

float drehen;
Vector3 Richtung = new Vector3(0f,0f,1f);
// Use this for initialization
void Start () {
drehen = 1;
Richtung = Vector3.left;
}

// Update is called once per frame
void Update () {
	transform.Translate (0.1f*Vector3.left*Time.deltaTime);
}

hi there

This is the beginn of a script to controll the movement of my robot. But I have a problem. transform.Translate doesn’t move it at all. What did i wrong? Could anyone help me please?

thanks

Did you actually attach that script to an object? I tested it and it worked for me.

@Somniothedreamer

I had the exact same problem… I found 5.4 did some weird stuff with my

transform.Translate (Vector3.left * Time.deltaTime) 

I found a nifty solution here:

Then I hacked it to do what I needed. Hope this makes sense and helps others online.

  void Update()
    {
    if(transform.localScale.x > 0) {
    	_move = new Vector3(4,0,0);
    }
    
    if(transform.localScale.x < 0) {
    	_move = new Vector3(-4,0,0);
    }
    
    transform.Translate (_move * Time.deltaTime * 50, Space.World);
    }

Sharing is caring

The script needs to be attached to your robot as a component. Then try modifying the 0.1f multiplier, probably it moves very slowly.

yes id did attached it to two diffrent objects. Maybe i have to change my version of unity. My actual is 5.4.0f3