TAPTAPTAPTAP
8/10/2013 - 11:30 AM

From http://unity3d.com/learn/tutorials/modules/beginner/scripting/instantiate vystřelení kulky

instantiate vystřelení kulky #unity3d

using UnityEngine;
using System.Collections;

public class Strilej : MonoBehaviour
{
    public Rigidbody rocketPrefab;
    public Transform barrelEnd;
    
    
    void Update ()
    {
        if(Input.GetButtonDown("Fire1"))
        {
            Rigidbody rocketInstance;
            rocketInstance = Instantiate(rocketPrefab, barrelEnd.position, barrelEnd.rotation) as Rigidbody;
            rocketInstance.AddForce(barrelEnd.forward * 1000);
        }
    }
}12345678910111213141516171819