Posted May 1, 20214 yr I am trying to apply FORWARD velocity to the player, but I am not sure how to do it. I can apply velocity in XYZ directions using player#setVelocity() but I am not sure how to dynamically add velocity based on the player's direction. My current code: Spoiler if (InputMappings.isKeyDown(mc.getMainWindow().getHandle(), GLFW.GLFW_KEY_W)) { mc.player.addVelocity(1, 0, 0); } if (InputMappings.isKeyDown(mc.getMainWindow().getHandle(), GLFW.GLFW_KEY_A)) { mc.player.addVelocity(0, 0, 1); } if (InputMappings.isKeyDown(mc.getMainWindow().getHandle(), GLFW.GLFW_KEY_S)) { mc.player.addVelocity(-1, 0, 0); } if (InputMappings.isKeyDown(mc.getMainWindow().getHandle(), GLFW.GLFW_KEY_D)) { mc.player.addVelocity(0, 0, 1); } if (InputMappings.isKeyDown(mc.getMainWindow().getHandle(), GLFW.GLFW_KEY_SPACE)) { mc.player.addVelocity(0, 1, 0); } if (InputMappings.isKeyDown(mc.getMainWindow().getHandle(), GLFW.GLFW_KEY_LEFT_SHIFT)) { mc.player.addVelocity(0, -1, 0); } EDIT: Fix formatting Edited May 1, 20214 yr by Fake_Name131 Fix formatting
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.