Search Results for

    Show / Hide Table of Contents

    Class MappingController

    If you're pulling an object towards the main camera, map the controller position to certain world position by applying a log transformation

    Inheritance
    Object
    MappingController
    Implements
    IMapping
    Namespace: XRC.Students.SU2023.IN03.Chen
    Assembly: cs.temp.dll.dll
    Syntax
    public class MappingController : MonoBehaviour, IMapping

    Methods

    ApplyMapping(Vector3, Vector3)

    Map the controller position to certain world position (see Transformation for details) if you're pulling an object towards the main camera

    Declaration
    public Vector3 ApplyMapping(Vector3 initialPosition, Vector3 currentPosition)
    Parameters
    Type Name Description
    Vector3 initialPosition

    The initial position of controller when Update was last called.

    Vector3 currentPosition

    The current position of the controller when Update is now called.

    Returns
    Type Description
    Vector3

    OnSelectEntered()

    When the interactor entered selecting an object, start updating mapping rotate the object to facing the main camera and disable the Continuous Move Provider

    Declaration
    public UnityAction<SelectEnterEventArgs> OnSelectEntered()
    Returns
    Type Description
    UnityAction<SelectEnterEventArgs>

    Start mapping after entering selecting an object.

    OnSelectExited()

    When the interactor exited selecting an object, end mapping and enable the Continuous Move Provider

    Declaration
    public UnityAction<SelectExitEventArgs> OnSelectExited()
    Returns
    Type Description
    UnityAction<SelectExitEventArgs>

    End mapping after exiting selecting an object.

    Start()

    Get the main camera and other components Add listeners to interactor selection events

    Declaration
    public void Start()

    Transformation(Single)

    Take in the controller movement amount on each axis and return the mapped value after applying a log function

    Declaration
    public static float Transformation(float move)
    Parameters
    Type Name Description
    Single move

    The controller movement amount on each axis

    Returns
    Type Description
    Single

    The movement amount after applying log transformation.

    Update()

    Continuously update by setting the new initial position as the previous current position after applying each mapping

    Declaration
    public void Update()

    Implements

    IMapping
    In This Article
    Back to top XR Collaboratory