Announcement

Collapse
No announcement yet.

4.17 VR Rotation?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    [VIVE] 4.17 VR Rotation?

    How to i create swipe rotation similar to recroom rotation? i cant even get the player to rotate where he is standing! using a button :O any advice?
    My website: https://www.pijellypin.com
    Multiplayer Components: https://www.unrealengine.com/marketp...yer-components

    #2
    bumb bumb bumb bumb
    My website: https://www.pijellypin.com
    Multiplayer Components: https://www.unrealengine.com/marketp...yer-components

    Comment


      #3
      You can use AddActorWorldRotation inside your VR Pawn's blueprint. Set the yaw to +/- 45 or 90 degrees depending on your preference.
      CTO | Head of VR Development - Visit us at http://humanxr.com
      My UE4 Tutorials (mostly VR): https://goo.gl/GUvDyV

      Comment


        #4
        Originally posted by vr_marco View Post
        You can use AddActorWorldRotation inside your VR Pawn's blueprint. Set the yaw to +/- 45 or 90 degrees depending on your preference.
        this rotates the player from center of space i want the player to rotate from where he is standing in his box like so

        Click image for larger version

Name:	imageshow.png
Views:	831
Size:	6.7 KB
ID:	1362792
        My website: https://www.pijellypin.com
        Multiplayer Components: https://www.unrealengine.com/marketp...yer-components

        Comment


          #5
          [QUOTE=VirtueeL;n1362791]

          this rotates the player from center of space i want the player to rotate from where he is standing in his box like so

          /QUOTE]

          AddActorWorldRotation doesn't rotate the player pawn around the center of the world [0,0,0], it rotates the player pawn around its pivot point in world space. So if the actor is in [100,100,0] the rotation happens around that point, which is the actor current location. Did you try that?
          CTO | Head of VR Development - Visit us at http://humanxr.com
          My UE4 Tutorials (mostly VR): https://goo.gl/GUvDyV

          Comment


            #6
            [QUOTE=vr_marco;n1362798]
            Originally posted by VirtueeL View Post

            this rotates the player from center of space i want the player to rotate from where he is standing in his box like so

            /QUOTE]

            AddActorWorldRotation doesn't rotate the player pawn around the center of the world [0,0,0], it rotates the player pawn around its pivot point in world space. So if the actor is in [100,100,0] the rotation happens around that point, which is the actor current location. Did you try that?
            it rotates the player from his center room setup, not where camera is in world the box is his room setup still cant get it to work been googeling for 2 days still cant find a fix
            My website: https://www.pijellypin.com
            Multiplayer Components: https://www.unrealengine.com/marketp...yer-components

            Comment


              #7
              Ah got it! Now I understand your issue. The box is the physical room space you are playing into. So you physically move to a corner of the room and you want to rotate around that location while your "body" is still in the center of the room.

              You can try to add a local rotation to the VR Camera Root (or whatever you called the Scene component your VR camera is parented to) with AddLocalRotation. That should do it.
              CTO | Head of VR Development - Visit us at http://humanxr.com
              My UE4 Tutorials (mostly VR): https://goo.gl/GUvDyV

              Comment


                #8
                Originally posted by vr_marco View Post
                Ah got it! Now I understand your issue. The box is the physical room space you are playing into. So you physically move to a corner of the room and you want to rotate around that location while your "body" is still in the center of the room.

                You can try to add a local rotation to the VR Camera Root (or whatever you called the Scene component your VR camera is parented to) with AddLocalRotation. That should do it.
                That also wouldn't do it......the HMD in roomscale is offset from its parents zero point, if you rotate the parent you rotate that offset and change the players position. In roomscale generally the "body" is where the HMD is, offset from the actors root position, the Camera root if you are using one is at the zero point of the actor as well.


                He wants something like what the RotatingMovementComponent uses

                Code:
                    // Compute new rotation
                    const FQuat OldRotation = UpdatedComponent->GetComponentQuat();
                    const FQuat DeltaRotation = (RotationRate * DeltaTime).Quaternion();
                    const FQuat NewRotation = bRotationInLocalSpace ? (OldRotation * DeltaRotation) : (DeltaRotation * OldRotation);
                
                    // Compute new location
                    FVector DeltaLocation = FVector::ZeroVector;
                    if (!PivotTranslation.IsZero())
                    {
                        const FVector OldPivot = OldRotation.RotateVector(PivotTranslation);
                        const FVector NewPivot = NewRotation.RotateVector(PivotTranslation);
                        DeltaLocation = (OldPivot - NewPivot); // ConstrainDirectionToPlane() not necessary because it's done by MoveUpdatedComponent() below.
                    }
                The important part is the last bit and can be done in blueprints like: AddActorWorldOffset (OldRotation.RotateVector(Pivot) - NewRotation.RotateVector(Pivot) )


                Consider supporting me on patreon

                My Open source tools and plugins
                Advanced Sessions Plugin
                VR Expansion Plugin

                Comment


                  #9
                  mordentral You are perfectly right, I did not consider properly that he is playing room scale. My bad!

                  Anyway, here is a solution. Not super-elegant maybe (it doesn't use transforms), but it works as expected. Basically it implements a rotation around the local camera Z axis regardless of where the VR Pawn/VR Origin is.

                  The math is that of a planar rotation around an arbitrary point (which in this case is the VR Camera). Basically it calculates which roto-translation needs to be applied to the Pawn/Origin for the camera to pivot around its local Z-axis in the current location.

                  VirtueeL Give it a try and see whether that does the job for you. I have hard coded the rotations to +/- 15 degrees (see the Rotation Angle variable set in the two custom actions) but you can change them to whatever is required.

                  Click image for larger version

Name:	Capture.PNG
Views:	913
Size:	161.7 KB
ID:	1363001
                  CTO | Head of VR Development - Visit us at http://humanxr.com
                  My UE4 Tutorials (mostly VR): https://goo.gl/GUvDyV

                  Comment


                    #10
                    Originally posted by vr_marco View Post
                    mordentral You are perfectly right, I did not consider properly that he is playing room scale. My bad!

                    Anyway, here is a solution. Not super-elegant maybe (it doesn't use transforms), but it works as expected. Basically it implements a rotation around the local camera Z axis regardless of where the VR Pawn/VR Origin is.

                    The math is that of a planar rotation around an arbitrary point (which in this case is the VR Camera). Basically it calculates which roto-translation needs to be applied to the Pawn/Origin for the camera to pivot around its local Z-axis in the current location.

                    VirtueeL Give it a try and see whether that does the job for you. I have hard coded the rotations to +/- 15 degrees (see the Rotation Angle variable set in the two custom actions) but you can change them to whatever is required.

                    Click image for larger version

Name:	Capture.PNG
Views:	913
Size:	161.7 KB
ID:	1363001
                    will give it a try will respond back very soon hope it works then mordentral and vr_marco your me heros
                    My website: https://www.pijellypin.com
                    Multiplayer Components: https://www.unrealengine.com/marketp...yer-components

                    Comment


                      #11
                      well it sort of worked, but when i rotated it messed up my teleport script :/ then the teleport is not accurate instead, my teleport script just does not teleport correctly anymore no idea why :3


                      Click image for larger version

Name:	GoToLocation.png
Views:	819
Size:	89.0 KB
ID:	1363026Click image for larger version

Name:	getLocation.png
Views:	815
Size:	51.4 KB
ID:	1363025

                      My website: https://www.pijellypin.com
                      Multiplayer Components: https://www.unrealengine.com/marketp...yer-components

                      Comment


                        #12
                        VirtueeL Can you be a bit more precise about what is happening with your teleport script? What does "not accurate" mean? The fact that the VR Pawn is now being rotated-translated by the rotation script may affect the direction of its forward / right vectors. If you rely on them for setting your teleportation direction you may experience indeed some issues. How do you set the teleportation target location?
                        CTO | Head of VR Development - Visit us at http://humanxr.com
                        My UE4 Tutorials (mostly VR): https://goo.gl/GUvDyV

                        Comment


                          #13
                          Originally posted by vr_marco View Post
                          VirtueeL Can you be a bit more precise about what is happening with your teleport script? What does "not accurate" mean? The fact that the VR Pawn is now being rotated-translated by the rotation script may affect the direction of its forward / right vectors. If you rely on them for setting your teleportation direction you may experience indeed some issues. How do you set the teleportation target location?
                          by the image below the linetrace comes from controller, then it sets the target location, the i use the teleport to script

                          My website: https://www.pijellypin.com
                          Multiplayer Components: https://www.unrealengine.com/marketp...yer-components

                          Comment


                            #14
                            VirtueeL So the teleport works as expected until you rotate, right? After you rotate it becomes "not accurate". Can you described what happens exactly? Can you link the amount of the rotation to the amount of inaccuracy of the teleportation (i.e. the more you rotate the more inaccurate it becomes)? If you rotate by 180 degrees are you teleporting in the exact opposite direction you are expected to?
                            CTO | Head of VR Development - Visit us at http://humanxr.com
                            My UE4 Tutorials (mostly VR): https://goo.gl/GUvDyV

                            Comment


                              #15
                              Your teleport is offsetting by the HMD location (camera relative location), you need to rotate that vector by the actors rotation for the teleport to be correct post rotation.


                              Consider supporting me on patreon

                              My Open source tools and plugins
                              Advanced Sessions Plugin
                              VR Expansion Plugin

                              Comment

                              Working...
                              X