How do i put "Wasted!" after respawn?
ok i'm a beginner and i made the ball game from the very first turtorial. i made the winText and countText and i know the script staff of theese.. i created a respawn code that when y is lower that some number it repawns back it works, but i also want to add then y is bigger then some point respawn to 0,0,0 and show text "wasted" i tried this code, using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI;
public class respawn : MonoBehaviour { public Text r;
public float threshold;
public float k;
void start()
{
r.text = "";
}
void Respawn()
{
transform.position = new Vector3(0.07f, 0.69f, 3.81f);
}
void FixedUpdate()
{
if (transform.position.y < threshold)
r.text = "wasted!";
Respawn();
}
}
But when i run it the player ball falls down in slow mo going through the ground object. It looks simple but im stuck for hours. Please Help. After fixing this i will do if position.x is less than -1 r.text=" "
whenever you respawn just set rigidBody's velocity to (0,0,0)
GetComponent<Rigidbody>().velocity = Vector3.zero;
Your answer
Follow this Question
Related Questions
How to stop movement script on void start and resume after. 0 Answers
Dreamlo Leaderbord issue 0 Answers
Rayscast from the GameObject that is not the player does not work 0 Answers
Touch screen Input Help 1 Answer
Saving Data (please help) 0 Answers