Skip to content

Commit

Permalink
Merge pull request #26 from BastiaanOlij/rename-godot-xr-tools
Browse files Browse the repository at this point in the history
Renaming this add on to godot-xr-tools to better describe its purpose
  • Loading branch information
BastiaanOlij authored Apr 25, 2020
2 parents c0a8b2b + dd88155 commit 23f6afc
Show file tree
Hide file tree
Showing 30 changed files with 55 additions and 52 deletions.
30 changes: 15 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Godot VR Common
This repository contains a number of support files and support scenes that can be used together with the various VR interfaces for the Godot game engine.
# Godot XR Tools
This repository contains a number of support files and support scenes that can be used together with the various AR and VR interfaces for the Godot game engine.

## How to Use

Note that the below info is a quick write-up to get your started. More detailed information can be found in our WIKI:
https://github.com/GodotVR/godot-vr-common/wiki
https://github.com/GodotVR/godot-xr-tools/wiki

### Preventing hickups

Expand All @@ -21,31 +21,31 @@ If you place environment collision shapes into layer 1 the physics engine goes a
This is something we're still looking into making easier.

### Teleportation
- if your scene doesn't have a floor yet:
- add a `StaticBody` node to the scene root
- if your scene doesn't have a floor yet:
- add a `StaticBody` node to the scene root
- add a `MeshInstance` as a child of the `StaticBody` and set its Mesh to `New PlaneMesh`
- add a `CollisionShape` a child of the `StaticBody` and set its Shape to `New PlaneShape`
- instance child scene from [the ovr_first_person scene](https://github.com/GodotVR/godot-openvr-asset/blob/master/addons/godot-openvr/scenes/ovr_first_person.tscn) (produces `OVRFirstPerson` node)
- instance child scene from [the ovr_first_person scene](https://github.com/GodotVR/godot-openvr-asset/blob/master/addons/godot-openvr/scenes/ovr_first_person.tscn) (produces `OVRFirstPerson` node)
- right click `OVRFirstPerson` node in the Scene tab and select `Editable Children` to expand the imported scene
- right click `Left_Hand` in the Scene tab and instance child scene [Function_Teleport](https://github.com/GodotVR/godot-vr-common/blob/master/addons/vr-common/functions/Function_Teleport.tscn)
- right click `Right_Hand` in the Scene tab and instance child scene [Function_Teleport](https://github.com/GodotVR/godot-vr-common/blob/master/addons/vr-common/functions/Function_Teleport.tscn)
- right click `Left_Hand` in the Scene tab and instance child scene [Function_Teleport](https://github.com/GodotVR/godot-xr-tools/blob/master/addons/vr-common/functions/Function_Teleport.tscn)
- right click `Right_Hand` in the Scene tab and instance child scene [Function_Teleport](https://github.com/GodotVR/godot-xr-tools/blob/master/addons/vr-common/functions/Function_Teleport.tscn)
- left click each `Function_Teleport` child in the Scene tab and find its Script Variables in the Inspector - assign `Origin` to `OVRFirstPerson` which is an instance of `ARVROrigin`
- start the scene and pull the trigger (button 15) to aim the teleport arc (release to teleport)

_NOTE: Newer versions of Godot will warn you with a yellow triangle that "This node has no children shapes so it can't interact with the space. Consider adding CollisionShape or CollisionPolygon children nodes to define it's shape." If you add a CollisionShape as suggested, that will interfere with the script and cause you to see a capsule rendered directly in front of you with a red indicator (i.e. teleport is blocked by the child collision)_

### Direct Movement
- instance child scene from [the ovr_first_person scene](https://github.com/GodotVR/godot-openvr-asset/blob/master/addons/godot-openvr/scenes/ovr_first_person.tscn) (produces `OVRFirstPerson` node)
- instance child scene from [the ovr_first_person scene](https://github.com/GodotVR/godot-openvr-asset/blob/master/addons/godot-openvr/scenes/ovr_first_person.tscn) (produces `OVRFirstPerson` node)
- left click `Function_Direct_movement` in the Scene tab and find its Script Variables in the Inspector: assign `Origin` to `OVRFirstPerson` which is an instance of `ARVROrigin` and `Camera` to `ARVRCamera`
- right click `OVRFirstPerson` node in the Scene tab and select `Editable Children` to expand the imported scene
- right click `Left_Hand` in the Scene tab and instance child scene [Function_Direct_movement](https://github.com/GodotVR/godot-vr-common/blob/master/addons/vr-common/functions/Function_Direct_movement.tscn)
- right click `Right_Hand` in the Scene tab and instance child scene [Function_Direct_movement](https://github.com/GodotVR/godot-vr-common/blob/master/addons/vr-common/functions/Function_Direct_movement.tscn)
- right click `Left_Hand` in the Scene tab and instance child scene [Function_Direct_movement](https://github.com/GodotVR/godot-xr-tools/blob/master/addons/vr-common/functions/Function_Direct_movement.tscn)
- right click `Right_Hand` in the Scene tab and instance child scene [Function_Direct_movement](https://github.com/GodotVR/godot-xr-tools/blob/master/addons/vr-common/functions/Function_Direct_movement.tscn)
- left click each `Function_Direct_movement` child in the Scene tab and find its Script Variables in the Inspector - assign `Origin` to `OVRFirstPerson` which is an instance of `ARVROrigin` and `Camera` to `ARVRCamera`.
- start the scene and move the joystick/trackpad forward/back to slide forward/back and left/right to rotate

### Pointer
- if your scene doesn't have objects with a `CollisionShape`/`CollisionPolygon` attached:
- add a `StaticBody` node to the scene root
- add a `StaticBody` node to the scene root
- add a `MeshInstance` as a child of the `StaticBody` and set its Mesh to `New SpheneMesh`
- add a `CollisionShape` a child of the `StaticBody` and set its Shape to `New SphereShape`
- to each node that you want to enable pointer interaction (assuming it has a `CollisionShape` child), add a script that contains a `_on_pointer_pressed` function and a `_on_pointer_released` function:
Expand All @@ -58,11 +58,11 @@ func _on_pointer_released(collisionVector3):
print(str("A pointer was released at ", collisionVector3))
# your awesome effects here
```
- instance child scene from [the ovr_first_person scene](https://github.com/GodotVR/godot-openvr-asset/blob/master/addons/godot-openvr/scenes/ovr_first_person.tscn) (produces `OVRFirstPerson` node)
- instance child scene from [the ovr_first_person scene](https://github.com/GodotVR/godot-openvr-asset/blob/master/addons/godot-openvr/scenes/ovr_first_person.tscn) (produces `OVRFirstPerson` node)
- left click `Function_Pointer` in the Scene tab and find its Script Variables in the Inspector: assign `Origin` to `OVRFirstPerson` which is an instance of `ARVROrigin` and `Camera` to `ARVRCamera`
- right click `OVRFirstPerson` node in the Scene tab and select `Editable Children` to expand the imported scene
- right click `Left_Hand` in the Scene tab and instance child scene [Function_pointer](https://github.com/GodotVR/godot-vr-common/blob/master/addons/vr-common/functions/Function_Pointer.tscn)
- right click `Right_Hand` in the Scene tab and instance child scene [Function_pointer](https://github.com/GodotVR/godot-vr-common/blob/master/addons/vr-common/functions/Function_Pointer.tscn)
- right click `Left_Hand` in the Scene tab and instance child scene [Function_pointer](https://github.com/GodotVR/godot-xr-tools/blob/master/addons/vr-common/functions/Function_Pointer.tscn)
- right click `Right_Hand` in the Scene tab and instance child scene [Function_pointer](https://github.com/GodotVR/godot-xr-tools/blob/master/addons/vr-common/functions/Function_Pointer.tscn)
- start the scene, point at an object and pull the trigger (button 15) to call the pressed/released function on each object (it should print to the console output).

_NOTE: If you want to use Teleport and Pointer together you probably need to edit one or both of their scripts since both are mapped to button 15 (the primary trigger for oculus touch). Double click the script icon next to each and search for `is_button_pressed` to make changes._
Expand Down
3 changes: 2 additions & 1 deletion CONTRIBUTORS.md → addons/godot-xr-tools/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ Contributors
============

The main author of this project is [Bastiaan Olij](https://github.com/BastiaanOlij) who manages the source repository found at:
https://github.com/GodotVR/godot-vr-common
https://github.com/GodotVR/godot-xr-tools

Other people who have helped out by submitting fixes, enhancements, etc are:
- [Florian Jung](https://github.com/Windfisch)
- [RMKD](https://github.com/RMKD)
- [Alessandro Schillaci](https://github.com/silverslade)
- [jtank4](https://github.com/jtank4)

Want to be on this list? We would love your help.
2 changes: 1 addition & 1 deletion addons/vr-common/LICENSE → addons/godot-xr-tools/LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2018-2019 Bastiaan Olij
Copyright (c) 2018-2020 Bastiaan Olij

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
1.3 (in progress)
=================
2.0
===
- Renamed add on to **godot-xr-tools**
- Add enums to our export variables
- Add a switch on pickable objects to keep their current positioning when picked up
- Move direct movement player collision slightly backwards based on player radius
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[gd_scene load_steps=3 format=2]

[ext_resource path="res://addons/vr-common/functions/Function_Direct_movement.gd" type="Script" id=1]
[ext_resource path="res://addons/godot-xr-tools/functions/Function_Direct_movement.gd" type="Script" id=1]


[sub_resource type="CapsuleShape" id=1]
radius = 0.3
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[gd_scene load_steps=3 format=2]

[ext_resource path="res://addons/vr-common/functions/Function_Pickup.gd" type="Script" id=1]
[ext_resource path="res://addons/godot-xr-tools/functions/Function_Pickup.gd" type="Script" id=1]


[sub_resource type="SphereShape" id=1]
radius = 0.5
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
[gd_scene load_steps=8 format=2]

[ext_resource path="res://addons/vr-common/functions/Function_Teleport.gd" type="Script" id=1]
[ext_resource path="res://addons/vr-common/materials/teleport.tres" type="Material" id=2]
[ext_resource path="res://addons/vr-common/materials/target.tres" type="Material" id=3]
[ext_resource path="res://addons/vr-common/materials/capule.tres" type="Material" id=4]
[ext_resource path="res://addons/godot-xr-tools/functions/Function_Teleport.gd" type="Script" id=1]
[ext_resource path="res://addons/godot-xr-tools/materials/teleport.tres" type="Material" id=2]
[ext_resource path="res://addons/godot-xr-tools/materials/target.tres" type="Material" id=3]
[ext_resource path="res://addons/godot-xr-tools/materials/capule.tres" type="Material" id=4]


[sub_resource type="PlaneMesh" id=1]
size = Vector2( 0.05, 1 )
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[gd_scene load_steps=4 format=2]

[ext_resource path="res://addons/vr-common/materials/pointer.tres" type="Material" id=1]
[ext_resource path="res://addons/vr-common/functions/Function_pointer.gd" type="Script" id=2]
[ext_resource path="res://addons/godot-xr-tools/materials/pointer.tres" type="Material" id=1]
[ext_resource path="res://addons/godot-xr-tools/functions/Function_pointer.gd" type="Script" id=2]

[sub_resource type="CubeMesh" id=1]
resource_local_to_scene = true
Expand Down
File renamed without changes
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

importer="texture"
type="StreamTexture"
path="res://.import/icon.png-fb3b2ecb55ac1327d82f6710eba4f8b4.stex"
path="res://.import/icon.png-1d8efcc4c33e64800e22ea3150ef148d.stex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://addons/vr-common/images/icon.png"
dest_files=[ "res://.import/icon.png-fb3b2ecb55ac1327d82f6710eba4f8b4.stex" ]
source_file="res://addons/godot-xr-tools/images/icon.png"
dest_files=[ "res://.import/icon.png-1d8efcc4c33e64800e22ea3150ef148d.stex" ]

[params]

Expand Down
File renamed without changes
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@

importer="texture"
type="StreamTexture"
path.s3tc="res://.import/teleport_arrow.png-9ee8732a3d27e6e53f97efad743b9f9b.s3tc.stex"
path.etc2="res://.import/teleport_arrow.png-9ee8732a3d27e6e53f97efad743b9f9b.etc2.stex"
path.s3tc="res://.import/teleport_arrow.png-f1bd44b6f478277692b3fa29171b62d3.s3tc.stex"
path.etc2="res://.import/teleport_arrow.png-f1bd44b6f478277692b3fa29171b62d3.etc2.stex"
metadata={
"imported_formats": [ "s3tc", "etc2" ],
"vram_texture": true
}

[deps]

source_file="res://addons/vr-common/images/teleport_arrow.png"
dest_files=[ "res://.import/teleport_arrow.png-9ee8732a3d27e6e53f97efad743b9f9b.s3tc.stex", "res://.import/teleport_arrow.png-9ee8732a3d27e6e53f97efad743b9f9b.etc2.stex" ]
source_file="res://addons/godot-xr-tools/images/teleport_arrow.png"
dest_files=[ "res://.import/teleport_arrow.png-f1bd44b6f478277692b3fa29171b62d3.s3tc.stex", "res://.import/teleport_arrow.png-f1bd44b6f478277692b3fa29171b62d3.etc2.stex" ]

[params]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@

importer="texture"
type="StreamTexture"
path.s3tc="res://.import/teleport_target.png-779f853f62e0e2207f5821dfbc8b780c.s3tc.stex"
path.etc2="res://.import/teleport_target.png-779f853f62e0e2207f5821dfbc8b780c.etc2.stex"
path.s3tc="res://.import/teleport_target.png-cd812f7d5692711ac91f6c8a4753ad73.s3tc.stex"
path.etc2="res://.import/teleport_target.png-cd812f7d5692711ac91f6c8a4753ad73.etc2.stex"
metadata={
"imported_formats": [ "s3tc", "etc2" ],
"vram_texture": true
}

[deps]

source_file="res://addons/vr-common/images/teleport_target.png"
dest_files=[ "res://.import/teleport_target.png-779f853f62e0e2207f5821dfbc8b780c.s3tc.stex", "res://.import/teleport_target.png-779f853f62e0e2207f5821dfbc8b780c.etc2.stex" ]
source_file="res://addons/godot-xr-tools/images/teleport_target.png"
dest_files=[ "res://.import/teleport_target.png-cd812f7d5692711ac91f6c8a4753ad73.s3tc.stex", "res://.import/teleport_target.png-cd812f7d5692711ac91f6c8a4753ad73.etc2.stex" ]

[params]

Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[gd_resource type="SpatialMaterial" load_steps=2 format=2]

[ext_resource path="res://addons/vr-common/images/teleport_target.png" type="Texture" id=1]
[ext_resource path="res://addons/godot-xr-tools/images/teleport_target.png" type="Texture" id=1]

[resource]
flags_transparent = true
Expand All @@ -9,4 +9,3 @@ params_diffuse_mode = 1
params_cull_mode = 2
albedo_color = Color( 0.176471, 0.313726, 0.862745, 1 )
albedo_texture = ExtResource( 1 )

File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[gd_resource type="ShaderMaterial" load_steps=3 format=2]

[ext_resource path="res://addons/vr-common/materials/teleport.shader" type="Shader" id=1]
[ext_resource path="res://addons/vr-common/images/teleport_arrow.png" type="Texture" id=2]
[ext_resource path="res://addons/godot-xr-tools/materials/teleport.shader" type="Shader" id=1]
[ext_resource path="res://addons/godot-xr-tools/images/teleport_arrow.png" type="Texture" id=2]

[resource]
shader = ExtResource( 1 )
Expand All @@ -10,4 +10,3 @@ shader_param/length = 30.0
shader_param/ws = 1.0
shader_param/mix_color = Color( 0.176471, 0.313726, 0.862745, 1 )
shader_param/arrow_texture = ExtResource( 2 )

Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[gd_scene load_steps=7 format=2]

[ext_resource path="res://addons/vr-common/misc/VR_Common_Shader_Cache.gd" type="Script" id=1]
[ext_resource path="res://addons/vr-common/materials/teleport.tres" type="Material" id=2]
[ext_resource path="res://addons/vr-common/materials/target.tres" type="Material" id=3]
[ext_resource path="res://addons/vr-common/materials/capule.tres" type="Material" id=4]
[ext_resource path="res://addons/vr-common/materials/pointer.tres" type="Material" id=5]
[ext_resource path="res://addons/godot-xr-tools/misc/VR_Common_Shader_Cache.gd" type="Script" id=1]
[ext_resource path="res://addons/godot-xr-tools/materials/teleport.tres" type="Material" id=2]
[ext_resource path="res://addons/godot-xr-tools/materials/target.tres" type="Material" id=3]
[ext_resource path="res://addons/godot-xr-tools/materials/capule.tres" type="Material" id=4]
[ext_resource path="res://addons/godot-xr-tools/materials/pointer.tres" type="Material" id=5]

[sub_resource type="PlaneMesh" id=2]
size = Vector2( 0.001, 0.001 )
Expand All @@ -31,4 +31,3 @@ material/0 = ExtResource( 4 )
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -2 )
mesh = SubResource( 2 )
material/0 = ExtResource( 5 )

File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[gd_scene load_steps=2 format=2]

[ext_resource path="res://addons/vr-common/objects/Object_pickable.gd" type="Script" id=1]
[ext_resource path="res://addons/godot-xr-tools/objects/Object_pickable.gd" type="Script" id=1]


[node name="PickableObject" type="RigidBody"]
collision_layer = 6
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[gd_scene load_steps=7 format=2]

[ext_resource path="res://addons/vr-common/objects/Viewport_2D_in_3D.gd" type="Script" id=1]
[ext_resource path="res://addons/vr-common/objects/Viewport_2D_in_3D_body.gd" type="Script" id=2]
[ext_resource path="res://addons/godot-xr-tools/objects/Viewport_2D_in_3D.gd" type="Script" id=1]
[ext_resource path="res://addons/godot-xr-tools/objects/Viewport_2D_in_3D_body.gd" type="Script" id=2]

[sub_resource type="QuadMesh" id=1]
resource_local_to_scene = true
Expand Down

0 comments on commit 23f6afc

Please sign in to comment.