using Godot; using System.Collections; using System.Collections.Generic; using Godot.Collections; namespace Rokojori { [GlobalClass] public partial class CharacterMovement:CharacterControllerAction { [Export] public float onFloorMultiply = 0f; [Export] public bool overwriteVelocity = true; [ExportGroup( "Moving" )] [Export] public float moveSpeed; [Export] public RJSensor forward; [Export] public RJSensor backwards; [ExportGroup( "Strafing" )] [Export] public float strafeSpeed; [Export] public RJSensor strafeLeft; [Export] public RJSensor strafeRight; public override void _OnTrigger() { var movement = Vector3.Zero; var body = controller.body; movement += body.GlobalForward() * Sensors.GetValue( forward ); movement -= body.GlobalForward() * Sensors.GetValue( backwards ); movement += body.GlobalRight() * Sensors.GetValue( strafeRight ); movement -= body.GlobalRight() * Sensors.GetValue( strafeLeft ); if ( body.IsOnFloor() ) { movement *= onFloorMultiply; } SetVelocity( movement, overwriteVelocity ); } } }