Farutos

Forum Replies Created

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • Farutos
    Participant

    I dont’ quite understand why Ralf wont add vr x,y,z position translating script himself.

    Its some quite easy to do. Chatgpt created such script for me and it work fine, its not game changers but works , tested it in gta 5.
    It could be tuned for steps length.

    The script

    import openvr
    import time
    import math
    import keyboard  # Requires: pip install keyboard
    
    # Sensitivity threshold (in meters)
    move_threshold = 0.02  # 2 cm to detect movement
    short_walk_time = 0.5  # 0.5 sec press for ~20 cm movement
    long_walk_time = 1.5   # 1.5 sec press for ~1.5m movement
    
    def get_hmd_pose(vr_system):
        """Retrieve the headset's position and rotation from SteamVR."""
        poses = openvr.TrackedDevicePose_t * openvr.k_unMaxTrackedDeviceCount
        tracked_device_poses = poses()
       
        vr_system.getDeviceToAbsoluteTrackingPose(openvr.TrackingUniverseStanding, 0, tracked_device_poses)
    
        hmd_index = openvr.k_unTrackedDeviceIndex_Hmd
        hmd_pose = tracked_device_poses[hmd_index]
    
        if hmd_pose.bPoseIsValid:
            matrix = hmd_pose.mDeviceToAbsoluteTracking
            x = matrix[0][3]  # Left/Right position
            y = matrix[2][3]  # Forward/Backward position
    
            # Extract rotation (yaw) from the SteamVR tracking matrix
            yaw = math.atan2(matrix[0][2], matrix[2][2])  # Yaw angle in radians
    
            return x, y, yaw
        return None, None, None
    
    # Initialize OpenVR
    # vr_system = openvr.init(openvr.VRApplication_Scene)
    vr_system = openvr.init(openvr.VRApplication_Background)
    print("✅ SteamVR Tracking Initialized")
    
    # Store the last position
    last_x, last_y, last_yaw = get_hmd_pose(vr_system)
    if last_x is None or last_y is None or last_yaw is None:
        print("❌ Error: Headset tracking not available. Make sure SteamVR is running.")
        openvr.shutdown()
        exit()
    
    print("Starting position:", round(last_x * 100, 1), "cm X,", round(last_y * 100, 1), "cm Y")
    print("Starting yaw angle:", round(math.degrees(last_yaw), 1), "degrees")
    
    # Main loop to track **headset-relative movement** and trigger key presses
    try:
        while True:
            x, y, yaw = get_hmd_pose(vr_system)
    
            if x is not None and y is not None and yaw is not None:
                # Calculate relative movement (delta)
                delta_x = (x - last_x)  # Left/Right movement
                delta_y = (y - last_y)  # Forward/Backward movement
    
                # Convert movement into head-relative coordinates
                forward_movement = -(delta_x * math.sin(yaw) + delta_y * math.cos(yaw))  # Inverted for correct direction
                sideways_movement = delta_x * math.cos(yaw) - delta_y * math.sin(yaw)
    
                # Convert to cm for easier reading
                forward_cm = forward_movement * 100
                sideways_cm = sideways_movement * 100
    
                # Check movement threshold
                if abs(forward_cm) > move_threshold * 100:
                    if forward_cm > 0:  # Moving forward
                        key = "w"
                        print("🔼 MOVEMENT: {:.1f} cm forward".format(forward_cm))
                    else:  # Moving backward
                        key = "s"
                        print("🔽 MOVEMENT: {:.1f} cm backward".format(abs(forward_cm)))
    
                    # Determine key press duration
                    duration = short_walk_time if abs(forward_cm) < 100 else long_walk_time
                    keyboard.press(key)
                    time.sleep(duration)
                    keyboard.release(key)
    
                if abs(sideways_cm) > move_threshold * 100:
                    if sideways_cm > 0:  # Moving right
                        key = "d"
                        print("➡ MOVEMENT: {:.1f} cm right".format(sideways_cm))
                    else:  # Moving left
                        key = "a"
                        print("⬅ MOVEMENT: {:.1f} cm left".format(abs(sideways_cm)))
    
                    # Determine key press duration
                    duration = short_walk_time if abs(sideways_cm) < 100 else long_walk_time
                    keyboard.press(key)
                    time.sleep(duration)
                    keyboard.release(key)
    
                # Update last position for next frame
                last_x, last_y, last_yaw = x, y, yaw
    
            time.sleep(0.05)  # Short delay for smooth tracking
    except KeyboardInterrupt:
        print("\nShutting down SteamVR tracking.")
        openvr.shutdown()

    or for gta 5 script if you want press C to look behind and reverse movement

    
    import openvr
    import time
    import math
    import keyboard  # Requires: pip install keyboard
    
    # Sensitivity threshold (in meters)
    move_threshold = 0.02  # 2 cm to detect movement
    short_walk_time = 0.5  # 0.5 sec press for ~20 cm movement
    long_walk_time = 1.5   # 1.5 sec press for ~1.5m movement
    
    def get_hmd_pose(vr_system):
        """Retrieve the headset's position and rotation from SteamVR."""
        poses = openvr.TrackedDevicePose_t * openvr.k_unMaxTrackedDeviceCount
        tracked_device_poses = poses()
       
        vr_system.getDeviceToAbsoluteTrackingPose(openvr.TrackingUniverseStanding, 0, tracked_device_poses)
    
        hmd_index = openvr.k_unTrackedDeviceIndex_Hmd
        hmd_pose = tracked_device_poses[hmd_index]
    
        if hmd_pose.bPoseIsValid:
            matrix = hmd_pose.mDeviceToAbsoluteTracking
            x = matrix[0][3]  # Left/Right position
            y = matrix[2][3]  # Forward/Backward position
    
            # Extract rotation (yaw) from the SteamVR tracking matrix
            yaw = math.atan2(matrix[0][2], matrix[2][2])  # Yaw angle in radians
    
            return x, y, yaw
        return None, None, None
    
    # Initialize OpenVR
    vr_system = openvr.init(openvr.VRApplication_Background)
    print("✅ SteamVR Tracking Initialized")
    
    # Store the last position
    last_x, last_y, last_yaw = get_hmd_pose(vr_system)
    if last_x is None or last_y is None or last_yaw is None:
        print("❌ Error: Headset tracking not available. Make sure SteamVR is running.")
        openvr.shutdown()
        exit()
    
    print("Starting position:", round(last_x * 100, 1), "cm X,", round(last_y * 100, 1), "cm Y")
    print("Starting yaw angle:", round(math.degrees(last_yaw), 1), "degrees")
    
    # Main loop to track **headset-relative movement** and trigger key presses
    try:
        while True:
            x, y, yaw = get_hmd_pose(vr_system)
    
            if x is not None and y is not None and yaw is not None:
                # Calculate relative movement (delta)
                delta_x = (x - last_x)  # Left/Right movement
                delta_y = (y - last_y)  # Forward/Backward movement
    
                # Convert movement into head-relative coordinates
                forward_movement = -(delta_x * math.sin(yaw) + delta_y * math.cos(yaw))  # Inverted for correct direction
                sideways_movement = delta_x * math.cos(yaw) - delta_y * math.sin(yaw)
    
                # Convert to cm for easier reading
                forward_cm = forward_movement * 100
                sideways_cm = sideways_movement * 100
    
                # **Check if "C" is being held**
                reverse_mode = keyboard.is_pressed("c")  # True when "C" is pressed
    
                # Check movement threshold
                if abs(forward_cm) > move_threshold * 100:
                    if forward_cm > 0:  
                        key = "s" if reverse_mode else "w"  # Reverse W ↔ S
                        print("🔼 MOVEMENT: {:.1f} cm forward".format(forward_cm) if not reverse_mode else "🔽 MOVEMENT: {:.1f} cm backward".format(abs(forward_cm)))
                    else:  
                        key = "w" if reverse_mode else "s"  # Reverse S ↔ W
                        print("🔽 MOVEMENT: {:.1f} cm backward".format(abs(forward_cm)) if not reverse_mode else "🔼 MOVEMENT: {:.1f} cm forward".format(forward_cm))
    
                    # Determine key press duration
                    duration = short_walk_time if abs(forward_cm) < 100 else long_walk_time
                    keyboard.press(key)
                    time.sleep(duration)
                    keyboard.release(key)
    
                if abs(sideways_cm) > move_threshold * 100:
                    if sideways_cm > 0:  
                        key = "a" if reverse_mode else "d"  # Reverse A ↔ D
                        print("➡ MOVEMENT: {:.1f} cm right".format(sideways_cm) if not reverse_mode else "⬅ MOVEMENT: {:.1f} cm left".format(abs(sideways_cm)))
                    else:  
                        key = "d" if reverse_mode else "a"  # Reverse D ↔ A
                        print("⬅ MOVEMENT: {:.1f} cm left".format(abs(sideways_cm)) if not reverse_mode else "➡ MOVEMENT: {:.1f} cm right".format(sideways_cm))
    
                    # Determine key press duration
                    duration = short_walk_time if abs(sideways_cm) < 100 else long_walk_time
                    keyboard.press(key)
                    time.sleep(duration)
                    keyboard.release(key)
    
                # Update last position for next frame
                last_x, last_y, last_yaw = x, y, yaw
    
            time.sleep(0.05)  # Short delay for smooth tracking
    except KeyboardInterrupt:
        print("\nShutting down SteamVR tracking.")
        openvr.shutdown()
    
    in reply to: vorpx won’t hook anymore to many games #221210
    Farutos
    Participant

    For me everything was fixed by emptying folder (prior backup) “C:\ProgramData\Animation Labs\vorpX” and then reinstalling vorpx.

    I dont know why this is more mentioned to an extend almost like trying to hide it, or not being aware of it. I know its perhaps maybe related to config factory reset, but maybe not the same.

    Uninstalling and you have to install also license.

    Prior i thought it only worked only first minutes after restarting a pc, but then even that stopped to work, so i was trying any combination of these


    headset connected via virtual desktop, also steam sometimes

    running vorpx as admin,

    alongside vorpx running it with default hook, with alternative hook, with hook helper whoch overrides both default and alternative hook

    ” but nothing helped only ultimately deleting that folder

    in reply to: Sea of Thieves #218972
    Farutos
    Participant

    Perhaps late to the party, but you can try playing via remote streaming like Shadow cloud pc, or just pure parsec, vorpx can quite correctly hook on those remote streaming apps, and while experience might not be as immersive as vorpx directly to game, i think still quite enjoyable, and there is no chance this way sea of thieves or any game will be able to ban player for vorpx this way.

    Farutos
    Participant

    Thankss for suggestion, however i tried nalo and it works quite awkwardly, it works seldomly but when it does, its very cumbersome, the display is literally shaking since it register movement as humping from side to side, so basically while moreless i walk slowly i have to move by hands quickly or even when i move hands quickly the depiction of display is as i was running swinging drunk from side to side on a ship during a strom at ocean, the image of screen is shaking too much. Maybe its better with a phone or tracker mounted to leg.

    Furthermore hardware stuff like htc trackers not sure if supposed to be at place like kat loco need bases to track i think so you cant leave the room. If natural locomotion app could be due similar reason not supposed to be walking with it really but staying in place.
    Kat loco not sure if those need bases, but perhaps are slower, can be used only at place, and cannot be used like fbt full body tracking or tracking real world objects.

    Thanks for your suggested cyberhoes or walkovr perhaps could be better. I think there are some special trackers even for 50 euroes

    Farutos
    Participant

    and another question, maybe also odd, but since quest headset or at least some or multiple headset can figure out movement, positions that you are close to boundary, and even project to direct vr games, why vorpx cannot make use of this data?

    Farutos
    Participant

    and basically why catwalk c and virtuix omni can translate movement into arrow keys, but headset/vorpx cannot?

    in reply to: Positional tracking via Direct VR? #218602
    Farutos
    Participant

    do treadmills like catwalk c or virtuix omni solving it by merely translating movements into arrow keys? If they can to that, the tredmilless. Why not vorpx, am i missing something whats the difference?

    in reply to: shadows of doubt (voxel) #218600
    Farutos
    Participant

    where can i find and download profile for this game? Can be physical vr walking movement translated into in game moving?

    in reply to: shadows of doubt (voxel) #218599
    Farutos
    Participant

    where can i find and download profile for this game?

    in reply to: OVRDrop overaly app doesn't work as in other Vr games #177636
    Farutos
    Participant

    solved in a OVRDrop thread -https://steamcommunity.com/app/586210/discussions/0/3561682879996587594/

    “OVRdrop > General Discussions > Topic Details

    fantomx1 has OVRdrop 10 hours ago
    Support of VORPX missing, therefore misses opportunity to be used at basically all other non-vr games
    Support of VORPX missing, therefore misses opportunity to be used at basically all other non-vr games.

    Vorpx tool provides ways of using any game in virtual reality, could be OVRDrop made in a way, that it would be displayed also over VORPX game overlay for example in GTA5?

    I started also thread at VORPX site here – https://www.vorpx.com/forums/topic/ovrdrop-overaly-app-doesnt-work-as-in-other-vr-games/

    thank you
    Showing 1-2 of 2 comments

    Jaded [developer] 5 hours ago
    OVRdrop is powered by SteamVR, and thus can only be seen when SteamVR is running and rendering. vorpX can also be made to run through SteamVR, and thus OVRdrop should be visible in vorpX games when rendering through SteamVR. I have not tested this, but if vorpX is running as a proper SteamVR title, then OVRdrop should be visble and functional.

    You will need to set vorpX to run through SteamVR. OVRdrop is only supported by SteamVR at this time, as opposed to something like Oculus Home. OVRdrop works with Oculus Rift and other non-SteamVR-first HMDs, but only when SteamVR is the SDK rendering to the headset. I would be happy to add support for other SDKs when they support the vital functions of OVRdrop, however at this time no other SDK that I know of supports the things OVRdrop needs.
    Last edited by Jaded; 5 hours ago
    #1

    fantomx1 has OVRdrop 3 minutes ago
    That’s true, thank you, it was due to my Oculus, I uninstalled oculus software maybe unnecessarily , used pimax glasses, and configured in VORPX steam support instead of oculus, and it started to work, although my ovrdrop windows was behind

    as since pc games use the same control keyboard, I usually cannot control the game, when different window is activated in windows than the game, and I don’t know if there is any way to overcome this.
    #2
    Showing 1-2 of 2 comments
    Per page: 15 30 50”

    Farutos
    Participant

    Just to say my problems were completely solved by buying a desktop, no matter if optimus technology was directly connected to GPU dedicated port or integrated, it never worked, perhaps because laptop display is always connected to integrated graphics. Who knows maybe if I connected and run a game on external display connected to dedicated hdmi but I had only one hdmi and would not have space remaining to connect virtual reality glasses.

Viewing 11 posts - 1 through 11 (of 11 total)

Spread the word. Share this post!