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

Public Member Functions

override void Connect (Moveable_Drag draggable)
 Connects an object to the track when the game begins. More...
 
override void ApplyAutoForce (float _position, float _speed, Moveable_Drag draggable, bool ignoreMaxSpeed)
 Applies a force that, when applied every frame, pushes an object connected to the track towards a specific point along it. More...
 
override float GetForceDotProduct (Vector3 force, Moveable_Drag draggable)
 
override void ApplyDragForce (Vector3 force, Moveable_Drag draggable)
 Applies a force to an object connected to the track. More...
 
override float GetScreenPointProportionAlong (Vector2 point, Vector3 grabRelativePosition, Moveable_Drag drag)
 Gets the proportion along the track closest to a given position in screen-space More...
 
override void SetPositionAlong (float proportionAlong, Moveable_Drag draggable)
 Positions an object on a specific point along the track. More...
 
override float GetDecimalAlong (Moveable_Drag draggable)
 Gets the proportion along the track that an object is positioned. 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 UpdateDraggable (Moveable_Drag draggable)
 Updates the position of an object connected to the track. This is called every frame. More...
 
override Vector3 GetGizmoPosition (float proportionAlong)
 Gets the position of gizmos at a certain position along the track More...
 
override Vector3 GetForceToPosition (Moveable_Drag draggable, float targetProportionAlong)
 Calculates a force to get a draggable object to a given point along the track More...
 
override float GetMoveSoundIntensity (float deltaTrackPosition)
 
- Public Member Functions inherited from AC.DragTrack
virtual bool TypeSupportsSnapConnections ()
 
void OnDisconnect (Moveable_Drag draggable)
 Called when an object attached to the track is disconnected from it. More...
 
float GetMinDistanceToScreenPoint (Vector2 point, Moveable_Drag drag)
 Gets the smallest distance, in screen-space, between a given position in screen space, and the point on the track that it is closest to. More...
 
void OnLetGo (Moveable_Drag draggable)
 Called whenever an object attached to the track is let go by the player More...
 
virtual 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...
 
TrackSnapData GetSnapData (int regionID)
 Gets TrackSnapData for a snap point More...
 
float GetRegionPositionAlong (int regionID)
 Gets the position along the track for the centre of a given region More...
 
bool IsWithinTrackRegion (float trackValue, int regionID)
 Checks if a position along the track is within a given track region More...
 

Public Attributes

float maxAngle = 60f
 
float radius = 2f
 
bool doLoop = false
 
bool limitRevolutions = false
 
int maxRevolutions = 0
 
bool alignDragToFront = false
 
- Public Attributes inherited from AC.DragTrack
PhysicMaterial colliderMaterial
 
float discSize = 0.2f
 
Color handleColour = Color.white
 
DragMovementCalculation dragMovementCalculation = DragMovementCalculation.DragVector
 
bool doSnapping = false
 
List< TrackSnapDataallTrackSnapData = new List<TrackSnapData>()
 
float snapSpeed = 100f
 
bool onlySnapOnPlayerRelease
 
bool preventEndToEndJumping = false
 
ActionListSource actionListSource = ActionListSource.InScene
 

Protected Member Functions

Vector3 GetAxisOffset (Vector3 grabPosition)
 
- Protected Member Functions inherited from AC.DragTrack
void DoRegionAudioCheck (Moveable_Drag draggable)
 
virtual void AssignColliders (Moveable_Drag draggable)
 
void DoSnapCheck (Moveable_Drag draggable)
 
void DoConnectionCheck (Moveable_Drag draggable)
 
void SnapToNearest (Moveable_Drag draggable)
 
void LimitCollisions (Moveable_Drag draggable)
 
Vector3 RotatePointAroundPivot (Vector3 point, Vector3 pivot, Quaternion rotation)
 

Properties

override bool Loops [get]
 
float? MaxAngle [get]
 
- Properties inherited from AC.DragTrack
virtual bool Loops [get]
 
virtual bool UsesEndColliders [get]
 
Transform Transform [get]
 

Detailed Description

A track that constrains a Moveable_Drag's position, so that it can only be rotated. This makes it suitable for objects that pivot, such as levers, doors, etc.

Member Function Documentation

◆ ApplyAutoForce()

override void AC.DragTrack_Hinge.ApplyAutoForce ( float  _position,
float  _speed,
Moveable_Drag  draggable,
bool  ignoreMaxSpeed 
)
virtual

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

Parameters
_positionThe proportion along which to place the Moveable_Drag object (0 to 1)
_speedThe speed to move by
draggableThe draggable object to move
ignoreMaxSpeedIf False, the object's maxSpeed will limit the speed

Reimplemented from AC.DragTrack.

◆ ApplyDragForce()

override void AC.DragTrack_Hinge.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.

◆ Connect()

override void AC.DragTrack_Hinge.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_Hinge.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.

◆ GetForceToPosition()

override Vector3 AC.DragTrack_Hinge.GetForceToPosition ( Moveable_Drag  draggable,
float  targetProportionAlong 
)
virtual

Calculates a force to get a draggable object to a given point along the track

Parameters
draggableThe draggable object
targetProportionAlongHow far along the track to calculate a force for
Returns
The force vector, in world space

Reimplemented from AC.DragTrack.

◆ GetGizmoPosition()

override Vector3 AC.DragTrack_Hinge.GetGizmoPosition ( float  proportionAlong)
virtual

Gets the position of gizmos at a certain position along the track

Parameters
proportionAlongThe proportio along the track to get the gizmo position of
Returns
The position of the gizmo

Reimplemented from AC.DragTrack.

◆ GetScreenPointProportionAlong()

override float AC.DragTrack_Hinge.GetScreenPointProportionAlong ( Vector2  point,
Vector3  grabRelativePosition,
Moveable_Drag  drag 
)
virtual

Gets the proportion along the track closest to a given position in screen-space

Parameters
pointThe position in screen-space
grabRelativePositionThe grab position relative to the draggable's centre
dragThe object being dragged
Returns
The proportion along the track closest to a given position in screen-space

Reimplemented from AC.DragTrack.

◆ SetPositionAlong()

override void AC.DragTrack_Hinge.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_Hinge.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_Hinge.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

◆ alignDragToFront

bool AC.DragTrack_Hinge.alignDragToFront = false

If True, then the calculated drag vector will be based on the track's orientation, rather than the object being rotated, so that the input drag vector will always need to be the same direction

◆ doLoop

bool AC.DragTrack_Hinge.doLoop = false

If True, then objects can be rotated a full revolution

◆ limitRevolutions

bool AC.DragTrack_Hinge.limitRevolutions = false

If True, and doLoop = True, then the number of revolutions an object can rotate is limited

◆ maxAngle

float AC.DragTrack_Hinge.maxAngle = 60f

How much an object can be rotated by

◆ maxRevolutions

int AC.DragTrack_Hinge.maxRevolutions = 0

If limitRevolutions = True, the maximum number of revolutions an object can be rotated by

◆ radius

float AC.DragTrack_Hinge.radius = 2f

The track's radius (for visualising in the Scene window)