Global

Methods

(async) animate()

Animates the scene
Source:

checkCollision(mesh1, mesh2) → {boolean}

Checks if two meshes are intersecting with each other
Parameters:
Name Type Description
mesh1 THREE.Mesh first mesh to check
mesh2 THREE.Mesh second mesh to check
Source:
Returns:
true if the two meshes are intersecting
Type
boolean

checkIfPointIsInsideMesh(point, mesh) → {boolean}

Checks if a point is inside a mesh
Parameters:
Name Type Description
point THREE.Vector3 point to check
mesh THREE.Mesh mesh to check
Source:
Returns:
true if the point is inside the mesh
Type
boolean

createPlayer()

Creates a player mesh and adds it to the scene
Source:

degToRad(deg) → {number}

Converts degrees to radians
Parameters:
Name Type Description
deg number The angle in degrees
Source:
Returns:
The radian value of the given degree
Type
number

getCameraLookAt(cam) → {THREE.Vector3}

Gets the vector where the camera is looking at
Parameters:
Name Type Description
cam THREE.PerspectiveCamera camera to get the vector from
Source:
Returns:
vector where the camera is looking at
Type
THREE.Vector3

(async) getMeshFromBlenderModel(path, alternativePath) → {Promise.<THREE.Mesh>}

Fetches a gltf model from the given url and returns it
Parameters:
Name Type Description
path string the path to the gltf model
alternativePath string the path to the gltf model if the first path is not working
Source:
Returns:
mesh mesh of the gltf model
Type
Promise.<THREE.Mesh>

getNewPosition(position, lookAt, distance, isWalking) → {THREE.Vector3}

Calculates the new position of the player/camera
Parameters:
Name Type Description
position THREE.Vector3 current position of the player/camera
lookAt THREE.Vector3 current lookAt of the camera
distance number distance the player should walk
isWalking Object object that stores if the user is walking in a direction
Source:
Returns:
new position of the player/camera
Type
THREE.Vector3

handleAnimateChairs()

Is called every frame and handles animation of chairs There are 3 steps in the animation: 1. Move the chair backwards 2. Move the chair up 3. Move the chair forwards
Source:

handleAnimateClosets()

Is called every frame and handles the animation of the closets
Source:

handleBlackboardInertia()

Is called every frame and moves the blackboard boards if there is a fast movement by the user
Source:

handleInfoDiv()

Is called every frame and handles the information div about the interactions
Source:

handleWalking()

Handle the walking of the player Is called every frame in animate.js
Source:

(async) init()

Initializes the flight school scene
Source:

initAdjustBlackboardHeight()

Adds the mouse event listener to the blackboard to adjust the height
Source:

initDevControls()

Initialize developer controls / keyboard shortcuts and experimental features such as the ability to turn on/off all lights by pressing l or the ability to turn on/off shadows of the chairs by pressing c
Source:

initInfoDiv()

Initializes the info div
Source:

initInteractions()

Calls the init functions to initialize the interactions
Source:

initMouseClickMove()

Lets user rotate the camera with the mouse
Source:

initOpenCloset()

Adds the on click event listener to the closets
Source:

initPutChairOnTable()

Adds the on click event listener to the chairs and determines the direction of the chair for the animation
Source:

initStats()

Initialize the FPS stats
Source:

initSwitchLight()

Initializes the light switchers
Source:

initTriggerFlightSimulator()

Adds the on click event listener to monitor to start the flight simulator
Source:

initWalk()

Initialize the walking controls
Source:

(async) placeLights()

Places all lights in the scene
Source:

(async) placeObjects()

Places all objects in the scene and adds them to the sceneObjects object
Source:

putStartScreenOnReady() → {boolean}

Sets the button from "Loading..." to "Start" and enables it
Source:
Returns:
true if the start button should be clicked immediately (if the user was redirected from the flight simulator)
Type
boolean

showBoundingBox(mesh)

Creates a bounding box around the given mesh and shows it in the scene
Parameters:
Name Type Description
mesh THREE.Mesh mesh to create the bounding box around
Source:

showVector(vector, position, name, color)

Shows a vector in the scene and if the vector is already shown the previous one will be removed
Parameters:
Name Type Default Description
vector THREE.Vector3 vector to show
position THREE.Vector3 position of the vector
name string name of the vector
color number 16777215 color of the vector
Source:

startScene()

Hides the start screen and starts the scene
Source:

turnVectorAroundHorizontalAxis(vector, angle) → {Object}

Turns a vector around the horizontal axis (for plane movement)
Parameters:
Name Type Description
vector * vector to turn
angle * angle to turn
Source:
Returns:
new vector and if the vector turned beyond the y axis (to check if the plane is upside down)
Type
Object

turnVectorAroundVerticalAxis(vector, angle) → {THREE.Vector3}

Turns a vector around the vertical axis (for plane movement)
Parameters:
Name Type Description
vector THREE.Vector3 vector to turn
angle number angle to turn
Source:
Returns:
turned vector
Type
THREE.Vector3