Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion VERSIONS.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# 4.5.1
- Fix broken link
- Fix broken link
- Upgrade to using Godot 4.7.2 and Vendor plugin 5.1.0
- Update CI accordingly
- Upgrade Godot XR Tools to 4.5.2
- Upgrade to using Godot 4.7

# 4.5.0
- Upgrade Godot XR Tools to 4.5.1
Expand Down
7 changes: 7 additions & 0 deletions addons/godot-xr-tools/VERSIONS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# 4.5.2
- Fix _property_get_revert() throwing error
- Change physics_movement() return type to bool

# 4.5.1
- Fix export issue

# 4.5.0
- Minimum Godot version changed to 4.4
- Added UIDs for all classes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ func is_xr_class(xr_name: String) -> bool:


# Perform jump movement
func physics_movement(_delta: float, player_body: XRToolsPlayerBody, _disabled: bool):
func physics_movement(_delta: float, player_body: XRToolsPlayerBody, _disabled: bool) -> bool:
# Skip if the controller isn't active
if !player_body.enabled or xr_start_node.is_xr_active():
return
return false

# Detect crouch button down and pressed states
var crouch_button_down := Input.is_action_pressed(crouch_button_action)
Expand All @@ -81,3 +81,5 @@ func physics_movement(_delta: float, player_body: XRToolsPlayerBody, _disabled:
player_body.override_player_height(self, crouch_height)
else:
player_body.override_player_height(self)

return false
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ func is_xr_class(xr_name: String) -> bool:


# Perform jump movement
func physics_movement(_delta: float, player_body: XRToolsPlayerBody, _disabled: bool):
func physics_movement(_delta: float, player_body: XRToolsPlayerBody, _disabled: bool) -> bool:
# Skip if the controller isn't active
if !player_body.enabled or xr_start_node.is_xr_active():
return
return false

#Calculate input vector
var input_dir = Input.get_vector(input_left, input_right, input_backward, input_forward)
Expand All @@ -61,6 +61,8 @@ func physics_movement(_delta: float, player_body: XRToolsPlayerBody, _disabled:
if length > max_speed:
player_body.ground_control_velocity *= max_speed / length

return false

## Find the right [XRToolsDesktopMovementDirect] node.
##
## This function searches from the specified node for the right controller
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,11 @@ func _ready():


# Process physics movement for flight
func physics_movement(delta: float, player_body: XRToolsPlayerBody, disabled: bool):
func physics_movement(delta: float, player_body: XRToolsPlayerBody, disabled: bool) -> bool:
# Disable flying if requested, or if no controller
if disabled or !enabled or !player_body.enabled or xr_start_node.is_xr_active():
set_flying(false)
return
return false

# Detect press of flight button
var old_flight_button = _flight_button
Expand All @@ -103,7 +103,7 @@ func physics_movement(delta: float, player_body: XRToolsPlayerBody, disabled: bo

# Skip if not flying
if !is_active:
return
return false

# Select the pitch vector
var pitch_vector: Vector3
Expand Down Expand Up @@ -144,7 +144,7 @@ func physics_movement(delta: float, player_body: XRToolsPlayerBody, disabled: bo

# Update velocity and return for additional effects
player_body.velocity = flight_velocity
return
return false


func set_flying(active: bool) -> void:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,13 @@ func is_xr_class(xr_name: String) -> bool:


# Perform jump movement
func physics_movement(_delta: float, player_body: XRToolsPlayerBody, _disabled: bool):
func physics_movement(_delta: float, player_body: XRToolsPlayerBody, _disabled: bool) -> bool:
# Skip if the jump controller isn't active
if !player_body.enabled or xr_start_node.is_xr_active():
return
return false

# Request jump if the button is pressed
if Input.is_action_pressed(jump_button_action):
player_body.request_jump()

return false
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@ func _ready():


# Perform sprinting
func physics_movement(_delta: float, player_body: XRToolsPlayerBody, disabled: bool):
func physics_movement(_delta: float, player_body: XRToolsPlayerBody, disabled: bool) -> bool:
# Skip if the controller isn't active or is not enabled
if !player_body.enabled or xr_start_node.is_xr_active() or disabled == true or !enabled:
set_sprinting(false)
return
return false

# Detect sprint button down and pressed states
var sprint_button_down := Input.is_action_pressed(sprint_button)
Expand All @@ -97,6 +97,8 @@ func physics_movement(_delta: float, player_body: XRToolsPlayerBody, disabled: b
if sprinting != is_active:
set_sprinting(sprinting)

return false


# Public function used to set sprinting active or not active
func set_sprinting(active: bool) -> void:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,15 @@ func _process(_delta: float) -> void:


# Perform jump movement
func physics_movement(delta: float, player_body: XRToolsPlayerBody, _disabled: bool):
func physics_movement(delta: float, player_body: XRToolsPlayerBody, _disabled: bool) -> bool:
# Skip if the player body isn't active
plr_body=player_body
if !player_body.enabled or xr_start_node.is_xr_active():
if clear_mouse_move_when_body_not_active:
mouse_move_vector=Vector2.ZERO
#if clear_cam_x_when_body_not_active:
# player_body.camera_node.rotation_degrees.x=0
return
return false

var deadzone = 0.1
# if _snap_turning():
Expand All @@ -114,7 +114,7 @@ func physics_movement(delta: float, player_body: XRToolsPlayerBody, _disabled: b
-89.999,
89.999)
mouse_move_vector=Vector2.ZERO
return
return false



Expand Down
8 changes: 5 additions & 3 deletions addons/godot-xr-tools/examples/fall_damage.gd
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,11 @@ func _ready():
is_active = true


func physics_movement(_delta: float, player_body: XRToolsPlayerBody, disabled: bool):
func physics_movement(_delta: float, player_body: XRToolsPlayerBody, disabled: bool) -> bool:
# Skip if not enabled
if disabled or !enabled:
_previous_velocity = player_body.velocity
return
return false

# Calculate the instantaneous acceleration
var accel_vec := player_body.velocity - _previous_velocity
Expand All @@ -81,7 +81,7 @@ func physics_movement(_delta: float, player_body: XRToolsPlayerBody, disabled: b
if ground_only:
# Ignore if not on ground
if not player_body.on_ground:
return
return false

# Only consider vertical acceleration
accel_vec *= Vector3.UP
Expand All @@ -90,3 +90,5 @@ func physics_movement(_delta: float, player_body: XRToolsPlayerBody, disabled: b
var accel := accel_vec.length()
if accel > damage_threshold:
emit_signal("player_fall_damage", accel)

return false
4 changes: 3 additions & 1 deletion addons/godot-xr-tools/functions/function_teleport.gd
Original file line number Diff line number Diff line change
Expand Up @@ -379,10 +379,12 @@ func _property_can_revert(property : StringName) -> bool:


# Provide revert values for custom properties
func _property_get_revert(property : StringName): # Variant
func _property_get_revert(property : StringName) -> Variant:
if property == "player_material":
return _DefaultMaterial

return null


# Set enabled property
func set_enabled(new_value : bool) -> void:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[gd_resource type="AnimationNodeBlendTree" format=3 uid="uid://dl8yf7ipqotd1"]
[gd_resource type="AnimationNodeBlendTree" load_steps=6 format=3 uid="uid://dl8yf7ipqotd1"]

[sub_resource type="AnimationNodeAnimation" id="1"]
animation = &"Grip"
Expand Down Expand Up @@ -29,4 +29,4 @@ nodes/OpenHand/node = SubResource("4")
nodes/OpenHand/position = Vector2(-600, 100)
nodes/Trigger/node = SubResource("5")
nodes/Trigger/position = Vector2(-360, 20)
node_connections = [&"output", 0, &"Grip", &"Grip", 0, &"Trigger", &"Grip", 1, &"ClosedHand2", &"Trigger", 0, &"OpenHand", &"Trigger", 1, &"ClosedHand1"]
node_connections = [&"Grip", 0, &"Trigger", &"Grip", 1, &"ClosedHand2", &"Trigger", 0, &"OpenHand", &"Trigger", 1, &"ClosedHand1", &"output", 0, &"Grip"]
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[gd_resource type="AnimationNodeBlendTree" format=3 uid="uid://m85b1gogdums"]
[gd_resource type="AnimationNodeBlendTree" load_steps=6 format=3 uid="uid://m85b1gogdums"]

[sub_resource type="AnimationNodeAnimation" id="1"]
animation = &"Grip"
Expand Down Expand Up @@ -29,4 +29,4 @@ nodes/OpenHand/node = SubResource("3")
nodes/OpenHand/position = Vector2(-600, 100)
nodes/Trigger/node = SubResource("5")
nodes/Trigger/position = Vector2(-360, 40)
node_connections = [&"output", 0, &"Grip", &"Grip", 0, &"Trigger", &"Grip", 1, &"ClosedHand2", &"Trigger", 0, &"OpenHand", &"Trigger", 1, &"ClosedHand1"]
node_connections = [&"Grip", 0, &"Trigger", &"Grip", 1, &"ClosedHand2", &"Trigger", 0, &"OpenHand", &"Trigger", 1, &"ClosedHand1", &"output", 0, &"Grip"]
38 changes: 37 additions & 1 deletion addons/godot-xr-tools/materials/highlight.tres
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[gd_resource type="ShaderMaterial" format=3 uid="uid://dyuaw57o8y3i"]
[gd_resource type="ShaderMaterial" load_steps=7 format=3 uid="uid://dyuaw57o8y3i"]

[sub_resource type="VisualShaderNodeColorParameter" id="VisualShaderNodeColorParameter_nl6jr"]
parameter_name = "Color"
Expand All @@ -16,6 +16,42 @@ constant = 0.1
operator = 2

[sub_resource type="VisualShader" id="VisualShader_wb0u4"]
code = "shader_type spatial;
render_mode blend_mix, depth_draw_opaque, cull_back, diffuse_lambert, specular_schlick_ggx;

uniform vec4 Color : source_color;



void fragment() {
// ColorParameter:2
vec4 n_out2p0 = Color;


// FloatConstant:4
float n_out4p0 = 0.100000;


// VectorOp:3
vec3 n_out3p0 = vec3(n_out2p0.xyz) * vec3(n_out4p0);


// Fresnel:5
float n_in5p3 = 1.00000;
float n_out5p0 = pow(1.0 - clamp(dot(NORMAL, VIEW), 0.0, 1.0), n_in5p3);


// VectorOp:6
vec3 n_out6p0 = vec3(n_out2p0.xyz) * vec3(n_out5p0);


// Output:0
ALBEDO = n_out3p0;
EMISSION = n_out6p0;


}
"
nodes/fragment/0/position = Vector2(660, 60)
nodes/fragment/2/node = SubResource("VisualShaderNodeColorParameter_nl6jr")
nodes/fragment/2/position = Vector2(40, 40)
Expand Down
Loading
Loading