rj-action-library/Runtime/Interactions/CharacterController/CharacterControllerAction.cs

42 lines
755 B
C#

using Godot;
using System.Collections;
using System.Collections.Generic;
using Godot.Collections;
namespace Rokojori
{
[GlobalClass]
public partial class CharacterControllerAction:RJAction
{
[Export]
public CharacterController controller;
public CharacterBody3D body => controller.body;
public void AddVelocity( Vector3 velocity )
{
body.Velocity += velocity * controller.delta;
}
public void SetVelocity( Vector3 velocity )
{
body.Velocity = velocity * controller.delta;
}
public void Velocity( Vector3 velocity, bool replace )
{
if ( replace )
{
SetVelocity( velocity );
}
else
{
AddVelocity( velocity );
}
}
}
}