Physics3D
Make a Player
A character is a ready-to-move player shape. It walks into walls instead of going through them, stands on floors, and jumps. MAKO also makes slightly early or late jump presses feel nicer.
New to coding?
Copy the examples exactly first. Run them. Then change one number or word and run them again. You are not expected to memorize the command lists.
1
Step 1: Make the player
The three numbers after world are x, y, and z. character_tune changes walking speed, jump power, and how much the player can steer in the air. You can skip tuning and use the defaults.
Try this code
player = Physics3D.character(world, 0, 3, 0); # Make a player
Physics3D.character_tune(world, player, 7, 9, 0.35); # Speed, jump power, air steering
Physics3D.character_move(world, player, move_x, move_z); # Walk this frame
if jump_pressed { Physics3D.character_jump(world, player); } # Try to jump
info = Physics3D.character_info(world, player); # Ask where the player is2
Step 2: Move every frame
Call character_move during every frame where a movement key is held. Use -1 or 1 to move along an axis and 0 to stay still. character_jump tries one jump.
Try this code
character(world, x, y, z, height=1.8, radius=0.4, speed=6, jump=8, air_control=0.35)
character_tune(world, character, speed, jump, air_control)
character_move(world, character, x, z)
character_jump(world, character)
character_info(world, character)
remove_character(world, character)