Skip to content

Commit

Permalink
Renamed files and classes to match new godot-xr-tools standard.
Browse files Browse the repository at this point in the history
  • Loading branch information
Malcolmnixon committed Sep 23, 2022
1 parent 2885db6 commit c0161c7
Show file tree
Hide file tree
Showing 130 changed files with 674 additions and 669 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ nodes/Grip/position = Vector2( 780, 180 )
nodes/Trigger/node = SubResource( 2 )
nodes/Trigger/position = Vector2( 560, 80 )
nodes/output/position = Vector2( 1020, 80 )
node_connections = [ "output", 0, "Grip", "Trigger", 0, "Default", "Trigger", 1, "Fist", "Grip", 0, "Trigger", "Grip", 1, "Fist2" ]
node_connections = [ "output", 0, "Grip", "Grip", 0, "Trigger", "Grip", 1, "Fist2", "Trigger", 0, "Default", "Trigger", 1, "Fist" ]
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

importer="scene"
type="PackedScene"
path="res://.import/LeftHand.glb-7a289350d7a0389e0068af98c6813b91.scn"
path="res://.import/left_hand.glb-54ab35158cb64aaf29610f7be672554e.scn"

[deps]

source_file="res://addons/godot-xr-tools/assets/LeftHand.glb"
dest_files=[ "res://.import/LeftHand.glb-7a289350d7a0389e0068af98c6813b91.scn" ]
source_file="res://addons/godot-xr-tools/assets/left_hand.glb"
dest_files=[ "res://.import/left_hand.glb-54ab35158cb64aaf29610f7be672554e.scn" ]

[params]

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[gd_scene load_steps=4 format=2]

[ext_resource path="res://addons/godot-xr-tools/assets/LeftHand.glb" type="PackedScene" id=1]
[ext_resource path="res://addons/godot-xr-tools/assets/Hand.gd" type="Script" id=2]
[ext_resource path="res://addons/godot-xr-tools/assets/HandBlendTree.tres" type="AnimationNodeBlendTree" id=3]
[ext_resource path="res://addons/godot-xr-tools/assets/left_hand.glb" type="PackedScene" id=1]
[ext_resource path="res://addons/godot-xr-tools/assets/hand.gd" type="Script" id=2]
[ext_resource path="res://addons/godot-xr-tools/assets/hand_blend_tree.tres" type="AnimationNodeBlendTree" id=3]

[node name="LeftHand" type="Spatial"]
script = ExtResource( 2 )
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[gd_scene load_steps=4 format=2]

[ext_resource path="res://addons/godot-xr-tools/assets/LeftHand.tscn" type="PackedScene" id=1]
[ext_resource path="res://addons/godot-xr-tools/assets/HandPhysicsBone.gd" type="Script" id=2]
[ext_resource path="res://addons/godot-xr-tools/assets/PhysicsHand.gd" type="Script" id=3]
[ext_resource path="res://addons/godot-xr-tools/assets/left_hand.tscn" type="PackedScene" id=1]
[ext_resource path="res://addons/godot-xr-tools/assets/hand_physics_bone.gd" type="Script" id=2]
[ext_resource path="res://addons/godot-xr-tools/assets/physics_hand.gd" type="Script" id=3]

[node name="LeftPhysicsHand" instance=ExtResource( 1 )]
script = ExtResource( 3 )
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
tool
class_name PlayerBody, "res://addons/godot-xr-tools/editor/icons/XRToolsBody.svg"
class_name XRToolsPlayerBody, "res://addons/godot-xr-tools/editor/icons/XRToolsBody.svg"
extends Node

##
Expand Down Expand Up @@ -32,7 +32,7 @@ signal player_bounced(collider, magnitude)
const HORIZONTAL := Vector3(1.0, 0.0, 1.0)


## PlayerBody enabled flag
## Player body enabled flag
export var enabled := true setget set_enabled

## Player radius
Expand Down Expand Up @@ -66,25 +66,25 @@ export (int, LAYERS_3D_PHYSICS) var collision_layer = 1 << 19 setget set_collisi
export (int, LAYERS_3D_PHYSICS) var collision_mask = 1023 setget set_collision_mask


## Player Velocity - modifiable by MovementProvider nodes
## Player Velocity - modifiable by movement providers
var velocity := Vector3.ZERO

## Player On Ground flag - used by MovementProvider nodes
## Player On Ground flag - used by movement providers
var on_ground := true

## Ground 'up' vector - used by MovementProvider nodes
## Ground 'up' vector - used by movement providers
var ground_vector := Vector3.UP

## Ground slope angle - used by MovementProvider nodes
## Ground slope angle - used by movement providers
var ground_angle := 0.0

## Ground node the player is touching
var ground_node: Spatial = null

## Ground physics override (if present)
var ground_physics: GroundPhysicsSettings = null
var ground_physics: XRToolsGroundPhysicsSettings = null

## Ground control velocity - modified by MovementProvider nodes
## Ground control velocity - modified by movement providers
var ground_control_velocity := Vector2.ZERO

## Player height offset (for height calibration)
Expand Down Expand Up @@ -258,12 +258,12 @@ func request_jump(var skip_jump_velocity := false):
return

# Skip if jump disabled on this ground
var jump_velocity := GroundPhysicsSettings.get_jump_velocity(ground_physics, default_physics)
var jump_velocity := XRToolsGroundPhysicsSettings.get_jump_velocity(ground_physics, default_physics)
if jump_velocity == 0.0:
return

# Skip if the ground is too steep to jump
var max_slope := GroundPhysicsSettings.get_jump_max_slope(ground_physics, default_physics)
var max_slope := XRToolsGroundPhysicsSettings.get_jump_max_slope(ground_physics, default_physics)
if ground_angle > max_slope:
return

Expand Down Expand Up @@ -345,8 +345,8 @@ func _update_ground_information(delta: float):
ground_node = ground_collision.collider

# Select the ground physics
var physics_node := ground_node.get_node_or_null("GroundPhysics") as GroundPhysics
ground_physics = GroundPhysics.get_physics(physics_node, default_physics)
var physics_node := ground_node.get_node_or_null("GroundPhysics") as XRToolsGroundPhysics
ground_physics = XRToolsGroundPhysics.get_physics(physics_node, default_physics)

# Detect if we're sliding on a wall
# TODO: consider reworking this magic angle
Expand Down Expand Up @@ -385,12 +385,12 @@ func _apply_velocity_and_control(delta: float):
control_velocity = (dir_forward * -ground_control_velocity.y + dir_right * ground_control_velocity.x) * ARVRServer.world_scale

# Apply control velocity to horizontal velocity based on traction
var current_traction := GroundPhysicsSettings.get_move_traction(ground_physics, default_physics)
var current_traction := XRToolsGroundPhysicsSettings.get_move_traction(ground_physics, default_physics)
var traction_factor: float = clamp(current_traction * delta, 0.0, 1.0)
horizontal_velocity = lerp(horizontal_velocity, control_velocity, traction_factor)

# Prevent the player from moving up steep slopes
var current_max_slope := GroundPhysicsSettings.get_move_max_slope(ground_physics, default_physics)
var current_max_slope := XRToolsGroundPhysicsSettings.get_move_max_slope(ground_physics, default_physics)
if ground_angle > current_max_slope:
# Get a vector in the down-hill direction
var down_direction := (ground_vector * HORIZONTAL).normalized()
Expand All @@ -399,7 +399,7 @@ func _apply_velocity_and_control(delta: float):
horizontal_velocity -= down_direction * vdot
else:
# User is not trying to move, so apply the ground drag
var current_drag := GroundPhysicsSettings.get_move_drag(ground_physics, default_physics)
var current_drag := XRToolsGroundPhysicsSettings.get_move_drag(ground_physics, default_physics)
var drag_factor: float = clamp(current_drag * delta, 0, 1)
horizontal_velocity = lerp(horizontal_velocity, control_velocity, drag_factor)

Expand All @@ -414,10 +414,10 @@ func _apply_velocity_and_control(delta: float):
# Detect bounciness
var collision := kinematic_node.get_slide_collision(0)
var collision_node := collision.collider
var collision_physics_node := collision_node.get_node_or_null("GroundPhysics") as GroundPhysics
var collision_physics = GroundPhysics.get_physics(collision_physics_node, default_physics)
var bounce_threshold := GroundPhysicsSettings.get_bounce_threshold(collision_physics, default_physics)
var bounciness := GroundPhysicsSettings.get_bounciness(collision_physics, default_physics)
var collision_physics_node := collision_node.get_node_or_null("GroundPhysics") as XRToolsGroundPhysics
var collision_physics = XRToolsGroundPhysics.get_physics(collision_physics_node, default_physics)
var bounce_threshold := XRToolsGroundPhysicsSettings.get_bounce_threshold(collision_physics, default_physics)
var bounciness := XRToolsGroundPhysicsSettings.get_bounciness(collision_physics, default_physics)
var magnitude := -collision.normal.dot(local_velocity)

# Detect if bounce should be performed
Expand All @@ -432,16 +432,16 @@ func _apply_velocity_and_control(delta: float):

# Get a guaranteed-valid physics
func _guaranteed_physics():
# Ensure we have a guaranteed-valid GroundPhysicsSettings value
var valid_physics := physics as GroundPhysicsSettings
# Ensure we have a guaranteed-valid XRToolsGroundPhysicsSettings value
var valid_physics := physics as XRToolsGroundPhysicsSettings
if !valid_physics:
valid_physics = GroundPhysicsSettings.new()
valid_physics = XRToolsGroundPhysicsSettings.new()
valid_physics.resource_name = "default"

# Return the guaranteed-valid physics
return valid_physics

# This method verifies the PlayerBody has a valid configuration. Specifically it
# This method verifies the player body has a valid configuration. Specifically it
# checks the following:
# - ARVROrigin can be identified
# - ARVRCamera can be identified
Expand Down Expand Up @@ -476,19 +476,19 @@ func _get_configuration_warning():
return "Eyes too far forwards. Move eyes back or decrease camera near clipping plane"

# If specified, verify the ground physics is a valid type
if physics and !physics is GroundPhysicsSettings:
return "Physics resource must be a GroundPhysicsSetting"
if physics and !physics is XRToolsGroundPhysicsSettings:
return "Physics resource must be a GroundPhysicsSettings"

# Passed basic validation
return ""

## Find the Player Body from a player node and an optional path
static func get_player_body(node: Node, path: NodePath = NodePath("")) -> PlayerBody:
var player_body: PlayerBody
static func get_player_body(node: Node, path: NodePath = NodePath("")) -> XRToolsPlayerBody:
var player_body: XRToolsPlayerBody

# Try using the node path first
if path:
player_body = node.get_node(path) as PlayerBody
player_body = node.get_node(path) as XRToolsPlayerBody
if player_body:
return player_body

Expand All @@ -498,13 +498,13 @@ static func get_player_body(node: Node, path: NodePath = NodePath("")) -> Player
return null

# Attempt to get by the default name
player_body = arvr_origin.get_node_or_null("PlayerBody") as PlayerBody
player_body = arvr_origin.get_node_or_null("PlayerBody") as XRToolsPlayerBody
if player_body:
return player_body

# Search all children of the origin for the player body
for child in arvr_origin.get_children():
player_body = child as PlayerBody
player_body = child as XRToolsPlayerBody
if player_body:
return player_body

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[gd_scene load_steps=3 format=2]

[ext_resource path="res://addons/godot-xr-tools/assets/PlayerBody.gd" type="Script" id=1]
[ext_resource path="res://addons/godot-xr-tools/assets/player_body.gd" type="Script" id=1]

[sub_resource type="CapsuleShape" id=1]
radius = 0.4
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

importer="scene"
type="PackedScene"
path="res://.import/RightHand.glb-b0ade3e24442d11ee987628909f601b4.scn"
path="res://.import/right_hand.glb-8f20889edf64365280173e0ad873b53e.scn"

[deps]

source_file="res://addons/godot-xr-tools/assets/RightHand.glb"
dest_files=[ "res://.import/RightHand.glb-b0ade3e24442d11ee987628909f601b4.scn" ]
source_file="res://addons/godot-xr-tools/assets/right_hand.glb"
dest_files=[ "res://.import/right_hand.glb-8f20889edf64365280173e0ad873b53e.scn" ]

[params]

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[gd_scene load_steps=4 format=2]

[ext_resource path="res://addons/godot-xr-tools/assets/HandBlendTree.tres" type="AnimationNodeBlendTree" id=1]
[ext_resource path="res://addons/godot-xr-tools/assets/Hand.gd" type="Script" id=2]
[ext_resource path="res://addons/godot-xr-tools/assets/LeftHand.glb" type="PackedScene" id=3]
[ext_resource path="res://addons/godot-xr-tools/assets/hand_blend_tree.tres" type="AnimationNodeBlendTree" id=1]
[ext_resource path="res://addons/godot-xr-tools/assets/hand.gd" type="Script" id=2]
[ext_resource path="res://addons/godot-xr-tools/assets/left_hand.glb" type="PackedScene" id=3]

[node name="RightHand" type="Spatial"]
script = ExtResource( 2 )
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[gd_scene load_steps=4 format=2]

[ext_resource path="res://addons/godot-xr-tools/assets/RightHand.tscn" type="PackedScene" id=1]
[ext_resource path="res://addons/godot-xr-tools/assets/HandPhysicsBone.gd" type="Script" id=2]
[ext_resource path="res://addons/godot-xr-tools/assets/PhysicsHand.gd" type="Script" id=3]
[ext_resource path="res://addons/godot-xr-tools/assets/right_hand.tscn" type="PackedScene" id=1]
[ext_resource path="res://addons/godot-xr-tools/assets/hand_physics_bone.gd" type="Script" id=2]
[ext_resource path="res://addons/godot-xr-tools/assets/physics_hand.gd" type="Script" id=3]

[node name="RightPhysicsHand" instance=ExtResource( 1 )]
script = ExtResource( 3 )
Expand Down
6 changes: 0 additions & 6 deletions addons/godot-xr-tools/examples/Function_Fall_damage.tscn

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
tool
class_name Function_FallDamage
extends MovementProvider
class_name XRToolsFallDamage
extends XRToolsMovementProvider


##
Expand Down Expand Up @@ -55,7 +55,7 @@ func _ready():
# Set as always active
is_active = true

func physics_movement(delta: float, player_body: PlayerBody, disabled: bool):
func physics_movement(delta: float, player_body: XRToolsPlayerBody, disabled: bool):
# Skip if not enabled
if disabled or !enabled:
_previous_velocity = player_body.velocity
Expand Down
6 changes: 6 additions & 0 deletions addons/godot-xr-tools/examples/fall_damage.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[gd_scene load_steps=2 format=2]

[ext_resource path="res://addons/godot-xr-tools/examples/fall_damage.gd" type="Script" id=1]

[node name="FallDamage" type="Node" groups=["movement_providers"]]
script = ExtResource( 1 )
8 changes: 0 additions & 8 deletions addons/godot-xr-tools/functions/Function_Climb_movement.tscn

This file was deleted.

6 changes: 0 additions & 6 deletions addons/godot-xr-tools/functions/Function_Crouch_movement.tscn

This file was deleted.

11 changes: 0 additions & 11 deletions addons/godot-xr-tools/functions/Function_Direct_movement.tscn

This file was deleted.

6 changes: 0 additions & 6 deletions addons/godot-xr-tools/functions/Function_Flight_movement.tscn

This file was deleted.

8 changes: 0 additions & 8 deletions addons/godot-xr-tools/functions/Function_Glide_movement.tscn

This file was deleted.

This file was deleted.

7 changes: 0 additions & 7 deletions addons/godot-xr-tools/functions/Function_Jump_movement.tscn

This file was deleted.

6 changes: 0 additions & 6 deletions addons/godot-xr-tools/functions/Function_Pickup.tscn

This file was deleted.

6 changes: 0 additions & 6 deletions addons/godot-xr-tools/functions/Function_Turn_movement.tscn

This file was deleted.

6 changes: 0 additions & 6 deletions addons/godot-xr-tools/functions/Function_Wind_movement.tscn

This file was deleted.

Loading

0 comments on commit c0161c7

Please sign in to comment.