我制作了一个枪械系统,我需要拿起我产生的枪支,但是问题是,当我拿起枪支时,由于玩家的旋转,它不会在我想要的位置产生。这是一张图片:https:// netane54544-gmail.tinytake.com/media/75f9e3?filename=1525456534383_04-05-2018-08-53-27.png&sub_type=thumbnail_preview&type=attachment&width=1198&height=654
另外这是枪的另一张照片,只是为了展示我要去的东西:https : //netane54544-gmail.tinytake.com/media/75f9f5?filename=1525456736315_04-05-2018-08-56-51.png&sub_type = thumbnail_preview&type = attachment&width = 1198&height = 654
这是我正在使用的代码:
foreach (Gun item in gunList)
{
if (item.gunType == "Normal" && guns_inInventory[playerScript.keyPress] == false)
{
playerGuns[playerScript.keyPress] = Instantiate(Weapon_Normal, Camera.main.transform.position + Normalview.offSetPosition, Quaternion.identity) as GameObject;
playerGuns[playerScript.keyPress].name = gunName;
playerGuns[playerScript.keyPress].transform.parent = gameObject.transform;
playerGuns[playerScript.keyPress].transform.eulerAngles = Normalview.startOffsetRotation;
setGunActive(playerScript.keyPress);
//Store gundata in inventory
item.Named = false;
Inventory[playerScript.keyPress] = item;
guns_inInventory[playerScript.keyPress] = true;
}
else if (item.gunType == "Stride" && guns_inInventory[playerScript.keyPress] == false)
{
playerGuns[playerScript.keyPress] = Instantiate(Weapon_Stride, Camera.main.transform.position + Normalview.offSetPosition, Quaternion.identity) as GameObject;
playerGuns[playerScript.keyPress].name = gunName;
playerGuns[playerScript.keyPress].transform.parent = gameObject.transform;
playerGuns[playerScript.keyPress].transform.eulerAngles = Strideview.startOffsetRotation;
}
}
我试图找到问题,但被卡住了。
繁星coding
相关分类