Class GroupMoveController
Smooth the child cube towards the parent cube position
Namespace: XRC.Students.SU2023.IN03.Chen
Assembly: cs.temp.dll.dll
Syntax
public class GroupMoveController : MonoBehaviour, ISmoothDamp, IRotateTowards
Methods
ApplyRotateTowards(Transform, Transform)
Update the cube so that it always rotates towards the main camera
Declaration
public void ApplyRotateTowards(Transform camera, Transform interactable)
Parameters
Type | Name | Description |
---|---|---|
Transform | camera | The main camera, center of rotation |
Transform | interactable | The transform of the interactable rotating towards the camera |
ApplySmoothDamp(Transform, Transform, Vector3)
Smooth the child cube position towards the parent cube position
Declaration
public Vector3 ApplySmoothDamp(Transform parent, Transform self, Vector3 initialPosition)
Parameters
Type | Name | Description |
---|---|---|
Transform | parent | The parent cube transform |
Transform | self | The child cube transform |
Vector3 | initialPosition | The initial position of the child cube when Update was last called. |
Returns
Type | Description |
---|---|
Vector3 | The position of the child cube after applying smooth damp. |
Awake()
Set this cube as the transfrom of the attached the gameObject Set initial position as the position of this cube's transform when started
Declaration
public void Awake()
Start()
Set the main camera as camera Get grab interactable component from the attached gameObject
Declaration
public void Start()
Update()
Continuously update by setting the new initial position as the previous current position after applying smooth damp
Declaration
public void Update()