5个回答
2015-03-24
展开全部
gameObject obj=GameObject.Instantiate(子弹);
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
不就是按键时实例化一下子弹而已。
追问
能演示下吗?拜托了,谢谢
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class sheji : MonoBehaviour {
// Use this for initialization
void Start () {
}
int speed = 5;
GameObject a;
// Update is called once per frame
void Update () {
float x = Input.GetAxis("Horizontal") * Time.deltaTime * speed;
float z = Input.GetAxis("Vertical") * Time.deltaTime * speed;
transform.Translate(x, 0, z);
//print(x);
if (Input.GetButtonDown("Fire1"))
{
GameObject n = (GameObject)Instantiate(a,new Vector3(a.transform.position.x,a.transform.position.y,a.transform.position.z), Quaternion.identity);
Vector3 fwd = transform.TransformDirection(Vector3.forward);
n.GetComponent<Rigidbody>().AddForce(fwd * 28000);
}
}
}
using System.Collections.Generic;
using UnityEngine;
public class sheji : MonoBehaviour {
// Use this for initialization
void Start () {
}
int speed = 5;
GameObject a;
// Update is called once per frame
void Update () {
float x = Input.GetAxis("Horizontal") * Time.deltaTime * speed;
float z = Input.GetAxis("Vertical") * Time.deltaTime * speed;
transform.Translate(x, 0, z);
//print(x);
if (Input.GetButtonDown("Fire1"))
{
GameObject n = (GameObject)Instantiate(a,new Vector3(a.transform.position.x,a.transform.position.y,a.transform.position.z), Quaternion.identity);
Vector3 fwd = transform.TransformDirection(Vector3.forward);
n.GetComponent<Rigidbody>().AddForce(fwd * 28000);
}
}
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
是要有发射子弹的效果吗 还是说要有碰撞
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询