Сообщение от SGREED
ок спасибо)
вот ище вопрос
вот скрипт выстрела пули, получается пуля создается в тех координатах где и оружие, но не летит ни куда, она стоит намертво
var projectile : GameObject; var fireRate : float = 0.5; private var nextFire : float = 0.0; function Update () { if (Input.GetButton ("Fire1") && Time.time > nextFire) { nextFire = Time.time + fireRate; var clone : GameObject = Instantiate(projectile, transform.position, transform.rotation) as GameObject; } }
как сделать что бы пуля полетела туда куда смотрит игрок? 0_О
|
var projectile : GameObject;
var fireRate : float = 0.5;
private var nextFire : float = 0.0;
function Update () {
if (Input.GetButton ("Fire1") && Time.time > nextFire) {
nextFire = Time.time + fireRate;
var clone : GameObject =
Instantiate(projectile, transform.position, transform.rotation) as GameObject;
clone.rigidbody.AddRelativeForce(Vector3.forward*1000f);
}
}
http://docs.unity3d.com/Documentatio...tiveForce.html