Question by
ChazzaH2004 · Oct 19, 2020 at 09:32 AM ·
transform.
Pinball Movement not stopping when using localPosition
Im working on a pinball game and i have a box where the ball will go on it and will be moved to the launcher but it still bouncing around like mad and is quite annoying. how do i stop the movement when i change the position? Here is my code. using System.Collections; using System.Collections.Generic; using UnityEngine;
public class BallReset : MonoBehaviour
{
public LCDController lcd;
public GameObject ball;
// Start is called before the first frame update
void Start()
{
}
// Update is called once
private void OnTriggerEnter(Collider other)
{
StartCoroutine(Reset());
}
IEnumerator Reset()
{
ball.SetActive(false);
Debug.Log("Ball Destroyed");
yield return new WaitForSeconds(1);
ball.transform.localPosition = (new Vector3(-3.332f, 0.113f, -1.628f));
Debug.Log("Ball Reset");
ball.SetActive(true);
lcd.life -= 1;
}
}
Comment
Your answer
Follow this Question
Related Questions
Rotate 3d character in 2d space 0 Answers
2D Local Scaling Stretches Game Object 0 Answers
,Drag and Drop game 0 Answers