21 lines
617 B
C#
21 lines
617 B
C#
using Godot;
|
|
using System;
|
|
|
|
public partial class Player : RigidBody3D
|
|
{
|
|
private static Vector3 ZLeft = new Vector3(0.0f, 0.0f, 100.0f);
|
|
private static Vector3 ZRight = new Vector3(0.0f, 0.0f, -100.0f);
|
|
public override void _Process(double delta)
|
|
{
|
|
float fd = (float)delta;
|
|
if (Input.IsActionPressed("boost")){
|
|
ApplyCentralForce(Basis.Y * fd * 1000.0f);
|
|
}
|
|
if (Input.IsActionPressed("rotate_left")){
|
|
ApplyTorque(ZLeft * fd);
|
|
}
|
|
if (Input.IsActionPressed("rotate_right")){
|
|
ApplyTorque(ZRight * fd);
|
|
}
|
|
}
|
|
}
|