当前位置: 首页 > news >正文

php网站开发实战视频教程做个网站软件多少钱

php网站开发实战视频教程,做个网站软件多少钱,在线logo设计商标免费,门户网站建设检察1、创建一个空物体#xff0c;挂载Rigidbody组件#xff0c;并设置相应参数 2、在上述空物体下创建一个胶囊体#xff0c;两个空物体#xff0c;一个用来控制朝向#xff0c;另一个用来控制摄像机 3、给摄像机创建一个父物体#xff0c;并挂载脚本MoveCamera_01.cs using…1、创建一个空物体挂载Rigidbody组件并设置相应参数 2、在上述空物体下创建一个胶囊体两个空物体一个用来控制朝向另一个用来控制摄像机 3、给摄像机创建一个父物体并挂载脚本MoveCamera_01.cs using System.Collections; using System.Collections.Generic; using UnityEngine;public class MoveCamera_01 : MonoBehaviour {public Transform cameraPosition;private void Update(){transform.position cameraPosition.position;} }4、给摄像机挂载脚本PlayerCam_01.cs using System.Collections; using System.Collections.Generic; using UnityEngine;public class PlayerCam_01 : MonoBehaviour {// 视觉灵敏度参数public float sensX 400;public float sensY 400;// 视角垂直旋转角度限制public float minAngle -90f;public float maxAngle 90f;// 角色朝向的 Transform用于水平旋转public Transform orientation;// 当前的 X 和 Y 旋转角度private float xRotation;private float yRotation;private void Start(){// 初始时锁定鼠标光标并隐藏光标Cursor.lockState CursorLockMode.Locked;Cursor.visible false;}private void Update(){// 获取鼠标输入float mouseX Input.GetAxisRaw(Mouse X) * Time.deltaTime * sensX;float mouseY Input.GetAxisRaw(Mouse Y) * Time.deltaTime * sensY;// 更新水平旋转角度yRotation mouseX;// 更新垂直旋转角度并限制在指定范围内xRotation - mouseY;xRotation Mathf.Clamp(xRotation, minAngle, maxAngle);// 应用旋转到摄像机的 Transform 上实现视角旋转transform.rotation Quaternion.Euler(xRotation, yRotation, 0);// 应用水平旋转到角色的 Transform 上使角色朝向与摄像机一致orientation.rotation Quaternion.Euler(0, yRotation, 0);} }5、给主角挂载脚本PlayerMovement_01.cs using System.Collections; using System.Collections.Generic; using UnityEngine;public class PlayerMovement_01 : MonoBehaviour {public float moveSpeed 7; // 玩家移动速度public float groundDrag 5; // 地面时的阻力public float playerHeight 2; // 玩家身高public LayerMask whatIsGround; // 地面的LayerMaskprivate bool grounded; // 是否在地面上public float jumpForce 6; // 跳跃力度public float jumpCooldown 0.25f; // 跳跃冷却时间public float airMultiplier 0.4f; // 空中移动速度衰减private bool readyToJump true; // 是否可以跳跃public KeyCode jumpKey KeyCode.Space; // 跳跃键public Transform orientation; // 玩家朝向的Transformprivate float h; // 水平输入private float v; // 垂直输入private Vector3 moveDirection; // 移动方向private Rigidbody rb; // 玩家刚体private void Start(){rb GetComponentRigidbody();rb.freezeRotation true; // 防止刚体旋转}private void Update(){grounded Physics.Raycast(transform.position, Vector3.down, playerHeight * 0.5f 0.2f, whatIsGround);MyInput();SpeedControl();if (grounded)rb.drag groundDrag;elserb.drag 0;}private void FixedUpdate(){MovePlayer();}private void MyInput(){h Input.GetAxisRaw(Horizontal);v Input.GetAxisRaw(Vertical);if (Input.GetKey(jumpKey) readyToJump grounded){readyToJump false;Jump();Invoke(nameof(ResetJump), jumpCooldown);}}private void MovePlayer(){// 根据朝向计算移动方向moveDirection orientation.forward * v orientation.right * h;if (grounded){rb.AddForce(moveDirection.normalized * moveSpeed * 10f, ForceMode.Force);}else if (!grounded){rb.AddForce(moveDirection.normalized * moveSpeed * 10f * airMultiplier, ForceMode.Force);}}private void SpeedControl(){Vector3 flatVel new Vector3(rb.velocity.x, 0f, rb.velocity.z);if (flatVel.magnitude moveSpeed){// 限制速度在设定范围内Vector3 limitedVel flatVel.normalized * moveSpeed;rb.velocity new Vector3(limitedVel.x, rb.velocity.y, limitedVel.z);}}private void Jump(){//rb.velocity new Vector3(rb.velocity.x, 0f, rb.velocity.z);rb.velocity Vector3.zero;// 添加向上的力以实现跳跃rb.AddForce(transform.up * jumpForce, ForceMode.Impulse);}private void ResetJump(){readyToJump true;} }
http://www.zqtcl.cn/news/227128/

相关文章:

  • 滁州网站建设哪个好点iis发布网站无法访问
  • 网站项目建设的定义百度站长平台清退
  • ip开源网站FPGA可以做点什么建设网站的工作职责
  • 重庆微信网站开发公司建设网站技术标准
  • 网站开发浏览器银川市建设诚信平台网站
  • 找合伙人做红木家具网站建设银行员工学习网站
  • iis的默认网站没有自动启动长春小程序开发制作
  • 佛山住房和城乡建设部网站wordpress 英文主题
  • 零食网站策划书厦门建设网站的公司
  • 自己做的网站怎么发布到网上湖南做网站 干净磐石网络
  • steam网站代做设计公司招聘信息
  • 网站开发 书籍无广告自助建站
  • 青岛电子商务网站建设wordpress购物车会员
  • 大理建网站沉默是金吉他谱
  • 门户网站需要多少费用wordpress的中文插件安装
  • 男做基视频网站怎么做网上直营店网站
  • 网站栏目排序个人站长网站应该如何定位
  • phpcms wap网站搭建学网站开发难吗
  • 做一个网页一般多少钱seo实训思考与总结
  • 怎么用wordpress做搜索网站wordpress 作品集插件
  • 芜湖的网站建设韩国封号事件网站建设
  • 做外贸网站的价格wordpress远方的雪
  • 有哪些做应援的网站网站开发产生费用分录怎么写
  • 如何在微信平台做购买网站广安 网站建设
  • 怎么建立和设计网站html5高端酒水饮料企业网站模版
  • 网站排版尺寸wordpress 生成目录
  • 网站建设属于什么费用wordpress破解管理员帐号
  • 东莞市官网网站建设专业wordpress主题开发
  • 常熟做网站优化合肥百度竞价推广代理公司
  • 专业做招聘的网站人气最旺的传奇手游