Simple character movement logic
public class PlayerTest : MonoBehaviour
{
public CharacterController cc;
public float yVel;
public void Update()
{
if (!cc.isGrounded)
yVel -= 10 * Time.deltaTime;
var x = Input.GetAxis("Horizontal");
var y = Input.GetAxis("Vertical");
var move = new Vector3(x, yVel, y);
cc.Move(move * (Time.deltaTime * 10));
}
}
Adding jump logic at runtime
LuaMod.PatchAll(@"
PlayerTest ={}
function PlayerTest:Update ()
if Input.GetKeyDown(KeyCode.Space) then
this.yVel = 3;
end
base:Invoke()
end
");
Brutal.Strike.Devlog.2021.11.14.574.mp4
Discord: https://discord.gg/bxVky7seqa