Skip to content
This repository was archived by the owner on May 18, 2025. It is now read-only.

Commit 6061332

Browse files
wip godot
1 parent 2b61c67 commit 6061332

File tree

15 files changed

+1307
-4
lines changed

15 files changed

+1307
-4
lines changed

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,14 @@ $ ./make build && ./make tests
5050
> NOTE #1: to rebundle the THREE/AFRAME javascripts during dev run `./make build js`
5151
> NOTE #2: to regenerate the parser in various languages (via haxe), run `./make build parser`
5252
53+
# Godot (>=v4.3.1)
54+
55+
```
56+
$ ./make install godot # this installs the godot-xr-tools addon
57+
```
58+
59+
> NOTE: the godot project is in [src/xrfragment/godot](./src/xrfragment/godot) (open the folder in godot)
60+
5361
# Credits
5462

5563
<br>

example/godot/.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Normalize EOL for all files that Git considers text files.
2+
* text=auto eol=lf

example/godot/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Godot 4+ specific ignores
2+
.godot/

example/godot/dist/webxr/USE_GODOT_EDITOR_TO_EXPORT.txt

Whitespace-only changes.

example/godot/export_presets.cfg

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
[preset.0]
2+
3+
name="Web"
4+
platform="Web"
5+
runnable=true
6+
dedicated_server=false
7+
custom_features=""
8+
export_filter="all_resources"
9+
include_filter=""
10+
exclude_filter=""
11+
export_path="dist/webxr/index.html"
12+
encryption_include_filters=""
13+
encryption_exclude_filters=""
14+
encrypt_pck=false
15+
encrypt_directory=false
16+
17+
[preset.0.options]
18+
19+
custom_template/debug=""
20+
custom_template/release=""
21+
variant/extensions_support=false
22+
variant/thread_support=true
23+
vram_texture_compression/for_desktop=true
24+
vram_texture_compression/for_mobile=true
25+
html/export_icon=true
26+
html/custom_html_shell=""
27+
html/head_include="<!--
28+
<script src=\"https://cdn.jsdelivr.net/npm/webxr-polyfill@latest/build/webxr-polyfill.min.js\"></script>
29+
<script>
30+
var polyfill = new WebXRPolyfill();
31+
</script>
32+
-->"
33+
html/canvas_resize_policy=2
34+
html/focus_canvas_on_start=true
35+
html/experimental_virtual_keyboard=false
36+
progressive_web_app/enabled=false
37+
progressive_web_app/offline_page=""
38+
progressive_web_app/display=1
39+
progressive_web_app/orientation=0
40+
progressive_web_app/icon_144x144=""
41+
progressive_web_app/icon_180x180=""
42+
progressive_web_app/icon_512x512=""
43+
progressive_web_app/background_color=Color(0, 0, 0, 1)

example/godot/icon.svg

Lines changed: 1 addition & 0 deletions
Loading

example/godot/icon.svg.import

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
[remap]
2+
3+
importer="texture"
4+
type="CompressedTexture2D"
5+
uid="uid://ckn6pn505bam5"
6+
path="res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"
7+
metadata={
8+
"vram_texture": false
9+
}
10+
11+
[deps]
12+
13+
source_file="res://icon.svg"
14+
dest_files=["res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"]
15+
16+
[params]
17+
18+
compress/mode=0
19+
compress/high_quality=false
20+
compress/lossy_quality=0.7
21+
compress/hdr_compression=1
22+
compress/normal_map=0
23+
compress/channel_pack=0
24+
mipmaps/generate=false
25+
mipmaps/limit=-1
26+
roughness/mode=0
27+
roughness/src_normal=""
28+
process/fix_alpha_border=true
29+
process/premult_alpha=false
30+
process/normal_map_invert_y=false
31+
process/hdr_as_srgb=false
32+
process/hdr_clamp_exposure=false
33+
process/size_limit=0
34+
detect_3d/compress_to=1
35+
svg/scale=1.0
36+
editor/scale_with_editor_scale=false
37+
editor/convert_colors_with_editor_theme=false

example/godot/index.glb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../assets/index.glb

example/godot/main.gd

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
extends Node3D
2+
3+
var xr_interface: XRInterface
4+
5+
func _ready():
6+
# Import MyClass
7+
const XRF = preload("res://xrfragment.gd")
8+
var xrf = XRF.new()
9+
add_child(xrf)
10+
print( xrf.parseURL("https://foo.com/?foo#flop=bar&fap=fop") )
11+
print( xrf.parseURL("https://foo.com/flop.html?foo#flop=bar&fap=fop") )
12+
xrf.load("https://xrfragment.org/index.glb")
13+
14+

example/godot/main.tscn

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
[gd_scene load_steps=8 format=3 uid="uid://cgjxim2x47n6g"]
2+
3+
[ext_resource type="Script" path="res://main.gd" id="1_oabt8"]
4+
[ext_resource type="PackedScene" uid="uid://bq86r4yll8po" path="res://addons/godot-xr-tools/hands/scenes/lowpoly/left_fullglove_low.tscn" id="2_nv01r"]
5+
[ext_resource type="PackedScene" uid="uid://bl2nuu3qhlb5k" path="res://addons/godot-xr-tools/functions/movement_direct.tscn" id="3_xxgqa"]
6+
[ext_resource type="PackedScene" uid="uid://xqimcf20s2jp" path="res://addons/godot-xr-tools/hands/scenes/lowpoly/right_fullglove_low.tscn" id="4_i4b8r"]
7+
[ext_resource type="PackedScene" uid="uid://b6bk2pj8vbj28" path="res://addons/godot-xr-tools/functions/movement_turn.tscn" id="5_pyrq4"]
8+
[ext_resource type="PackedScene" uid="uid://diyu06cw06syv" path="res://addons/godot-xr-tools/player/player_body.tscn" id="6_kfmth"]
9+
[ext_resource type="PackedScene" uid="uid://clc5dre31iskm" path="res://addons/godot-xr-tools/xr/start_xr.tscn" id="8_htpay"]
10+
11+
[node name="Main" type="Node3D"]
12+
script = ExtResource("1_oabt8")
13+
14+
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="."]
15+
transform = Transform3D(-0.866025, -0.433013, 0.25, 0, 0.5, 0.866025, -0.5, 0.75, -0.433013, 0, 0, 0)
16+
shadow_enabled = true
17+
18+
[node name="XROrigin3D" type="XROrigin3D" parent="."]
19+
20+
[node name="XRCamera3D" type="XRCamera3D" parent="XROrigin3D"]
21+
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.7, 0)
22+
23+
[node name="LeftHand" type="XRController3D" parent="XROrigin3D"]
24+
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.5, 0, 0)
25+
tracker = &"left_hand"
26+
27+
[node name="LeftHand" parent="XROrigin3D/LeftHand" instance=ExtResource("2_nv01r")]
28+
29+
[node name="MovementDirect" parent="XROrigin3D/LeftHand" instance=ExtResource("3_xxgqa")]
30+
strafe = true
31+
input_action = "thumbstick"
32+
33+
[node name="RightHand" type="XRController3D" parent="XROrigin3D"]
34+
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.5, 0, 0)
35+
tracker = &"right_hand"
36+
37+
[node name="RightHand" parent="XROrigin3D/RightHand" instance=ExtResource("4_i4b8r")]
38+
39+
[node name="MovementDirect" parent="XROrigin3D/RightHand" instance=ExtResource("3_xxgqa")]
40+
input_action = "thumbstick"
41+
42+
[node name="MovementTurn" parent="XROrigin3D/RightHand" instance=ExtResource("5_pyrq4")]
43+
input_action = "thumbstick"
44+
45+
[node name="PlayerBody" parent="XROrigin3D" instance=ExtResource("6_kfmth")]
46+
47+
[node name="StartXR" parent="." instance=ExtResource("8_htpay")]

0 commit comments

Comments
 (0)