o codigo da bala:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Bala : MonoBehaviour
{
public float Velocidade = 30;
void FixedUpdate() {
GetComponent<Rigidbody>().MovePosition
(GetComponent<Rigidbody>().position + transform.forward * Velocidade * Time.deltaTime);
}
}
codigo canodaarma:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ControlaArma : MonoBehaviour
{
public GameObject Bala;
public GameObject CanodaArma;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
if (Input.GetButtonDown("Fire1"))
{
Instantiate(Bala, CanodaArma.transform.position, CanodaArma.transform.rotation);
}
}
}
Eu queria saber o que pode estar acontecendo. Se alquem poder me ajudar, Obrigado.