第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

槍不要在同一個(gè)地方產(chǎn)生

槍不要在同一個(gè)地方產(chǎn)生

C#
白衣非少年 2021-05-14 14:15:19
我制作了一個(gè)槍械系統(tǒng),我需要拿起我產(chǎn)生的槍支,但是問(wèn)題是,當(dāng)我拿起槍支時(shí),由于玩家的旋轉(zhuǎn),它不會(huì)在我想要的位置產(chǎn)生。這是一張圖片: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;        }    }我試圖找到問(wèn)題,但被卡住了。
查看完整描述

1 回答

?
繁星coding

TA貢獻(xiàn)1797條經(jīng)驗(yàn) 獲得超4個(gè)贊

NormalView.offSetPosition 僅在不旋轉(zhuǎn)時(shí)存儲(chǔ)位移。


例如,假設(shè)您offsetPosition是Vector(0,0,1):


Camera.main.transform.position + NormalView.offSetPosition 將采用相機(jī)的位置,并始終添加矢量(0,0,1),該矢量在世界軸上實(shí)際上向前1個(gè)單位,從而有效地忽略了相機(jī)的旋轉(zhuǎn)。


要解決此問(wèn)題,請(qǐng)將您的實(shí)例化位置更改為:


Camera.main.transform.position + 

(Camera.main.transform.forward * NormalView.offSetPosition.z) +

(Camera.main.transform.right * NormalView.offSetPosition.x) +

(Camera.main.transform.up * NormalView.offSetPosition.y)

通過(guò)獲取受其旋轉(zhuǎn)影響的相機(jī)的前向/右/上矢量,這考慮了相機(jī)的旋轉(zhuǎn)。通過(guò)將其乘以偏移量(在該方向上的距離),它將始終在相對(duì)于角色的相同位置處生成,而與相機(jī)的旋轉(zhuǎn)無(wú)關(guān)。


查看完整回答
反對(duì) 回復(fù) 2021-05-29
  • 1 回答
  • 0 關(guān)注
  • 153 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)