您是否有兴趣创建一个专注于深圳市建设工程资料的网站平台?

摘要:做彩票平台网站吗,深圳市建设工程资料网站,如何给网站添加网站地图,娄底网站建设方案目录 1.飞行的实现 2.限制玩家视角 3.射击的实现 4.附录 1.飞行的实现 (1)在Play
做彩票平台网站吗,深圳市建设工程资料网站,如何给网站添加网站地图,娄底网站建设方案目录 1.飞行的实现 2.限制玩家视角 3.射击的实现 4.附录 1.飞行的实现 #xff08;1#xff09;在Player预制体上挂载Configuration Joint组件#xff0c;并修改其Y Drive属性 #xff08;2#xff09; 修改PlayerInput.cs和PlayerController.cs以实现飞行 PlayerIn…目录 1.飞行的实现 2.限制玩家视角 3.射击的实现 4.附录 1.飞行的实现 1在Player预制体上挂载Configuration Joint组件并修改其Y Drive属性 2 修改PlayerInput.cs和PlayerController.cs以实现飞行 PlayerInput.cs 添加以下属性  [SerializeField] private float thrusterForce 20f; [SerializeField] private ConfigurableJoint joint 在其Start方法中添加以下语句 joint GetComponentConfigurableJoint(); 在其Update方法中添加以下语句  Vector3 force Vector3.zero; if (Input.GetButton(Jump)) {force Vector3.up * thrusterForce;joint.yDrive new JointDrive{positionSpring 0f,positionDamper 0f,maximumForce 0f,}; } else {joint.yDrive new JointDrive{positionSpring 20f,positionDamper 0f,maximumForce 40f,};} playerControllor.Thrust(force); PlayerController.cs 添加以下属性  private Vector3 thrusterForce Vector3.zero;//向上的推力 添加以下方法 public void Thrust(Vector3 _thrusterForce) {thrusterForce _thrusterForce; } 在其PerformMovement方法中添加以下语句 if (thrusterForce ! Vector3.zero) {rb.AddForce(thrusterForce);//作用Time.fixedDeltaTime秒0.02秒thrusterForce Vector3.zero; } 2.限制玩家视角 修改PlayerController.cs 添加以下属性 private float cameraRoatationTotal 0f;//累计转了多少度 [SerializeField] private float cameraRotationLimit 85f; 对其PerformRotation方法进行一下修改 private void PerformRotation() {if (yRotation ! Vector3.zero){rb.transform.Rotate(yRotation);}if (xRotation ! Vector3.zero){cam.transform.Rotate(xRotation);cameraRoatationTotal xRotation.x;cameraRoatationTotal Mathf.Clamp(cameraRoatationTotal, -cameraRotationLimit, cameraRotationLimit);cam.transform.localEulerAngles new Vector3(cameraRoatationTotal, 0f, 0f);} } 3.射击的实现 1 创建并编写PlayerWeapon.cs将其移动至Assets/Scripts/Player using System;[Serializable] public class PlayerWeapon {public string name M16;public int damage 10;public float range 100f; }2在场景中创建空物体“GameManager”创建并编写GameManager.cs并挂载至空物体“GameManager” GameManager.
阅读全文