السلام عليكم و رحمة الله
عندي مشكلة باليونيتي وهو انه عندما اطلق الرصاصة ترجع الى الوراء
هذا هو الكود المستخدم
عندي مشكلة باليونيتي وهو انه عندما اطلق الرصاصة ترجع الى الوراء
هذا هو الكود المستخدم
كود:
using UnityEngine;using System.Collections; public class PlayerGun : MonoBehaviour { public GameObject Ammo; // The Shot GameObject FiredShot; // Shot In air public AudioClip ShotSound; // Use this for initialization void Start () { } // Update is called once per frame void Update () { if (Input.GetKeyDown(KeyCode.Mouse0)){ FiredShot = (GameObject)Instantiate(Ammo, transform.position, Quaternion.identity); audio.PlayOneShot(ShotSound); } if (FiredShot !=null){ FiredShot.transform.position += FiredShot.transform.forward * 5 * Time.deltaTime; } } }
تعليق