Game logic - Controller – Ylands
Description
Controller allows to animate objects using Visual scripting and is responsible for capturing players input. Any object with controller assigned can be then possessed and controlled by a player. In order to achieve smooth movement, controlled objects are simulated locally on the client and automatically synchronized with the server. Due to the multiplayer constraints, the controller script is severally limited in comparison to "standard" visual scripting, we call this local scripting.
- Controller allows players to posses an object.
- An object can be controlled (possessed) only by one player.
- One controller can be assigned to multiple objects.
- Controller is active even if the object is not possessed.
Setup
In order to make an object eligible for possession, first it has to be animated and allow "possession". Optionally it is possible to also setup a collision envelope, so that the object will collide with world.
- Currently only capsule collision envelope is avalable
Object setup
- Select an object you wish to control
- Set the object as "Animated"
- Enable "Can be possessed" atribute
- Optionally: Set collision envelope
Collision setup
Enabling collision envelope will enable the object to collide with terrain and other entities. Currently the controller is using modified character controller, so the envelope shape is limited to capsule.
Envelope parameters
- Snaps to platforms - Whenever the object can snap to other platforms
- Slope limit - Limits the collider to only climb slopes that are less steep (in degrees) than the indicated value.
- Step offset - The collider will step up a stair only if it is closer to the ground than the indicated value.
- Skin width - Two colliders can penetrate each other as deep as their Skin Width.
Envelope size and position can be tweaked using the "Edit" button
- Center - Collider offset in world space.
- Radius - Width of the collider.
- Height - Capsule Collider height.
Controller setup
- Custom controls
- Enable Custom controls automatically