Skip to content
This repository has been archived by the owner on Feb 1, 2024. It is now read-only.

Commit

Permalink
Merge development branch for version 3.0.1 (#128)
Browse files Browse the repository at this point in the history
### Bug fixes:

- Fix invalid head transformation initialization (Fixes #127 and godotengine/godot#41943).
  • Loading branch information
Fredia Huya-Kouadio authored Feb 10, 2021
1 parent b9c29c8 commit d4a2412
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 8 deletions.
1 change: 1 addition & 0 deletions config.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ ext.versions = [
targetSdk : 30,
buildTools : '30.0.1',
kotlinVersion : '1.4.10',
ndkVersion : "21.3.6528147"
]
Binary file not shown.
2 changes: 1 addition & 1 deletion demo/android/plugins/gdovrmobile.gdap
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

name="OVRMobile"
binary_type="local"
binary="gdovrmobile.3.0.0-release.aar"
binary="gdovrmobile.3.0.1-release.aar"
6 changes: 3 additions & 3 deletions plugin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ apply plugin: "kotlin-android"
android {
buildToolsVersion = versions.buildTools
compileSdkVersion versions.compileSdk
ndkVersion "21.1.6352462"
ndkVersion versions.ndkVersion

defaultConfig {
minSdkVersion versions.minSdk
targetSdkVersion versions.targetSdk
versionCode 4
versionName '3.0.0'
versionCode 5
versionName '3.0.1'
setProperty("archivesBaseName", "gdovrmobile.${versionName}")

externalNativeBuild {
Expand Down
2 changes: 1 addition & 1 deletion plugin/gdovrmobile.gdap
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

name="OVRMobile"
binary_type="local"
binary="gdovrmobile.3.0.0-release.aar"
binary="gdovrmobile.3.0.1-release.aar"
12 changes: 9 additions & 3 deletions plugin/src/main/cpp/ovr_mobile_session.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ OvrMobileSession::OvrMobileSession() :
default_layer_color_scale.z = 1.0f;
default_layer_color_scale.w = 1.0f;

head_tracker.Status = 0;

ovr_mobile_controller = new OvrMobileController();
}

Expand Down Expand Up @@ -111,16 +113,20 @@ godot_transform OvrMobileSession::get_transform_for_eye(godot_int godot_eye,
godot_transform reference_frame = godot::arvr_api->godot_arvr_get_reference_frame();
godot_real world_scale = godot::arvr_api->godot_arvr_get_worldscale();

if (in_vr_mode()) {
// Validate that we're in vr mode and have valid orientation and position data.
if (!in_vr_mode() ||
(head_tracker.Status &
(VRAPI_TRACKING_STATUS_ORIENTATION_VALID + VRAPI_TRACKING_STATUS_POSITION_VALID)) !=
(VRAPI_TRACKING_STATUS_ORIENTATION_VALID + VRAPI_TRACKING_STATUS_POSITION_VALID)) {
godot::api->godot_transform_new_identity(&transform_for_eye);
} else {
if (godot_eye == 1 || godot_eye == 2) { // check if we have the left(1) or right(2) eye
ovrMatrix4f *ovrEyeMatrix = &head_tracker.Eye[godot_eye - 1].ViewMatrix;
godot_transform_from_ovrMatrix(&transform_for_eye, ovrEyeMatrix, world_scale);
} else { // mono eye (godot_eye == 0); used by godot to set the ARVRCamera matrix
godot_transform_from_ovr_pose(
&transform_for_eye, head_tracker.HeadPose.Pose, world_scale);
}
} else {
godot::api->godot_transform_new_identity(&transform_for_eye);
}

ret = *cam_transform;
Expand Down

0 comments on commit d4a2412

Please sign in to comment.