using UnityEngine;
public class ProjectileLaunch : MonoBehaviour
{
public GameObject projectilePrefab;
public float launchForce = 10f;
private void Update()
{
if (Input.GetKeyDown(KeyCode.Space))
{
GameObject go = Instantiate(projectilePrefab, transform.position, Quaternion.identity);
Rigidbody rb = go.GetComponent<Rigidbody>();
rb.AddForce(transform.forward * launchForce, ForceMode.Impulse);
}
}
}
![](http://code3interactive.com/wp/wp-content/uploads/2021/04/avatar-370-456322-512.png)
Analyst studies emerging trends in the information technology.