Adventure Creator  1.66.1
An adventure game toolkit for Unity, by Chris Burton, ICEBOX Studios 2013-2018
AC.DragTrack_Straight Class Reference
Inheritance diagram for AC.DragTrack_Straight:
AC.DragTrack

Public Member Functions

override void AssignColliders (Moveable_Drag draggable)
 Initialises two end colliders for an object that prevent it from moving beyond the track. More...
 
override void Connect (Moveable_Drag draggable)
 Connects an object to the track when the game begins. More...
 
override float GetDecimalAlong (Moveable_Drag draggable)
 Gets the proportion along the track that an object is positioned. More...
 
override void SetPositionAlong (float proportionAlong, Moveable_Drag draggable)
 Positions an object on a specific point along the track. More...
 
override void SnapToTrack (Moveable_Drag draggable, bool onStart)
 Corrects the position of an object so that it is placed along the track. More...
 
override void ApplyAutoForce (float _position, float _speed, Moveable_Drag draggable)
 Applies a force that, when applied every frame, pushes an object connected to the track towards a specific point along it. More...
 
override void ApplyDragForce (Vector3 force, Moveable_Drag draggable)
 Applies a force to an object connected to the track. More...
 
override bool IconIsStationary ()
 Checks if the icon that can display when an object is moved along the track remains in the same place as the object moves. More...
 
override void UpdateDraggable (Moveable_Drag draggable)
 Updates the position of an object connected to the track. This is called every frame. More...
 

Public Attributes

DragRotationType rotationType = DragRotationType.None
 
float maxDistance = 2f
 
bool dragMustScrew = false
 
float screwThread = 1f
 
- Public Attributes inherited from AC.DragTrack
PhysicMaterial colliderMaterial
 
float discSize = 0.2f
 
Color handleColour = Color.white
 

Additional Inherited Members

- Protected Member Functions inherited from AC.DragTrack
void LimitCollisions (Moveable_Drag draggable)
 

Detailed Description

A track that constrains a Moveable_Drag object along a straight line. The dragged object can also be made to rotate as it moves: either so it rolls, or rotates around the line's axis (like a screw).

Member Function Documentation

◆ ApplyAutoForce()

override void AC.DragTrack_Straight.ApplyAutoForce ( float  _position,
float  _speed,
Moveable_Drag  draggable 
)
virtual

Applies a force that, when applied every frame, pushes an object connected to the track towards a specific point along it.

Parameters
_positionThe proportiona along which to place the Moveable_Drag object (0 to 1)

Reimplemented from AC.DragTrack.

◆ ApplyDragForce()

override void AC.DragTrack_Straight.ApplyDragForce ( Vector3  force,
Moveable_Drag  draggable 
)
virtual

Applies a force to an object connected to the track.

Parameters
forceThe drag force vector input by the player
draggableThe Moveable_Drag object to apply the force to

Reimplemented from AC.DragTrack.

◆ AssignColliders()

override void AC.DragTrack_Straight.AssignColliders ( Moveable_Drag  draggable)
virtual

Initialises two end colliders for an object that prevent it from moving beyond the track.

Parameters
draggableThe Moveable_Drag object to create colliders for

Reimplemented from AC.DragTrack.

◆ Connect()

override void AC.DragTrack_Straight.Connect ( Moveable_Drag  draggable)
virtual

Connects an object to the track when the game begins.

Parameters
draggableThe Moveable_Drag object to connect to the track

Reimplemented from AC.DragTrack.

◆ GetDecimalAlong()

override float AC.DragTrack_Straight.GetDecimalAlong ( Moveable_Drag  draggable)
virtual

Gets the proportion along the track that an object is positioned.

Parameters
draggableThe Moveable_Drag object to check the position of
Returns
The proportion along the track that the Moveable_Drag object is positioned (0 to 1)

Reimplemented from AC.DragTrack.

◆ IconIsStationary()

override bool AC.DragTrack_Straight.IconIsStationary ( )
virtual

Checks if the icon that can display when an object is moved along the track remains in the same place as the object moves.

Returns
True if the icon remains in the same place (dependent on the way the object rotates as it moves)

Reimplemented from AC.DragTrack.

◆ SetPositionAlong()

override void AC.DragTrack_Straight.SetPositionAlong ( float  proportionAlong,
Moveable_Drag  draggable 
)
virtual

Positions an object on a specific point along the track.

Parameters
proportionAlongThe proportion along which to place the Moveable_Drag object (0 to 1)
draggableThe Moveable_Drag object to reposition

Reimplemented from AC.DragTrack.

◆ SnapToTrack()

override void AC.DragTrack_Straight.SnapToTrack ( Moveable_Drag  draggable,
bool  onStart 
)
virtual

Corrects the position of an object so that it is placed along the track.

Parameters
draggableThe Moveable_Drag object to snap onto the track
onStartIs True if the game has just begun (i.e. this function is being run for the first time)

Reimplemented from AC.DragTrack.

◆ UpdateDraggable()

override void AC.DragTrack_Straight.UpdateDraggable ( Moveable_Drag  draggable)
virtual

Updates the position of an object connected to the track. This is called every frame.

Parameters
draggableThe Moveable_Drag object to update the position of

Reimplemented from AC.DragTrack.

Member Data Documentation

◆ dragMustScrew

bool AC.DragTrack_Straight.dragMustScrew = false

If True, and the Moveable_Drag object rotates like a screw, then the input drag vector must also rotate, so that it is always tangential to the dragged object

◆ maxDistance

float AC.DragTrack_Straight.maxDistance = 2f

The track's length

◆ rotationType

DragRotationType AC.DragTrack_Straight.rotationType = DragRotationType.None

The way in which the Moveable_Drag object rotates as it moves (None, Roll, Screw)

◆ screwThread

float AC.DragTrack_Straight.screwThread = 1f

The "thread" if the Moveable_Drag object rotates like a screw - effectively how fast the object rotates as it moves