Stingray Forum (Read Only)
Welcome to Autodesk’s Stingray Forums. Share your knowledge, ask questions, and explore popular Stingray topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Oculus not seeing camera view

28 REPLIES 28
SOLVED
Reply
Message 1 of 29
cbenner
2550 Views, 28 Replies

Oculus not seeing camera view

Hello,

 

I've run through the roller coaster demo setup, and was able to duplicate the demo in Stingray.  As of Friday, playing the level (without Oculus), the viewpoint of the level test was that of the camera.  This morning I tried the exact same file with the Oculus plugged in, and while Oculus can SEE the level, it is not seeing it form the same viewpoint.... it's like the camera is above and off to the side.

 

Is there something in the Oculus Lua that needs to be set to tell it to use the same camera?

28 REPLIES 28
Message 21 of 29
cbenner
in reply to: MatthewDoyleArt

@MatthewDoyleArt

 

So close I can taste it.  Your help has been invaluable, so thank you again.

 

What I am seeing now is:  Without the HMD hooked up the animation plays fine and follows the camera as expected.  With the HMD hooked up... animation doesn't play at all. 

 

In my level flow, I have tried using input from both the mouse and the Oculus controller buttons, neither work with the HMD plugged in.  

Message 22 of 29
MatthewDoyleArt
in reply to: cbenner

The last post I wrote works on my end. I have a Stingray camera that is animated with Story. I use that camera in the Lua code and when I have my Oculus DK2 plugged in, the animation works. Unfortunately, I cannot diagnose any Oculus controller issues, as I am using DK2 and I don't have the touch controls.

 

So, in order for me to diagnose what is wrong on your end going forward, I'll need to actually see your Stingray project. Can you provide it to me somehow? Dropbox, or any other file sharing will be fine.

 

Also, I need to know a few things:

 

What version of the Oculus runtime are you using?

What version of Stingray?

What OS?

 

 

 


Matthew Doyle
Technical Marketing Manager

-----------------------------

Area Blog: Game Dev Blog
Watch me on Youtube: Youtube.com/MatthewDoyleArt
Check out some of my work at: MatthewDoyle.com
Message 23 of 29
cbenner
in reply to: MatthewDoyleArt


@MatthewDoyleArt wrote:

The last post I wrote works on my end. I have a Stingray camera that is animated with Story. I use that camera in the Lua code and when I have my Oculus DK2 plugged in, the animation works. Unfortunately, I cannot diagnose any Oculus controller issues, as I am using DK2 and I don't have the touch controls.

 

So, in order for me to diagnose what is wrong on your end going forward, I'll need to actually see your Stingray project. Can you provide it to me somehow? Dropbox, or any other file sharing will be fine.

 

Also, I need to know a few things:

 

What version of the Oculus runtime are you using?

Oculus App Version 1.13.0.362051

What version of Stingray?

1.7.1177.0

What OS?

Win 10-64

 

 

 


My camera and animation were brought in from 3ds Max, maybe this is where the problem lies.

Message 24 of 29
MatthewDoyleArt
in reply to: cbenner

That's possibly it. Might be something very simple with how the camera is being referenced in code. I am downloading your project  now. I'll get back to you soon.


Matthew Doyle
Technical Marketing Manager

-----------------------------

Area Blog: Game Dev Blog
Watch me on Youtube: Youtube.com/MatthewDoyleArt
Check out some of my work at: MatthewDoyle.com
Message 25 of 29

Ok. Figured it out. It was in fact a camera referencing issue. Since you imported an animated camera from Max, you needed to get a reference to the "Walkthrough_Cam001" camera node in the unit, rather than its parent "walkthrough_cam001".

 

You can copy the entire working project.lua file from here: https://hastebin.com/uvojazobef.lua

 

 

Here's what I did:

 

Step 1: Define 2 local variables: 

 

local walkthrough_cam001 = nil
local myCam = nil

Step 2: Change local function get_player_pose() to this:

 

local function get_player_start_pose()
    local pose = stingray.Camera.world_pose(myCam, 1)
    return pose
end

Step 3: Add the following code to function Project.on_level_load_pre_flow()

 

NOTE: You may need to play with the values I specify in the set_local_rotation part to get the correct rotation. Here's an explanation of the values:

 

stingray.Vector3(0, 1, 0) = the X, Y, Z axis that you want to rotate around. So, 0, 1, 0 = rotated around the Y axis. 0, 0, 1 would by rotate around the Z axis, and 1, 0, 0 would be to rotate around the X axis.

The 3.14 value is the amount to rotate by in radians. 3.14 radians = 180 degrees.

 

-- Get a reference to Unit
walkthrough_cam001 = stingray.World.unit_by_name(SimpleProject.world, "walkthrough_cam001")

-- Get a refernce to the actual camera in the Unit
myCam = stingray.Unit.camera(walkthrough_cam001, "Walkthrough_Cam001")

-- set rotation offset of myCam (otherwise, it will be rotated 180 degrees upsidedown in the HMD).
stingray.Camera.set_local_rotation(myCam, walkthrough_cam001, stingray.Quaternion(stingray.Vector3(0, 1, 0), 3.14))

Step 4: Add this code to the function Project.update(dt):

 

local player_start_pose = get_player_start_pose()
OculusVRSystem.set_tracking_space_pose(vr_system, player_start_pose)

 


Matthew Doyle
Technical Marketing Manager

-----------------------------

Area Blog: Game Dev Blog
Watch me on Youtube: Youtube.com/MatthewDoyleArt
Check out some of my work at: MatthewDoyle.com
Message 26 of 29
cbenner
in reply to: MatthewDoyleArt

@MatthewDoyleArt

 

Genius.

 

Thank you for all of your help, this seems to be working now.  I appreciate the explanations as well, and all of the time you spent on my code.  I had very little time to learn hoe to do this, and with your help it looks like we'll have something working in time.

Message 27 of 29
MatthewDoyleArt
in reply to: cbenner

Great! Glad it works. If you have any future issues with it, let me know.


Matthew Doyle
Technical Marketing Manager

-----------------------------

Area Blog: Game Dev Blog
Watch me on Youtube: Youtube.com/MatthewDoyleArt
Check out some of my work at: MatthewDoyle.com
Message 28 of 29
Anonymous
in reply to: MatthewDoyleArt

Matthew Doyle can you please make a project with roller coaster to use vr HTC VIVE version Smiley Happy

Message 29 of 29
cbenner
in reply to: MatthewDoyleArt

Hoping there are some experts still in this forum.... because I ain't one of them.

 

The solution for this thread no longer works, as the project.lua has changed dramatically in Interactive 2020.  The language has changed, and I'm unsure how to proceed.  I can launch the level, but I cannot figure out how to tie the camera to the HMD in this new program.  I am NOT a programmer, so I don't know the code or where to put it in the project.  Is anyone willing to look over the solution posted, and offer some insights into how to do the same thing in the new project.lua file?  Is there a way to do this in the flow instead?

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report