五月天青色头像情侣网名,国产亚洲av片在线观看18女人,黑人巨茎大战俄罗斯美女,扒下她的小内裤打屁股

歡迎光臨散文網(wǎng) 會(huì)員登陸 & 注冊(cè)

【大概是最簡(jiǎn)單的unity教程】UP: Yu_Zhen

2023-02-22 20:20 作者:原野的天空biubiu怪  | 我要投稿


1、如何理解?


float x, z;

?x = Input.GetAxis("Horizontal");

z = Input.GetAxis("Vertical");


https://blog.csdn.net/weixin_44869410/article/details/103210842


在 void Update() 每一幀都會(huì)刷新,所以只有1,-1,0 三種情況。


鍵盤(pán)WASD,為例

W Z軸的前進(jìn) 1

S? Z軸的前后退 -1?


A X軸前進(jìn) 1 D同同理


2、


Vector3 mov;

mov = transform.right * x + transform.forward * z;

plyerMove.Move(mov*speed*Time.deltaTime);


?transform.right X軸的要移動(dòng)的方向?

?transform.forward Z軸的要移動(dòng)的方向?

*x *z 代表這個(gè)方向移動(dòng)的距離數(shù)值的大小


move 用來(lái)裝這個(gè)數(shù)據(jù)的一個(gè)結(jié)構(gòu)體

Move 移動(dòng)函數(shù)


3、cameraLook

a、鼠標(biāo)左右,人物移動(dòng) X軸

b、上下移動(dòng) Y軸 鏡頭移動(dòng)

public Transform player;

float x, y;

x = Input.GetAxis("Mouse X") * mouseSpeed*Time.deltaTime; //獲取鼠標(biāo)X軸數(shù)據(jù)

y = Input.GetAxis("Mouse Y") * mouseSpeed*Time.deltaTime;

player.Rotate(Vector3.up * x); // player 在unity掛載對(duì)象應(yīng)該是player這個(gè)對(duì)象


// 這里的this 是camera?

this.transform.localRotation = Quaternion.Euler(ymove,0,0);


P3

? ? //?

? ? public float speed;


? ? // 按一下空格 跳躍的高度 而不是速度

? ? public float jumpSpeed = 10;


? ? public float g = 10;


? ? public CharacterController plyerMove;


? ? public int jumpCount = 10;


? ? Vector3 move;

? ? // 二段跳

? ? // private int jumpOnAir = 0;

? ? // Start is called before the first frame update

? ? void Start()

? ? {

? ? ? ??

? ? }


? ? // Update is called once per frame

? ? void Update()

? ? {

? ? ? ? float x = 0, z = 0;


? ? ? ? if (plyerMove.isGrounded) {

? ? ? ? ? ? x = Input.GetAxis("Horizontal");

? ? ? ? ? ? z = Input.GetAxis("Vertical");

? ? ? ? ? ? move = (transform.right * x + transform.forward * z)*speed;

? ? ? ? ? ?jumpCount = 10;

? ? ? ? }


? ? ? ? if (isPressJump() && jumpCount >0)

? ? ? ? {

? ? ? ? ? ? move.y = jumpSpeed;

? ? ? ? ? ? // --的條件要改一下 限制 不能2幀全沒(méi)了

? ? ? ? ? ? jumpCount--;

? ? ? ? }


? ? ? ? // 為什么會(huì)掉落 應(yīng)該和這個(gè)計(jì)算方式有關(guān)

? ? ? ? // 為什么沒(méi)有這句就跳不起來(lái) 這是計(jì)算公式 一定要這樣帶

? ? ? ? move.y = move.y - g * Time.deltaTime;


? ? ? ? // move 向量 代表方向


? ? ? ? plyerMove.Move( move * Time.deltaTime );


? ? }


? ? bool isPressJump()?

? ? {? ?

? ? ? ? /*

? ? ? ? if (Input.GetAxis("Jump") == 1){

? ? ? ? ? ? return true;

? ? ? ? }

? ? ? ? else {

? ? ? ? ? ? return false;

? ? ? ? }*/


? ? ? ? return Input.GetAxis("Jump") == 1 ? true : false;

? ? }


【大概是最簡(jiǎn)單的unity教程】UP: Yu_Zhen的評(píng)論 (共 條)

分享到微博請(qǐng)遵守國(guó)家法律
南郑县| 芜湖市| 陆川县| 廊坊市| 响水县| 霍林郭勒市| 奉节县| 河北区| 杭锦旗| 阿合奇县| 彭泽县| 颍上县| 兴化市| 阿拉善右旗| 惠州市| 达孜县| 福海县| 丹阳市| 天气| 射阳县| 定安县| 蓬安县| 古交市| 平湖市| 荔浦县| 思南县| 西林县| 正镶白旗| 安徽省| 高阳县| 威远县| 诸暨市| 登封市| 怀来县| 黎平县| 隆子县| 安塞县| 鹤峰县| 丰台区| 马公市| 遵化市|