public void DebugDraw(ref WallAnchor state) { float3 position = GetPosition(state); float3 normal = GetNormalWorldSpace(); Debug.DrawLine(position, position + normal * 0.3f, Color.red); }
public WallAnchor UpdateAnchor(WallAnchor anchor, float2 uv) { WallAnchor result; float width = GetWidth(); float height = GetHeight(); float ud = uv.x / width; float vd = uv.y / height; result.u = math.saturate(anchor.u - ud); result.v = math.saturate(anchor.v - vd); return(result); }
IEnumerator JumpToRight() { transform.eulerAngles = Variables.RightOrientationEulerAngles; transform.position += Variables.JumpRightVector * Time.deltaTime; while (!hitWallRight) { transform.position += Variables.JumpRightVector * Time.deltaTime; yield return(new WaitForEndOfFrame()); } isJumping = false; NewPosition = transform.position; NewPosition.z = CurrentWallHit.position.z - Variables.WallOffset; transform.position = WallCollisionPoint; PlayerAnchor = WallAnchor.RightSide; }
public float3 GetPosition(WallAnchor anchor) { float3 orthogonal = GetOrthogonalLocalSpace(); float3 vertex = GetBaseVertex(); float3 v0 = transformPoint( center + Missing.mul(size, vertex) * 0.5f); float3 o = transformDirection(orthogonal); float3 up = Missing.up; float u = GetWidth() * anchor.u; float v = GetHeight() * anchor.v; return(v0 - (o * u) - (up * v)); }
public override void OnEnable() { base.OnEnable(); state = State.Suspended; previousState = State.Suspended; climbingState = ClimbingState.Idle; previousClimbingState = ClimbingState.Idle; lastCollidingClimbingState = ClimbingState.None; clothComponents = GetComponentsInChildren <Cloth>(); ledgeGeometry = LedgeGeometry.Create(); wallGeometry = WallGeometry.Create(); ledgeAnchor = LedgeAnchor.Create(); wallAnchor = WallAnchor.Create(); transition = MemoryIdentifier.Invalid; locomotion = MemoryIdentifier.Invalid; }
public override void OnEnable() { base.OnEnable(); kinematica = GetComponent <Kinematica>(); state = State.Suspended; previousState = State.Suspended; climbingState = ClimbingState.Idle; previousClimbingState = ClimbingState.Idle; lastCollidingClimbingState = ClimbingState.None; clothComponents = GetComponentsInChildren <Cloth>(); ledgeGeometry = LedgeGeometry.Create(); wallGeometry = WallGeometry.Create(); ledgeAnchor = LedgeAnchor.Create(); wallAnchor = WallAnchor.Create(); anchoredTransition = AnchoredTransitionTask.Invalid; }
void Start() { cameraFollow = Camera.main.GetComponent <CameraFollow> (); Variables = GetComponent <PhysicsVariablesDefinitions> (); rb = GetComponent <Rigidbody> (); anim = GetComponent <Animator> (); transform.eulerAngles = Variables.RightOrientationEulerAngles; //Randomize starting anchor side int randomSide = Random.Range(0, 2); if (randomSide == 0) { PlayerAnchor = WallAnchor.RightSide; transform.eulerAngles = Variables.RightOrientationEulerAngles; } else { PlayerAnchor = WallAnchor.LeftSide; transform.eulerAngles = Variables.LeftOrientationEulerAngles; } NewRotation = transform.eulerAngles; Jump(); }
public float GetHeight(ref WallAnchor anchor) { return(GetHeight() * (1.0f - anchor.v)); }