public bool CanApplyEntireMovement(CapsuleTransform a_Transform) { if (a_Transform.GetPosition() != m_Position) { if (!a_Transform.CanMove(m_Position - a_Transform.GetPosition(), true)) { return(false); } } if (a_Transform.GetUpDirection() != m_UpDirection) { if (!a_Transform.CanRotate(m_UpDirection, m_RotateMethod)) { return(false); } } if (a_Transform.GetLength() != m_Length) { if (!a_Transform.CanBeResized(m_Length, m_ResizeMethod)) { return(false); } } return(true); }
//Query whether this module can be active, given the current state of the character controller (velocity, isGrounded etc.) //Called every frame when inactive (to see if it could be) and when active (to see if it should not be) public override bool IsApplicable() { if (m_ControlledCollider.IsGrounded() || (DoesInputExist("Crouch") && GetButtonInput("Crouch").m_IsPressed) || GetDirInput("Move").m_Direction == DirectionInput.Direction.Down || m_CharacterController.DidJustJump()) { return(false); } //Prevent overriding walljumps if (GetDirInput("Move").IsInThisDirection(m_ControlledCollider.GetEdgeCastInfo().GetWallNormal())) { return(false); } if ((m_CharacterController.GetJumpIsCached()) && m_ControlledCollider.IsTouchingEdge()) { //Move up to avoid transitioning into a wallrun. //Also used to prevent small distance jumps. CEdgeCastInfo edgeInfo = m_ControlledCollider.GetEdgeCastInfo(); CapsuleTransform copy = m_ControlledCollider.GetCapsuleTransformCopy(); Vector3 headStartDisplacement = edgeInfo.GetEdgeNormal() * (m_ControlledCollider.GetRadius() + 0.1f) + edgeInfo.GetWallNormal() * 0.015f; if (!copy.CanMove(headStartDisplacement, true)) { return(false); } copy.Move(headStartDisplacement); m_ProposedNewPosition = copy.GetPosition(); return(true); } return(false); }