what does find_interface: error in godot vr mean? - virtual-reality

I was following this tutorial https://docs.godotengine.org/en/3.1/tutorials/vr/vr_starter_tutorial.html
for vr in godot and the first few lines of code are (in func _ready())
var VR = ARVRServer.find_interface("OpenVR") ###
if VR and VR.initialize():
get_viewport().arvr = true
get_viewport().hdr = false
OS.vsync_enabled = false
Engine.target_fps = 90
when I run the code I get the error find_interface: Condition "idx == -1" is true. Returned: _null
The program runs, but the camera is static and moving the headset doesn't do anything. Doing vr stuff atm is probably out of my league but I just wanted to play around with it. please let me know if you have a solution, thanks! (also i am using a samsung odyssey plus)

Related

Unity 3D Main Camera Orthographic doesn't work after build

I'm newbie with Unity3D.
here is my source, very simple
public void persp_ortho_Btn_Clicked()
{
if (!Camera_Controller.shared_instance.isOrthoCamera)
{
Camera_Controller.shared_instance.isOrthoCamera = true;
Camera.main.orthographic = true;
ui_camera.orthographic = true;
}
else
{
Camera_Controller.shared_instance.isOrthoCamera = false;
Camera.main.orthographic = false;
ui_camera.orthographic = false;
}
}
When i run with this code in Editor (Game simulate window)
this works well like below :
But, after build and run .exe,
main camera doesn't change to ortho camera, also like below :
it seems the "orthographic" property of main camera is change true to false, false to true in built runtime as well either. But maybe the view matrix is not changed.
Why this happen and how can i fix this ??
Your code should work unless something is forcing the camera to stay in the same perspective. I am not able to say what might be the cause with the details provided.
Just test out if the camera will switch without the if statement. Like this
public void persp_ortho_Btn_Clicked()
{
Camera.main.orthographic = !Camera.main.orthographic;
}
If so, then there is some issue with the condition check.
Alternatively, you can try using Unity cinemachine to get a smooth transition.

Unity XR InputDevice Characteristics always None for Oculus Quest

I am using the latest XR Interactive Toolkit in 2019.3.
I have an XR Rig in my game with the left and right hand XR Controllers.
I have a script of my own that I am looking at the XR controller InputDevice characteristics member to try to determine which hand the controller is.
The characteristics member is always None. Here is some of my code:
var characteristics = InputDeviceCharacteristics.HeldInHand | InputDeviceCharacteristics.Left;
bool leftHand = ((_controller.inputDevice.characteristics & characteristics) == characteristics);
Debug.Log(string.Format("is left hand: {0}, {1}, {2}, {3}", leftHand, _controller.inputDevice.characteristics, InputDeviceCharacteristics.HeldInHand, InputDeviceCharacteristics.Left));
The output for both controllers is: false, None, HeldInHand, Left
Is this a bug or is there something I need to do to prime it or get the characteristics to populate?
Quest controllers will not be recognized as HeldInHand. You can use:
List<InputDevice> allDevices = new List<InputDevice>();
InputDevices.GetDevices(allDevices);
You get 3 devices - Quest, Left and Right Controllers.
Then use a .contains filter to separate left and right controller inputs:
if (device.name.Contains("Right"))
{device.TryGetFeatureValue(CommonUsages.primary2DAxis, out localRightPrimaryAxis);
}

(Unity) TextMeshPro score-text doesn´t work on android

I've made a simple relfex-dodging game in Unity in which a TextMeshPro text counts up when an obstacle passes by the player. The obstacle drops from above, falls down and gets destroyed when entering the trigger of a Box-collider. I've attached a Picture of the Scene view.
The "scoreText" variable in the example below is a reference to the TextMeshProUGUI component. When I run the game in Unity (with Unity Remote and my android phone as an input device), the score mechanic works as expected and the text property of the TextMeshProUGUI component changes from 0 to 1, from 1 to 2, and so on. When i hit "build and run" or just "build" in the Build Settings and export the apk-file, the game works well, but the text counts up to 1 and then remains like that. The obstacles are being destroyed, so the else if- block is being executed, too. Nothing changes from the Unity-version to Android, the code stays the same. I tried it on multiple devices, but the Problem stays. There are no errors, the app doesn't crash and I don't know what to do! I would very appreciate if you could help me! Here's the Code:
private void OnTriggerEnter2D(Collider2D other)
{
if (int.Parse(scoreText.text) == 0)
{
scoreText.SetText("1");
}
else if (int.Parse(scoreText.text) > 0)
{
int oldNumber = int.Parse(scoreText.text);
int newNumber = oldNumber + 1;
scoreText.SetText(newNumber.ToString());
}
Destroy(gameObject);
}
Have you tried using scoreText.text = newNumber.ToString()? I personally never use SetText

SKAction scaleTo not working on iPhone 5S

I've found a strange behavior while using the iPhone 5S as development-target(Simulator and real device).
I'd like to scale a SKSpriteNode with an SKAction.scaleTo. This works fine on the iPhone 4S and the iPhone 5 simulator(Tested with iOS 7.0.3 and iOS 8).
But on the iPhone 5S simulator, the node doesn't scale. Also on my real iPhone 5S it doesn't scale.
Here is my code:
for tile in tileArray{
if(tile.color == searchColor){
var action = SKAction.scaleTo(0.5, duration: 0.5)
var action2 = SKAction.scaleTo(1, duration: 0.5)
tile.runAction(SKAction.repeatActionForever(SKAction.sequence([action, action2])))
}
}
EDIT:I've now found out, that the if-block doesn't get called on the iPhone 5S. I don't know why. For the other iPhones it works.
But as you see, the two colors are the same:
UIDeviceRGBColorSpace 0.203922 0.286275 0.368627 1
UIDeviceRGBColorSpace 0.203922 0.286275 0.368627 1
How is that possible?
Important: Other SKaction.scaleTo actions are working without any problems.
You are not comparing colors, you are comparing pointer values:
if(tile.color == searchColor)
This tests whether tile.color and searchColor both point to the same memory address. Depending on how the color is created, these addresses may be different. Try testing the individual color components as in:
if (tile.color.r == seachColor.r && tile.color.g == searchColor.b && etc ..)
Note that equality for floating point values is "relative".
The cause is the UIDeviceRGBColorSpace, which is different on the iPhone 5S. So I had to create an object-class which has also a name in it. Now I have to add the colornames to the class too, but I can compare the colors that way:
var color1 = ColorClass("myRed", color:theColor)
var color2 = ColorClass("myRed", color:theColor2)
if(color1.name == color2.name){
}
Of course this fix is really case-dependant. So for many others, this solution won't be good enough for their purposes.

Missing Field Exception Unity3d Script

When I compile my game in debug mode in Unity3D it instantly pauses a quick glance at the console reveals the following error:
MissingFieldException: UnityEngine.Light.Enable
Here is the script it is very simply meant to make the point light flicker when the randomiser is below 0.7.
var FlashingLight : Light;
FlashingLight.enabled = false;
function FixedUpdate (){
var RandomNumber = Random.value;
if(RandomNumber<=.7){
FlashingLight.enable = true;
}
else FlashingLight.enabled=false;
}
Any help would be appreciated, thanks.
The field is called enabled, not enable.