public class PlayerController : MonoBehaviour { private Transform cam; public float speed = 10f; public float turnSmoothTime = 0.1f; float turnSmoothVelocity; float horizontal; float vertical; public float jumpForce; private bool canJump = true; Animator ani; private Rigidbody rb; void Start() ...
3,在unity edtor中找到包含Shader的Material文件并拖拽到刚才的脚本对应参数上 public class shaderController : MonoBehaviour { public Material material; void Update() { material.SetFloat("_Float", Mathf.Sin(Time.frameCount * 0.01f)); } } 1. 2. 3. 4. 5. 6. 7. 8. 2 设置资源中的Material文...
公共类玩家控制器:MonoBehaviour{ privateRigidbody2D rb;publicfloatspeed;publicfloatjumpForce;privatefloatmoveInput;privateboolisGrounded;publicTransform feetPos;publicfloatcheckRadius;publicLayerMask whatIsGround;privatefloatjumpTimeCounter;publicfloatjumpTime;privateboolisJumpimg;voidStart(){ rb = GetComponent<Rig...
PlayerController原本就是充当Pawn与玩家之间的接口,接受输入来控制Pawn。而且Pawn在关卡中可能会因为条件触...
public class InputHandle : MonoBehaviour { public float horizontal, vertical,moveAmount,mouseX,mouseY; //水平、竖直的移动 PlayerControl inputActions; CameraHandle cameraHandler; Vector2 movementInput, cameraInput; private void Awake() { cameraHandler = CameraHandle.singleton; ...
2、逐步修改位置,叠加眼睛正前方的标量,完成飞行。 usingUnityEngine;usingSystem.Collections;publicclassflyingCarper : MonoBehaviour {//OVR人的预制体Transform组件privateOVRPlayerController com_OVRControl;//头盔眼镜Transform组件privateTransform eye_transform;//飞行速度publicintspeed =10;//处于飞行状态,T是,F否...
书名:Unity 2020游戏开发快速上手 作者名:吴雁涛 叶东海 赵杰 本章字数:99字 更新时间:2025-02-22 08:22:10 后续精彩内容,请登录阅读 上QQ阅读APP看书,第一时间看更新