Jump to content

Device Orientation camera needs to face a starting position whenever you start the game


tbgeorge
 Share

Recommended Posts

Hello, I'm trying to use a Device Orientation Camera for a game. I want it to be looking in a specific direction in the game every time you start the game, regardless of your real world rotation. But whenever I start the game, the camera immediately rotates to where I'm looking in the real world instead of starting up looking in my starting direction. 

I know this must be pretty confusing, but hopefully someone can understand it and help me out.

Thanks

Link to comment
Share on other sites

That works until the timeout hits, then the camera just snaps to where it wants to be. I need to be able to get this functionality: 
 

psuedocode:

DeviceCam.setTarget( Vec3( 0, 1, 0 ) );
 

and have the camera look in that direction as soon as the app starts up and any movements after that are all based off of that direction.

With setTimeout, the camera is looking in that direction until the timeout is done, then it snaps to where the device orientation thinks it's looking.

Basically, I need to be able to set the initial direction for the DeviceOrientationCamera and not have the input manager change it to something drastically different as soon as I attach control.

 

I have this scene: http://client.elementxcreative.com/bjs/DeviceOrientation/index.html

I have exported it from unity with the camera facing the set of 4 cubes, though when you load the game in various different phone orientations it's looking at various different sets of cubes. ( FYI, there are 4 sets of cubes: 1 cube, 2 cubes, 3 cubes, and 4 cubes ). I need it to always look at the 4 boxes when I load the scene, no matter my orientation.

Edited by tbgeorge
Link to comment
Share on other sites

Hello

DeviceCam is not my strongest Skill  
maybe this help ??? You can set the Animation Begin with a ButtonClick or Event for initialProsition of the Player.

psuedocode:
If Player click on Start ->beginAnimation in 1 min > getTarget();

http://www.babylonjs-playground.com/#4HUQQ#121

and full of bugs
http://babylonjs-playground.com/#1DLDGX#0

when not just ping someone with @[andthename]

Hm. Also when you have a 3d Program, why not set the initialPosition their, i made this playground with blender, and in looks on any device the same, with the same InitialPosition of the Player.

Link to comment
Share on other sites

Hi,

The camer's rotation is set by the device's orientation. This cannot be changed, because this is the main functionality of this camera. However - there is a possibility to add an initial rotation, that will constantly be applied to the device orientation's rotation. Meaning - if you want your "straight" rotation to be pointing up, you set the initial quaternion to point up.

this is more than possible to implement, let me see how I can provide you with an "initial rotation" the easiest.

technically you can do it on your own, if you multiply your initial quaternion with the camera's rotation quaternion in each frame.

I will work on implementing this internally in the (very) near future as it seems like it is needed :) 

Link to comment
Share on other sites

I was thinking about this, and wanted to ask a few questions just to be clear (before I implement something that is not needed):

you want that when the user opens the scene, he will see a certain object, no matter his device's orientation. What happens when he starts moving his device? should the rotation be reset (and the device's orientation should kick in) or should this current transformation, that the user started in, be the base for his device's orientation?

If it is case 1 - it will be easy to implement code-wise, but not so easy UX-wise. When will you start updating the rotation? The user will have to click " I am ready" or something similar.

If it is case 2 - this is my solution from above. I have to say thou, that the user will be rather puzzled when not understand why the scene is rotated in a wrong way while traveling through it. It will make sense if you only take the rotation around the Y axis as a base rotation. So if the user is currently looking north (as "to the right" is completely wrong :) ) north will be the "0" in the Y axis. same thing if he looks to the south or any other base-direction. 

Waiting for your answer (or any remarks from anyone) before I implement it. 

Link to comment
Share on other sites

@tbgeorge - I personally don't believe that setting a specific camera device orintation for the VRcamera is a good idea. As I travel allot lately, using my GearVR provides me a poor experience if I am not permitted to set a specific device orientation for my headset regardless of my seat orientation. This most often provides a poor experience in the game as well, and I personally recommend to always allow the user to set the default camera orientation for each game and/or media experience uniquely - especially if camera orientation control is part of the gameplay for position, direction, etc.

These are strictly my own thoughts, as it certainly depends on the game. However, I find this to be the case as much as 95% of the time.

Cheers,

DB

Link to comment
Share on other sites

@RaananW - that sounds good!

The Scene-Object can't be rotated so you suggest to create a "master"-Object (a Mesh) that should contain every Object of the scene, right?

For that I would have to recode some things, but the solution sounds okay. Just want to be sure to go the right way, now.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...