Jump to content

Maaco

Members
  • Posts

    18
  • Joined

  • Last visited

Posts posted by Maaco

  1. 29 minutes ago, reepblue said:

    Opt into the beta and there are functions supported that'll do this. Just note that it's still a beta so you encounter some bugs. Also Josh hasn't updated in in quite a while. ?

    Thanks for your reply, I’ll opt into the beta and have a look at it. Let’s hope the functionality (and API) for VR will be expanded in the (near) future.

  2. I'm trying to create a character (using Lua) that will walk in the direction that my VR headset is looking, so I wonder if there's a way to get the offset between the (entity)cam and the VR Headset rotation? 

    If I remember correctly there's no offset available at the moment for setting rotation in VR, right? (just for position: VR:SetOffset)

     
  3. Ah yes gimbal lock...I didn't think of that.

    I've simplified/extracted part of the code (to clarify) that seems to cause the issue.

    When I attach this simple script to an entity it shows the same behavior/issue when exceeding +90 or -90 degrees of rotation  around the X-Axis:

     

     

    function Script:Start()
        
        self.entity:SetGravityMode(false)
        -- Create a camera
        self.camera = Camera:Create()
            
    end

    --Adjust the camera orientation relative to entity
    function Script:UpdateCamera()
        self.camera:SetRotation(self.entity:GetRotation())
        self.camera:SetPosition(self.entity:GetPosition())
        self.camera:Move(0,1,0)
    end


    function Script:UpdatePhysics()
        --Get the game window
        local window = Window:GetCurrent()

        --Keyboard input 
            if window:KeyDown(Key.W) then self.entity:AddTorque(130,0,0,false) end
            if window:KeyDown(Key.A) then self.entity:AddTorque(0,-130,0,false) end
            if window:KeyDown(Key.D) then self.entity:AddTorque(0,130,0,false) end
            if window:KeyDown(Key.S) then self.entity:AddTorque(-130,0,0,false) end
            if window:KeyDown(Key.Q) then self.entity:AddForce(0,15,0,false) end
            if window:KeyDown(Key.E) then self.entity:AddForce(0, 0, 50,false) end
            if window:KeyDown(Key.Z) then self.entity:AddTorque(0, 0, 100,false) end
            if window:KeyDown(Key.C) then self.entity:AddTorque(0, 0, -100,false) end
                
     end


    function Script:UpdateWorld()

      --Update the camera each frame
        self:UpdateCamera()

    end
     

     

  4. I'm working on a controller system for a small 'spacecraft' that has two flightmodes: a 'hover' mode that works fine (steering somewhat like a drone) and a 'normal'  flightmode that allows you to rotate around pitch, yaw and bank axis. That works ok too, but when I make a looping (rotating around the pitch axis) the camera seems to get 'left behind' when passing a certain amount of pitch (90 degrees up or down).

    Here's a link with a video of the issue, it'll show at 0:26 (and at 0:33 again) when pitching nose down:

     The ship (a Rigid Body with Prop physics wiht a mass of 30) is controlled by applying AddForce and AddTorque. I noted that it also happens when colliding with scenery objects.

    Any suggestions on what is causing this?

    Thanks,

    Maaco

    • Like 1
  5. I would like to retrieve and use the input of the Oculus touch controller thumbsticks (in LUA) if possible at all (in VR seated mode) I can acces all buttons but in the API reference I can only find (minimal) info on ‘Vec2 GetControllerAxis’. Does anyone have an example on using thumbsticks (or touchpad) input? Thx Maaco

  6. Well, I seem to be running this topic all by myself answering my own questions, but thats allright:lol:

    Anyway, for anyone that cares: I at least solved the trigger collision problem for the VRPlayer script  by simply adding "self.entity:SetParent(camera)" to the UpdateWorld function in the VRPlayer script (as Josh kinda already suggested) So now the player model (with mass and a collison shape) follows wherever the VR camera goes. Only problem with this quick fix is that the player can't use moving platforms or elevators as the camera isn't influenced by them. Loading a new map still doesn't work but triggering other events by player collision at least work.

  7. Not 100% sure if this really is a bug or if I'm doing something wrong but there seems to be no way for me to change /load a different map when using the VRPlayer script. 
    I understand that the VRPlayer has no mass or collisionshape so triggers (like in this case the ChangeMap trigger) can't collide with the VRPlayer.

    That's why I started doing some tests using an (player independent) object to collide with the ChangeMap Trigger and a new map loads without a problem in the normal (FPS Player) setup. 

    However when the same player entity has the VRPlayer script attached to it, the (ChangeMap)trigger does get activated but then the game crashes with the following error message:

    "modeOpenGL error GL_INVALID_OPERATION" 

    This problem seems to be project independent: I've tried it with different (also some default) projects and always get the same error.

    I also tried it on two different computers and got the same error (First on a Intel i7-7700/Nvidia Geforce GTX1070 and on a second system with a Intel i7-3770K/AMD Radeon R9 fury X, all drivers being up to date) In both cases I was using a Rift for VR. 

    So I was wondering: has anyone managed to load a new map while using the VRPlayer script?

  8. After doing some more testing using an (player independent) object to collide with the ChangeMapTrigger the new map loads without a problem in the normal (FPS Player) setup. In the VR environment the trigger gets activated, but then the game crashes with the following error message: "modeOpenGL error GL_INVALID_OPERATION" As I'm not sure what exact conditions are required (in the next map?) for successfully loading a new map I think it's best for me to just wait for 4.6.

    Other collison scripts are working perfectly in VR (e.g. I've made a keycard you can pick up with the (touch)controllers and hold it next to a cardreader to open a door), so I guess this issue is somewhere in the map changing/loading system?

  9. The box I used for colliding with the trigger was dropped independently of the player entity (just falling down by gravity) and did have a mass and collision shape. That seems to work while having the FPSplayer in the scene (even when the player is not colliding with the trigger) but not while the VRplayer is being used.

    In other words: when this particular box collides with the trigger while looking at it 'through' the FPS player it works, but while looking at it 'through' the VR Player it doesn't. 

  10. Hi Josh,

    Thanks for your answer.

    I just did some tests where I had a box dropped  (prop with a mass) onto the ChangeMap Trigger and the weird thing is that it will only load the new map when I have the FPS Player script attached to the player model. Once I use the VR Player script on the player model the map doesn't want to load when the same box is dropped. 

×
×
  • Create New...