void update(){
if(Input.GetKey(KeyCode.A)){
transform.position -= transform.right * speed * 2;
if(speed < 1){
speed = speed + .001f;
}
if( currenthp < maxhp){
currenthp += 1;
}
}
That code moves my character to the left, but I have another piece of code
void OnCollisionEnter(Collision collision) {
if(collision.gameObject.name == "fallb"){
Vector3 tempvect = new Vector3(150, 730, -772);
rigidbody.position = tempvect;
}
}
This is made to send him back to beginning if struck, but it only does that when it’s standing completely still. If it’s moving, the falling block just lands right on top of it and stays there.
Any advice?