Hello!
I’m creating the bowling game. I have a problem. After skittles was shot down, the ball return to the starting position. If i push space button a ball does not move. It looks like subject without physics. How to reset the ball?
function Start() {
_startPosition = transform.position;
_startRotation = transform.rotation;
}
function Update() {
if(Input.GetKey(KeyCode.Space)){
if(flag == true) {
if(currentForce >= 70) {
currentForce += 0.5;
}
if(currentForce > 120) {
currentForce = 70;
}
}
}
if(Input.GetKeyUp(KeyCode.Space)) {
if(flag == true) {
audio.PlayOneShot(myClip);
myTransform.constantForce.force = transform.TransformDirection(Vector3.forward * currentForce);
flag = false;
}
}
if(viewAI.flag3 == true) { //viewAI another script, does not matter..
Reset();
flag = true;
}
}
function Reset() {
transform.position = _startPosition;
transform.rotation = _startRotation;
}