@@ -7,7 +7,7 @@ namespace Minimal;
77 * once it's done
88 */
99
10- public class WalkController : BaseController
10+ public class WalkController
1111{
1212 public float Friction => 12.0f ;
1313 public float GroundAccelerate => 50.0f ;
@@ -19,7 +19,7 @@ public class WalkController : BaseController
1919 public float MaxAngle => 60.0f ;
2020
2121 private bool IsGrounded => GroundEntity != null ;
22- private Actor GroundEntity ;
22+ private BaseEntity GroundEntity ;
2323
2424 private Player Player { get ; set ; }
2525
@@ -28,12 +28,15 @@ public class WalkController : BaseController
2828 public WalkController ( Player player )
2929 {
3030 Player = player ;
31- // Player.IgnoreRigidbodyRotation = true;
31+ Player . IgnoreRigidbodyRotation = true ;
3232
3333 Event . Register ( this ) ;
34+
35+ Player . Position = new Vector3 ( 0 , 5 , 10 ) ;
3436 }
3537
36- public override void PredictedUpdate ( )
38+ [ Event . Tick ]
39+ public void PredictedUpdate ( )
3740 {
3841 DebugOverlay . ScreenText ( $ "--------------------------------------------------------------------------------" ) ;
3942 DebugOverlay . ScreenText ( $ "{ ( Core . IsClient ? "Client" : "Server" ) } " ) ;
@@ -66,17 +69,12 @@ public override void PredictedUpdate()
6669 Velocity . Z -= 9.8f * Time . Delta ;
6770 }
6871
69- // Player.Velocity = Velocity * 10f;
72+ Player . Velocity = Velocity * 10f ;
7073 Move ( ) ;
7174
7275 DebugOverlay . ScreenText ( $ "--------------------------------------------------------------------------------" ) ;
7376 }
7477
75- ~ WalkController ( )
76- {
77- Event . Unregister ( this ) ;
78- }
79-
8078 private Vector3 GetWishDir ( )
8179 {
8280 var eulerRotation = Input . Rotation . ToEulerAngles ( ) ;
@@ -118,7 +116,7 @@ private Vector3 MoveAir( Vector3 accelDir, Vector3 prevVelocity )
118116
119117 public Mocha . TraceResult TraceBBox ( Vector3 start , Vector3 end )
120118 {
121- return Cast . Ray ( start , end ) . WithHalfExtents ( Player . PlayerBounds ) . Run ( ) ; //. Ignore( Player ).Run();
119+ return Cast . Ray ( start , end ) . WithHalfExtents ( Player . PlayerBounds ) . Ignore ( Player ) . Run ( ) ;
122120 }
123121
124122 private void CheckGrounded ( )
@@ -128,9 +126,9 @@ private void CheckGrounded()
128126 // Grounded only counts if the normal is facing upwards
129127 var angle = Vector3 . GetAngle ( tr . Normal , Vector3 . Up ) ;
130128
131- // if ( tr.Hit && angle < MaxAngle )
132- // GroundEntity = tr.Entity;
133- // else
129+ if ( tr . Hit && angle < MaxAngle )
130+ GroundEntity = tr . Entity ;
131+ else
134132 GroundEntity = null ;
135133 }
136134
0 commit comments