Home Forums Game Integration Extended View altering player rotation

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #18713
    Tiago
    Participant

    Hi, i’m developing a 1st person view game where the player is navigating a maze using eye tracking.
    I have made the player move forward automatically and added a script on the camera to rotate the player using Input.GetAxisRaw, therefore altering where the player is going towards.
    Is there a way to get that rotation value from the Extended View, i want to rotate the player to where the player is looking and not just the camera.

    #18722
    Grant [Tobii]
    Keymaster

    Hi @tiagomcoliveira, thanks for your query. You could try using the following property on extended view script:

    public virtual Camera CameraWithExtendedView

    Which is a full transform of extended view camera and one can calculate rotation diff between it and CameraWithExtendedView rotation
    or one could simply use CameraWithExtendedView forward vector as a movement direction.

    However, we would not recommend using Extended view for navigation, unless it’s fully assistive use case. Let us know how you get on. Best Wishes.

    #18728
    Tiago
    Participant

    Hi, thank you for answering. I’m still a newbie at using Unity and i’m a bit confused by that, could you elaborate a little bit on what you explained.
    I tried to add that on the ‘ExtendedViewFirstPerson’ script, which is the one i’m using, but i got an error because it said the modifier virtual wasn’t valid for that item, so i added ‘{get; set;}’ to the line but i got a warning saying ‘ExtendedViewFirstPerson.CameraWithExtendedView’ hides inherited member ‘ExtendedViewBase.CameraWithExtendedView’. I also added ‘CameraWithExtendedView = GetComponentInParent<Camera>();’ to the ‘void Awake’ function, but i’m not sure if this is what i should be doing.
    I also noted that the script ‘ExtendedViewBase’ has the property you mentioned, is that where i should be editing the code to alter the rotation of the player?

    #18729
    Alex [Tobii]
    Keymaster

    Hi @tiagomcoliveira
    CameraWithExtendedView property in ExtendedViewFirstPerson class is inherited from ExtendedViewBase class, which means that you can access it on ExtendedViewFirstPerson class and you don’t need to add anything. Just do something like this:

    
    var eview = GetComponent<ExtendedViewFirstPerson>(); //or get access to this component in some other way.
    Camera eviewCamera = eview.CameraWithExtendedView;
    Transform eviewTransform = eviewCamera.transform;
    Quaternion eviewQuat = eviewTransform.Rotation;
    ...
    

    Here you can read more on object-oriented programming and inheritance in C#:
    https://docs.microsoft.com/en-us/dotnet/csharp/tutorials/inheritance

    #18731
    Tiago
    Participant

    That was it, thank you, it’s working now. But there’s still one problem i couldn’t solve.
    How can i make the camera rotate 360º?
    I tried altering the mininum and maximum rotation local angles, and also the minimum and maximum rotation world angles, but that wasn’t it.
    I can only rotate the camera about 180º, and i need to allow the player to rotate the camera completely so he can go backwards to the direction he was coming from.

    #18737
    Alex [Tobii]
    Keymaster

    @tiagomcoliveira ,
    In this case, it’s better to rotate the camera continuously using gaze point offset from the middle of the screen instead of using ExtendedView script.
    Make sure to use a continuous curve that defines how fast you rotate depending on that offset. You may possibly add some dead zone to that curve in the middle of the screen so that the user can use gaze for interaction as well as camera rotation.

    Here you can find a video for what it may look like (from a master thesis by Cara Storath)
    http://cstorath.com
    (scroll down to MASTER THESIS: MAKING EXISTING COMPUTER GAMES ACCESSIBLE VIA EYE-TRACKING)

    #18739
    Tiago
    Participant

    What is the ‘Gaze Point offset’?
    I tried googling what it was but couldn’t find it, i also coud never access the documentation for the Unity SDK, it says the link is broken.
    In the UnitySDK files i’m using, i only found two images named ‘Gaze Point’ and two scripts, one called ‘Gaze point’ and the other ‘gaze point data provider’, is it one of those?
    That video has exactly what i would like to add, but i still don’t understand how i am supposed to do it.

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.