Quantcast
Channel: Latest Questions on Unity Answers
Viewing all articles
Browse latest Browse all 171066

This is my code and now how do i make the bullet shoot and how do i make it shoot from the camera view?

$
0
0
using UnityEngine; using System.Collections; public class NewBehaviourScript2 : MonoBehaviour { GameObject GrenadePrefab; void Update () { if(Input.GetButtonDown("Fire1")) { GameObject Grenade = Instantiate(GrenadePrefab, transform.position, transform.rotation) as GameObject; Grenade.rigidbody.AddForce(transform.forward * 4000); } } } The code works perfectly but how do i get the bullet to shoot and from the camera view?

Viewing all articles
Browse latest Browse all 171066

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>