日常学习总结的知识点(1)

    xiaoxiao2021-12-14  18

    1.调用预设体时rotation 的理解 Transform.rotation 一个旋转,此时bullet发生了转向,

    //调用子弹 m_bullet = Instantiate (m_perfabbullet, m_bulletpos.transform.position, transform.rotation)as GameObject;

    把出现的预设体的位置设为子物体,父级旋转,子物体也旋转,子弹运动的方向也是旋转后的。 在bullet上写的脚本里面

    // 子弹移动 transform.position += transform.forward * Time.deltaTime * 30f;

    子弹出现后直接按着自己的前方发射。 2 移动

    if (Input.GetKey (KeyCode.W)) {//相当于position+= Rig.MovePosition (Rig.position + transform.forward * Time.deltaTime); } if (Input.GetKey (KeyCode.S)) { Rig.MovePosition (Rig.position - transform.forward * Time.deltaTime); } float hor = Input.GetAxis ("Horizontal");//相当于Rotation*= Rig.MoveRotation (Rig.rotation * Quaternion.AngleAxis (hor, Vector3.up));

    3 计时器的种类; 1

    m_Timer+=m_CDtime; if( m_Timer>=m_CDtime ){ m_Timer=0f; ...自己的代码; }

    2 还有一个是 Invoke(方法名称,时间);方法 Invoke(”ReBack“,3f); 这个是调用方法,最好把代码写成一个方法里面。计时调用。

    转载请注明原文地址: https://ju.6miu.com/read-969114.html

    最新回复(0)