private void GroundedCheck() { // set sphere position, with offset Vector3 spherePosition = new Vector3(transform.position.x, transform.position.y - GroundedOffset, transform.position.z); Grounded = Physics.CheckSphere(spherePosition, GroundedRadius, GroundLayers, QueryTriggerInteraction.Ignore); //...
1.安装必要的XR package 上栏— Window-Package Manage — 切换Package: In Project 至 Package: Unity Registry — 搜索图中的两个package — 点击install 2.创建XR物体 XR Origin 是XR目录下的device based目录下的选项 右键场景 — XR目录 — Device-based — XR Origin(VR) 注:使用Device-based 3.Left ...
RaycastHit2D hitFront = Physics2D.Raycast(positionCentered, direction, 1f, layerMask); if (hitFront && playerCharacter.CheckForGrounded()) return true; return false; } 2、IsGrounded:用于检测角色是否踏在地面上 public bool IsGrounded(Vector2 position) { Vector2 adjustedPosition = new Vector2(positi...
But only if the jump button has been released and player has been grounded for a given number of frames//if (!Input.GetButton("Jump"))//{// m_JumpTimer++;//}//else if (m_JumpTimer >= m_AntiBunnyHopFactor)//{// m_MoveDirection.y = m_JumpSpeed;// m_JumpTimer = 0;//}}else...
checkResult = Physics2D.Linecast(transform.position, groundChecks[i].position, 1 << LayerMask.NameToLayer("Ground")); vida.grounded = checkResult; if (vida.grounded) break; } if (vida.grounded) { //火箭蛋(硬件蛋特殊技能) if (vida.playerType == Tags.YingjianDan) ...
if (m_Grounded || canAirControl) { // 输入变量move决定横向速度 m_Rigidbody2D.velocity = new Vector2(move, m_Rigidbody2D.velocity.y); } else if (!m_Grounded) { if (move > 0 && m_FacingRight) { m_Rigidbody2D.velocity = new Vector2(Mathf.Max(move, m_Rigidbody2D.velocity.x),...
vida.grounded = checkResult;if(vida.grounded)break; }if(vida.grounded) {//火箭蛋(硬件蛋特殊技能)if(vida.playerType == Tags.YingjianDan) { vida.jumpable =1; } }//跳跃//按下K时if(Input.GetKeyDown(KeyCode.K) && vida.jumpTimer >=0.03f) ...
if (m_Grounded && jump) { OnAirEvent.Invoke(); m_Grounded = false; // 施加弹跳力 m_Rigidbody2D.AddForce(new Vector2(0f, jumpForce)); m_NextGroundCheckTime = Time.time + m_NextGroundCheckLag; } } private void Flip() {
高精度高质量的地图模型肯定以后会减少很多制作成本,我其实更希望的是ai generate很多人物动作表情语言,...
public class PlayerGroundedState : PlayerState { protected int xInput; protected int yInput; public PlayerGroundedState(Player player, PlayerStateMachine stateMachine, PlayerData playerData, string animBoolName) : base(player, stateMachine, playerData, animBoolName) { } public override void Dochecks(...