Answer the question
In order to leave comments, you need to log in
Smooth change of object coordinates in unity?
Good evening comrade friends.
I move left to right and jump by clicking on 3 corresponding buttons. everything works with the jump, but the movement is instantaneous. How to make it move smoothly and not "teleport"?
( btnLeftClick , btnRightClick )
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
using System.Collections;
public class Ball : MonoBehaviour {
...
void btnTopClick() {
if(canJump){
canJump = false;
rb.AddForce(0, forceConst, 0, ForceMode.Impulse);
}
}
void btnLeftClick() {
transform.Translate(new Vector3(-5, 0, 0));
}
void btnRightClick() {
transform.Translate(new Vector3(5, 0, 0));
}
...
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question