/* 1. Grab the looking direction vector array: [X, Y, Z] */ let facing = api.getPlayerFacingInfo(playerId).dir; /* 2. Multiply the angles by your desired launch speed (Multiplier) */ let speedMultiplier = 40; let launchX = facing[0] * speedMultiplier; let launchY = facing[1] * speedMultiplier; let launchZ = facing[2] * speedMultiplier; /* 3. Apply the 4-argument impulse payload natively to the clicking player */ api.applyImpulse(playerId, launchX, launchY, launchZ);
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter