Skip to content
TheCodeCrafter edited this page Mar 3, 2017 · 7 revisions

Explanation

Wage has (at the moment) three different control groups that you have to choose from. There is THREE.FlyControls, THREE.PointerLockControls, and there is THREE.ThirdPersonControls. These three different controls can be attached to almost any entity created using Wage. Although, who wants to control a light, or a sound?

Types of Controls

FlyControls

Control Scheme:

W: Forward

A: Strafe Left

S: Backward

D: Strafe Right

Q: Pitch Left

R: Pitch Right

ALT: Slow-Down

Overview

These controls are quite simple, and work well for a spectator mode in a game. To create this type of controls, type this in your main JS file:

Control.set("fly");

This can be seen in Noah's example game, Spectator.

FPSControls

Control Scheme

W: Forward

A: Strafe Left

S: Backward

D: Strafe Right

SPACE: Jump [Note: Only if "canJump" is true]

Overview

These controls, originially authored by mrdoob, are probably the most widely used controls in Wage. These controls are for fps games, mostly (honestly, can you think of a game that would use pointer locking that isn't first person?). These controls are once again, easily initiated by simply typing this in your main JS file:

Control.set("fps");

This can be seen in Marco's example game, Dodgem.

ThirdPersonControls

Control Scheme

W: Forward

A: Strafe Left

S: Backward

D: Strafe Right

SPACE: Jump [Note: Only if "canJump" is true]

: Any key you decide to mark.

Overview

These are the last set of controls that come with Wage as a default controls. While these controls are mainly for Third Person controls, they can be used to create a more free First Person control scheme. These controls are easy to tweak, and easy to add. Just type this into your main JS file:

Control.set("3rd", <camera>, <object>);

This can be seen in Noah's example game, Blocky

Options

There are a lot of options that come with these three choices for controls. These are here so that you can tweak them to your heart's desire. All of them can be modified by using:

Controls.options.<type>.<option> = <value>;

FlyControls Options

The FlyControls setup has a couple of notable options that you might want to keep in mind for your next game!

Here are some of the key options:

  • movementSpeedMultiplier (default: 1) { This is changed to 0.1 when the user hold the alt key }
  • movementSpeed (default: 1) { The movement speed of the object }
  • rollSpeed (default: 0.005) { The roll speed (pitch and yaw) of the object }
  • dragToLook (default: !1) { Whether or not the left mouse button must be held down to look }
  • autoForward (default: !1) { Whether or not the player is automatically moving forward }

Most of these are self explanatory, but if you have a question, you can always ask one of our super helpful and hardworking mods!

FPSControls Options

The FPSControls setup has some pretty good customization, but we still recommend the ThirdPersonControls for a full arrangement of options to be modified to your heart's desire. (The name is misleading, isn't it...)

Here are some of key options:

  • height (default: 1) { The actual height of the player (in the world) }
  • velocity (default: {1, 1, 1}) { The velocity of the player (as a Vec3) }
  • delta (default: 100) { The speed of the movement of the mouse }
  • jumpHeight (default: 1) { The amount of height you jump with }
  • fallFactor (default: 1) { How fast you fall (basically, a replacement for actual gravity) }
  • canJump (default: !1) { Whether or not the player can jump }

ThirdPersonControls

The ThirdPersonControls are probably the most versatile and interchangeable type of controls there are. It is full of all sorts of options.

Here are some of the key ones:

External Options (Easily accessed):

  • moveSpeed (default: 0.2) { The move speed of the object/camera }
  • turnSpeed (default: 0.01) { The turning speed of the object/camera }
  • userZoom (default: true) { Whether or not the user can zoom the camera }
  • userZoomSpeed (default: 1) { The camera zoom speed }
  • userRotate (default: true) { Whether or not the user can rotate }
  • userRotateSpeed (default: 1.5) { The amount of rotation speed when the user inputs it }
  • autoRotate (default: false) { Whether or not the camera automatically rotates }
  • autoRotateSpeed (default: 0.1) { The rotation speed for Y axis if autoRotate is true }
  • YAutoRotation (default: false) { Whether or not the camera automatically rotates on the Y axis }
  • minPolarAngle (default: 0) { The minimum top-to-bottom angle the camera can be at }
  • maxPolarAngle (default: Math.PI) { The maximum top-to-bottom angle the camera can be at }
  • minDistance (default: 0) { The minimum amount of distance from the camera to the object }
  • maxDistance (default: infinity) { The maximum amount of distance from the camera to the object }

Internal Options (Not so easily accessed):

  • scope (default: this) { The scope of the controls/camera }
  • EPS (default: 0.000001) { The amount of dampening on the camera }
  • PIXELS_PER_ROUND (default: 1800) { The amount of pixels per round }
  • rotateStart (default: 0) { The starting rotation of the object }
  • rotateEnd (default: 0, as in there is no end) { When you can't rotate anymore }
  • rotateDelta (default: 1) { How fast you rotate the object }
  • zoomStart (default: 1) { The starting zoom at your object }
  • zoomEnd (default: 10) { The maximum amount you can zoom out }
  • zoomDelta (default: 1) { The zoom speed using the middle mouse-wheel }
  • phiDelta (default: 0) { Up and down mouse-looking }
  • thetaDelta (default: 0) { Left and Right mouse-looking }
  • scale (default: 1) { The scale of your "controls/camera" }

This is just about all we have for you on Controls. We hope you learned something!