diff --git a/animgraphs/faith_arms.vanmgrph b/animgraphs/faith_arms.vanmgrph index ae7bf3e..1951f50 100644 --- a/animgraphs/faith_arms.vanmgrph +++ b/animgraphs/faith_arms.vanmgrph @@ -24,7 +24,7 @@ m_sNote = "" m_tagSpans = [ ] m_sequenceName = "VaultOntoHigh" - m_playbackSpeed = 1.5 + m_playbackSpeed = 1.3 m_bLoop = false } }, @@ -75,7 +75,7 @@ m_sNote = "" m_tagSpans = [ ] m_sequenceName = "vaultontohigh02" - m_playbackSpeed = 1.5 + m_playbackSpeed = 1.3 m_bLoop = false } }, diff --git a/code/pawn/PawnController.Vaulting.cs b/code/pawn/PawnController.Vaulting.cs index 605d4de..8d725b4 100644 --- a/code/pawn/PawnController.Vaulting.cs +++ b/code/pawn/PawnController.Vaulting.cs @@ -40,10 +40,15 @@ void ProgressVault() { // TODO: make smoother + // TODO: put this into a class or something + var startCurveSize = Vaulting == VaultType.OntoHigh ? 10f : 30f; + var endCurveSize = Vaulting == VaultType.OntoHigh ? -70f : 30f; + Vector3 pos = Bezier.Approach( start: VaultStartPos, end: VaultTargetPos, - curveSize: 30f, + startCurveSize: startCurveSize, + endCurveSize: endCurveSize, t: bezierCounter ); diff --git a/code/util/Bezier.cs b/code/util/Bezier.cs index 06596c2..7d3a36a 100644 --- a/code/util/Bezier.cs +++ b/code/util/Bezier.cs @@ -5,14 +5,18 @@ namespace RunnerVision; public class Bezier { // Source: https://programmerbay.com/c-program-to-draw-bezier-curve-using-4-control-points/ - public static Vector3 Approach( Vector3 start, Vector3 end, float curveSize, float t ) + public static Vector3 Approach( Vector3 start, Vector3 end, float startCurveSize, float endCurveSize, float t ) { - var cp1 = start + Vector3.Up * curveSize; - var cp2 = end + Vector3.Up * curveSize; + var cp1 = start + Vector3.Up * startCurveSize; + var cp2 = end + Vector3.Up * endCurveSize; float x = (float)(Math.Pow( 1 - t, 3 ) * start.x + 3 * t * Math.Pow( 1 - t, 2 ) * cp1.x + 3 * t * t * (1 - t) * cp2.x + Math.Pow( t, 3 ) * end.x); float y = (float)(Math.Pow( 1 - t, 3 ) * start.y + 3 * t * Math.Pow( 1 - t, 2 ) * cp1.y + 3 * t * t * (1 - t) * cp2.y + Math.Pow( t, 3 ) * end.y); float z = (float)(Math.Pow( 1 - t, 3 ) * start.z + 3 * t * Math.Pow( 1 - t, 2 ) * cp1.z + 3 * t * t * (1 - t) * cp2.z + Math.Pow( t, 3 ) * end.z); return new Vector3( x, y, z ); } + public static Vector3 Approach( Vector3 start, Vector3 end, float curveSize, float t ) + { + return Approach( start, end, curveSize, curveSize, t ); + } }