rj-action-library/Runtime/Sensors/Sensors.cs

24 lines
471 B
C#

using Godot;
namespace Rokojori
{
public class Sensors
{
public static bool IsActive( Sensor sensor )
{
return sensor == null ? false : sensor.isActive;
}
public static float GetValue( Sensor sensor, float scale = 1 )
{
return sensor == null ? 0 : sensor.value * scale;
}
public static float PolarAxis( Sensor negative, Sensor positive )
{
return GetValue( negative, -1 ) + GetValue( positive, 1 );
}
}
}