Shoot bullet in unity easy tutorial | Tap input | Destroy bullets
Tap Input = 1:23
Destroy bullets= 2:55
Code :
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Shoot : MonoBehaviour
{
public Transform spawnpoint;
public GameObject bullet;
public float speed;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
if (Input.GetButtonDown("Fire1"))
{
var newBullet = Instantiate(bullet,spawnpoint.position,spawnpoint.rotation);
newBullet.GetComponent less than sign Rigidbody greater than sign ().AddForce(transform.forward*speed);
Destroy(newBullet,2f);
}
}
}
Other Videos By Muhammad Shahzaib
Other Statistics
Shoot the Bullet Statistics For Muhammad Shahzaib
At present, Muhammad Shahzaib has 57 views spread across 1 video for Shoot the Bullet, and less than an hour worth of Shoot the Bullet videos were uploaded to his channel. This is less than 0.65% of the total video content that Muhammad Shahzaib has uploaded to YouTube.