It's not a LUA script. It's c#:
using Leadwerks;
namespace rvlFPSLeadwerksCsharp
{
class cPlayer
{
Controller playerController = new Controller(1.8f, 0.45f, 0.3f, 46f);
public Vector3 playerRotation = new Vector3();
public Vector3 playerPosition = new Vector3();
public Vector3 playerHeadPosition = new Vector3();
float playerMove = 0;
float playerStrafe = 0;
float playerJump = 0;
float dx, dy;
float cameraPitch, cameraYaw;
public void createPlayer()
{
//controller
playerController.Mass = 100;
playerController.CollisionType = 1;
}
public void updatePlayer()
{
//rotation by mouse
int mx = Leadwerks.Graphics.Width / 2;
int my = Leadwerks.Graphics.Height / 2;
dx = Leadwerks.Math.Curve((Leadwerks.Mouse.X - mx) / 4, dx, 6);
dy = Leadwerks.Math.Curve((Leadwerks.Mouse.Y - my) / 4, dy, 6);
Leadwerks.Mouse.Move(mx, my);
cameraPitch = cameraPitch + dy;
cameraYaw = cameraYaw - dx;
cameraPitch = Leadwerks.Math.Clamp(cameraPitch, -89, 89);
//rotation player
playerRotation.X = cameraPitch;
playerRotation.Y = cameraYaw;
//movement
playerMove = Keyboard.IntKeyDown(Key.W) - Keyboard.IntKeyDown(Key.S);
playerStrafe = Keyboard.IntKeyDown(Key.D) - Keyboard.IntKeyDown(Key.A);
//controller input
playerController.Update(playerRotation.Y, playerMove * 3, playerStrafe * 3, playerJump, 500);
playerPosition = playerController.Position;
playerHeadPosition = playerPosition;
playerHeadPosition.Y = playerPosition.Y + (float)1.8;
}
}
}
I call player.updatePlayer in the main loop..