Question by
kolabrodsmor · Sep 29, 2021 at 05:14 PM ·
gameobjectstutter
Gameobject stutters a lot when moving after me
It stutters a lot up and down and doesnt move smoothly
code: using System.Collections; using System.Collections.Generic; using UnityEngine;
public class Enemy : MonoBehaviour { // Start is called before the first frame update
GameObject target;
public float rotx = 0;
public float roty = 0;
public float rotz = 0;
public float speed = 3;
void Start()
{
target = GameObject.FindWithTag("Player").gameObject;
}
// Update is called once per frame
void Update()
{
transform.LookAt(target.transform);
transform.Translate(Vector3.forward * 3 * Time.deltaTime);
transform.Rotate(rotx, roty, rotz);
}
void OnCollisionEnter(Collision other)
{
if (other.gameObject.tag == "Player")
{
Destroy(gameObject);
}
}
void OnTriggerEnter(Collider other)
{ }
}
Comment