SceneController

Package: Libraries.Game.Scenes · Inherits from: Libraries.Language.Object

A SceneController is what a scene's controller made when the scene was loaded, such as a car built from a model's Vehicle controller (VehicleControllerSettings): the model, the physics body it rides on, the vehicle and the behavior that drives it. A game gets it by the model's name, to reset the car or change how it drives.

Example Code

use Libraries.Game.Game
use Libraries.Game.Scenes.SceneController

class Main is Game
SceneController car = undefined

action Main
    StartGame()
end

action CreateGame
    LoadScene("Scenes/Scene.qs")
    car = GetSceneController("Car")
end
end

Actions

GetBody()

This action returns the item that moves with physics: a vehicle's body, which the camera and a streaming terrain should follow.

Returns

Libraries.Interface.Item3D: The body, or the model if there is no body.

GetModel()

This action returns the model the controller moves.

Returns

Libraries.Interface.Item3D: The model.

GetName()

This action returns the model's name, which the controller is known by.

Returns

text: The name.

GetStartPosition()

This action returns where Reset puts the vehicle.

Returns

Libraries.Compute.Vector3: Where the body's middle goes.

GetVehicle()

This action returns the vehicle.

Returns

Libraries.Game.Physics.Vehicles.Vehicle: The vehicle, or undefined if the controller isn't one.

GetVehicleBehavior()

This action returns the behavior that drives the vehicle with the keys, such as to change its keys or engine force.

Returns

Libraries.Interface.Behaviors.Games.VehicleMovementBehavior: The behavior, or undefined if the controller isn't a vehicle.

IsVehicle()

This action returns true if the controller is a vehicle.

Returns

boolean: True for a vehicle.

Reset()

This action puts a vehicle back where it started, turned as it started and stopped, such as after it rolls over or falls. The following camera jumps to it.

SetStartPosition(Libraries.Compute.Vector3 position)

This action sets where Reset puts the vehicle, such as a checkpoint.

Parameters

SetupVehicle(Libraries.Interface.Item3D model, Libraries.Interface.Item3D body, Libraries.Game.Physics.Vehicles.Vehicle vehicle, Libraries.Interface.Behaviors.Games.VehicleMovementBehavior driving, Libraries.Game.Graphics.Camera camera, Libraries.Compute.Vector3 position, Libraries.Compute.Matrix4 rotation)

This action is called when a vehicle is built, to keep what was made and where it started. Most programs never call it.

Parameters

Inherited Actions

3 actions from Libraries.Language.Object