Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added alternative hand models #243

Merged
merged 17 commits into from
Nov 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
7bd08cd
Added alternative hand models
DigitalN8m4r3 Nov 4, 2022
7baadb7
Updated with right hand shading fixed and animations seperated into .…
DigitalN8m4r3 Nov 4, 2022
e09d1b2
Improve transparency settings and add unshaded settings
BastiaanOlij Nov 5, 2022
82cc227
Merge pull request #244 from BastiaanOlij/unshaded_viewport
BastiaanOlij Nov 6, 2022
2180b94
added alternative hands to interactable/pickable/climbing-gliding sce…
DigitalN8m4r3 Nov 6, 2022
f38ff79
Added hand_material_override export property to XRToolsHand script. (…
Malcolmnixon Nov 7, 2022
82d96b7
Modified XRToolsFunctionTeleport to get the origin and camera from AR…
Malcolmnixon Nov 7, 2022
9c928ff
Added alternative hand models
DigitalN8m4r3 Nov 4, 2022
3c84c0f
Updated with right hand shading fixed and animations seperated into .…
DigitalN8m4r3 Nov 4, 2022
18f7c56
added alternative hands to interactable/pickable/climbing-gliding sce…
DigitalN8m4r3 Nov 6, 2022
c78b0ee
Updated with
DigitalN8m4r3 Nov 7, 2022
fb78b66
Merge branch 'hands_alternative' of https://github.com/DigitalN8m4r3/…
DigitalN8m4r3 Nov 7, 2022
0918581
Update CONTRIBUTORS.md
DigitalN8m4r3 Nov 7, 2022
a022584
removed the old left_hand.blend1 from the hands main folder and moved…
DigitalN8m4r3 Nov 7, 2022
20cb2e4
Merge branch 'hands_alternative' of https://github.com/DigitalN8m4r3/…
DigitalN8m4r3 Nov 7, 2022
64b8408
final update
DigitalN8m4r3 Nov 7, 2022
553208b
Update pickable_demo.tscn
DigitalN8m4r3 Nov 7, 2022
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
1 change: 1 addition & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@ Other people who have helped out by submitting fixes, enhancements, etc are:
- [Malcolm Nixon](https://github.com/malcolmnixon)
- [Sam Sarette](https://github.com/lunarcloud)
- [Henodude](https://github.com/Henodude)
- [Miodrag Sejic](https://github.com/DigitalN8m4r3)

Want to be on this list? We would love your help.
70 changes: 56 additions & 14 deletions addons/godot-xr-tools/assets/hand.gd
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,46 @@ class_name XRToolsHand, "res://addons/godot-xr-tools/editor/icons/hand.svg"
extends Spatial


## XR Tools Hand Script
##
## XR Hand Script
##
## @desc:
## This script manages a godot-xr-tools hand. It animates the hand blending
## grip and trigger animations based on controller input.
##
## Additionally the hand script detects world-scale changes in the ARVRServer
## and re-scales the hand appropriately so the hand stays scaled to the
## physical hand of the user.
##
## This script manages a godot-xr-tools hand. It animates the hand blending
## grip and trigger animations based on controller input. Additionally the
## hand script detects world-scale changes in the XRServer and re-scales the
## hand appropriately so the hand stays scaled to the physical hand of the
## user.


# Signal emitted when the hand scale changes
## Signal emitted when the hand scale changes
signal hand_scale_changed(scale)


## Override the hand material
export (Material) var hand_material_override setget set_hand_material_override


# Last world scale (for scaling hands)
var _last_world_scale : float = 1.0

## Initial hand transform (from controller) - used for scaling hands
var _transform : Transform

## Hand mesh
var _hand_mesh : MeshInstance


## Called when the node enters the scene tree for the first time.
func _ready() -> void:
# Save the initial hand transform
_transform = transform

# Capture the initial transform
onready var _transform : Transform = transform
# Find the hand mesh and update the hand material
_hand_mesh = _find_mesh_instance(self)
_update_hand_material_override()


# Called every frame. 'delta' is the elapsed time since the previous frame.
## This method is called on every frame. It checks for world-scale changes and
## scales itself causing the hand mesh and skeleton to scale appropriately.
## It then reads the grip and trigger action values to animate the hand.
func _process(_delta: float) -> void:
# Scale the hand mesh with the world scale. This is required for OpenXR plugin
# 1.3.0 and later where the plugin no-longer scales the controllers with
Expand All @@ -53,3 +67,31 @@ func _process(_delta: float) -> void:

# var grip_state = controller.is_button_pressed(JOY_VR_GRIP)
# print("Pressed: " + str(grip_state))


## Set the hand material override
func set_hand_material_override(material : Material) -> void:
hand_material_override = material
if is_inside_tree():
_update_hand_material_override()


func _update_hand_material_override() -> void:
if _hand_mesh:
_hand_mesh.material_override = hand_material_override


func _find_mesh_instance(node : Node) -> MeshInstance:
# Test if the node is a mesh
var mesh := node as MeshInstance
if mesh:
return mesh

# Check all children
for i in node.get_child_count():
mesh = _find_mesh_instance(node.get_child(i))
if mesh:
return mesh

# Could not find mesh
return null
34 changes: 13 additions & 21 deletions addons/godot-xr-tools/functions/function_teleport.gd
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,15 @@ extends KinematicBody
# should really change this to Spatial once #17401 is resolved


## XR Tools Function Teleport Script
##
## Teleport Function Script
##
## @desc:
## This script provides teleport functionality.
##
## Add this scene as a sub scene of your ARVRController node to implement
## a teleport function on that controller.
## This script provides teleport functionality.
##
## Add this scene as a sub scene of your ARVRController node to implement
## a teleport function on that controller.


## Teleport enabled property
## If true, teleporting is enabled
export var enabled : bool = true setget set_enabled

## Teleport allowed color property
Expand Down Expand Up @@ -45,9 +42,6 @@ export (int, LAYERS_3D_PHYSICS) var valid_teleport_mask : int = ~0
# once this is no longer a kinematic body, we'll need this..
# export (int, LAYERS_3D_PHYSICS) var collision_mask = 1

## Camera node path
export var camera : NodePath

## Teleport button
export (XRTools.Buttons) var teleport_button : int = XRTools.Buttons.VR_TRIGGER

Expand Down Expand Up @@ -80,8 +74,9 @@ func _ready():
if Engine.editor_hint:
return

# We should be a child of an ARVRController and it should be a child or our ARVROrigin
origin_node = get_node("../..")
# Get the origin and camera
origin_node = ARVRHelpers.get_arvr_origin(self)
camera_node = ARVRHelpers.get_arvr_camera(self)

# It's inactive when we start
$Teleport.visible = false
Expand All @@ -92,12 +87,6 @@ func _ready():
$Target.mesh.size = Vector2(ws, ws)
$Target/Player_figure.scale = Vector3(ws, ws, ws)

if camera:
camera_node = get_node(camera)
else:
# see if we can find our default
camera_node = origin_node.get_node('ARVRCamera')

# get our capsule shape
collision_shape = $CollisionShape.shape
$CollisionShape.shape = null
Expand Down Expand Up @@ -312,9 +301,12 @@ func _physics_process(delta):

# This method verifies the teleport has a valid configuration.
func _get_configuration_warning():
if camera == null:
return "You need to assign a camera"
# Verify we're within the tree of an ARVROrigin node
var arvr_origin = ARVRHelpers.get_arvr_origin(self)
if !arvr_origin:
return "This node must be within a branch on an ARVROrigin node"

# Pass basic validation
return ""


Expand Down
17 changes: 17 additions & 0 deletions addons/godot-xr-tools/hands/About.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
The Hand Mesh was made using the Makehuman Community Edition
It was slightly modified inside Blender 3D and textured inside Substance Painter

If there should be concerns regarding License issues
https://github.com/makehumancommunity/makehuman/blob/master/LICENSE.md

under point D of the makehuman communtiy edition license
https://github.com/makehumancommunity/makehuman/blob/master/LICENSE.md#d-concerning-the-output-from-makehuman
As the assets have been released under CC0, there is no limitation on what you can do with this combined output.
The MakeHuman project makes no claim whatsoever over output such as:

Exports to files (FBX, OBJ, DAE, MHX2...)
Exports via direct integration (import via MPFB)
Graphical data generated via scripting or plugins
Renderings
Screenshots
Saved model files
126 changes: 126 additions & 0 deletions addons/godot-xr-tools/hands/License.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
To the extent possible under law, DigitalN8m4r3 aka Miodrag Sejic
has waived all copyright and related or neighboring rights to Hand Models for the Godot XR Tools.
This work is published from: Austria.
Date: 7th November 2022

Creative Commons Legal Code

CC0 1.0 Universal

CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
HEREUNDER.

Statement of Purpose

The laws of most jurisdictions throughout the world automatically confer
exclusive Copyright and Related Rights (defined below) upon the creator
and subsequent owner(s) (each and all, an "owner") of an original work of
authorship and/or a database (each, a "Work").

Certain owners wish to permanently relinquish those rights to a Work for
the purpose of contributing to a commons of creative, cultural and
scientific works ("Commons") that the public can reliably and without fear
of later claims of infringement build upon, modify, incorporate in other
works, reuse and redistribute as freely as possible in any form whatsoever
and for any purposes, including without limitation commercial purposes.
These owners may contribute to the Commons to promote the ideal of a free
culture and the further production of creative, cultural and scientific
works, or to gain reputation or greater distribution for their Work in
part through the use and efforts of others.

For these and/or other purposes and motivations, and without any
expectation of additional consideration or compensation, the person
associating CC0 with a Work (the "Affirmer"), to the extent that he or she
is an owner of Copyright and Related Rights in the Work, voluntarily
elects to apply CC0 to the Work and publicly distribute the Work under its
terms, with knowledge of his or her Copyright and Related Rights in the
Work and the meaning and intended legal effect of CC0 on those rights.

1. Copyright and Related Rights. A Work made available under CC0 may be
protected by copyright and related or neighboring rights ("Copyright and
Related Rights"). Copyright and Related Rights include, but are not
limited to, the following:

i. the right to reproduce, adapt, distribute, perform, display,
communicate, and translate a Work;
ii. moral rights retained by the original author(s) and/or performer(s);
iii. publicity and privacy rights pertaining to a person's image or
likeness depicted in a Work;
iv. rights protecting against unfair competition in regards to a Work,
subject to the limitations in paragraph 4(a), below;
v. rights protecting the extraction, dissemination, use and reuse of data
in a Work;
vi. database rights (such as those arising under Directive 96/9/EC of the
European Parliament and of the Council of 11 March 1996 on the legal
protection of databases, and under any national implementation
thereof, including any amended or successor version of such
directive); and
vii. other similar, equivalent or corresponding rights throughout the
world based on applicable law or treaty, and any national
implementations thereof.

2. Waiver. To the greatest extent permitted by, but not in contravention
of, applicable law, Affirmer hereby overtly, fully, permanently,
irrevocably and unconditionally waives, abandons, and surrenders all of
Affirmer's Copyright and Related Rights and associated claims and causes
of action, whether now known or unknown (including existing as well as
future claims and causes of action), in the Work (i) in all territories
worldwide, (ii) for the maximum duration provided by applicable law or
treaty (including future time extensions), (iii) in any current or future
medium and for any number of copies, and (iv) for any purpose whatsoever,
including without limitation commercial, advertising or promotional
purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
member of the public at large and to the detriment of Affirmer's heirs and
successors, fully intending that such Waiver shall not be subject to
revocation, rescission, cancellation, termination, or any other legal or
equitable action to disrupt the quiet enjoyment of the Work by the public
as contemplated by Affirmer's express Statement of Purpose.

3. Public License Fallback. Should any part of the Waiver for any reason
be judged legally invalid or ineffective under applicable law, then the
Waiver shall be preserved to the maximum extent permitted taking into
account Affirmer's express Statement of Purpose. In addition, to the
extent the Waiver is so judged Affirmer hereby grants to each affected
person a royalty-free, non transferable, non sublicensable, non exclusive,
irrevocable and unconditional license to exercise Affirmer's Copyright and
Related Rights in the Work (i) in all territories worldwide, (ii) for the
maximum duration provided by applicable law or treaty (including future
time extensions), (iii) in any current or future medium and for any number
of copies, and (iv) for any purpose whatsoever, including without
limitation commercial, advertising or promotional purposes (the
"License"). The License shall be deemed effective as of the date CC0 was
applied by Affirmer to the Work. Should any part of the License for any
reason be judged legally invalid or ineffective under applicable law, such
partial invalidity or ineffectiveness shall not invalidate the remainder
of the License, and in such case Affirmer hereby affirms that he or she
will not (i) exercise any of his or her remaining Copyright and Related
Rights in the Work or (ii) assert any associated claims and causes of
action with respect to the Work, in either case contrary to Affirmer's
express Statement of Purpose.

4. Limitations and Disclaimers.

a. No trademark or patent rights held by Affirmer are waived, abandoned,
surrendered, licensed or otherwise affected by this document.
b. Affirmer offers the Work as-is and makes no representations or
warranties of any kind concerning the Work, express, implied,
statutory or otherwise, including without limitation warranties of
title, merchantability, fitness for a particular purpose, non
infringement, or the absence of latent or other defects, accuracy, or
the present or absence of errors, whether or not discoverable, all to
the greatest extent permissible under applicable law.
c. Affirmer disclaims responsibility for clearing rights of other persons
that may apply to the Work or any use thereof, including without
limitation any person's Copyright and Related Rights in the Work.
Further, Affirmer disclaims responsibility for obtaining any necessary
consents, permissions or other rights required for any use of the
Work.
d. Affirmer understands and acknowledges that Creative Commons is not a
party to this document and has no duty or obligation with respect to
this CC0 or use of the Work.
76 changes: 76 additions & 0 deletions addons/godot-xr-tools/hands/animations/left/AnimationPlayer.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
[gd_scene load_steps=37 format=2]

[ext_resource path="res://addons/godot-xr-tools/hands/animations/left/Grip 3.anim" type="Animation" id=1]
[ext_resource path="res://addons/godot-xr-tools/hands/animations/left/Grip 4.anim" type="Animation" id=2]
[ext_resource path="res://addons/godot-xr-tools/hands/animations/left/Grip Shaft.anim" type="Animation" id=3]
[ext_resource path="res://addons/godot-xr-tools/hands/animations/left/Grip.anim" type="Animation" id=4]
[ext_resource path="res://addons/godot-xr-tools/hands/animations/left/Grip 5.anim" type="Animation" id=5]
[ext_resource path="res://addons/godot-xr-tools/hands/animations/left/Default pose.anim" type="Animation" id=6]
[ext_resource path="res://addons/godot-xr-tools/hands/animations/left/Cup.anim" type="Animation" id=7]
[ext_resource path="res://addons/godot-xr-tools/hands/animations/left/Grip 1.anim" type="Animation" id=8]
[ext_resource path="res://addons/godot-xr-tools/hands/animations/left/Grip 2.anim" type="Animation" id=9]
[ext_resource path="res://addons/godot-xr-tools/hands/animations/left/Straight.anim" type="Animation" id=10]
[ext_resource path="res://addons/godot-xr-tools/hands/animations/left/Sign 4.anim" type="Animation" id=11]
[ext_resource path="res://addons/godot-xr-tools/hands/animations/left/Sign_Point.anim" type="Animation" id=12]
[ext_resource path="res://addons/godot-xr-tools/hands/animations/left/Sign 2.anim" type="Animation" id=13]
[ext_resource path="res://addons/godot-xr-tools/hands/animations/left/Surfer.anim" type="Animation" id=14]
[ext_resource path="res://addons/godot-xr-tools/hands/animations/left/Thumb.anim" type="Animation" id=15]
[ext_resource path="res://addons/godot-xr-tools/hands/animations/left/Sign 5.anim" type="Animation" id=16]
[ext_resource path="res://addons/godot-xr-tools/hands/animations/left/Sign 3.anim" type="Animation" id=17]
[ext_resource path="res://addons/godot-xr-tools/hands/animations/left/Ring.anim" type="Animation" id=18]
[ext_resource path="res://addons/godot-xr-tools/hands/animations/left/PingPong.anim" type="Animation" id=19]
[ext_resource path="res://addons/godot-xr-tools/hands/animations/left/Rounded.anim" type="Animation" id=20]
[ext_resource path="res://addons/godot-xr-tools/hands/animations/left/Pinch Middle.anim" type="Animation" id=21]
[ext_resource path="res://addons/godot-xr-tools/hands/animations/left/Pinch Tight.anim" type="Animation" id=22]
[ext_resource path="res://addons/godot-xr-tools/hands/animations/left/Horns.anim" type="Animation" id=23]
[ext_resource path="res://addons/godot-xr-tools/hands/animations/left/Middle.anim" type="Animation" id=24]
[ext_resource path="res://addons/godot-xr-tools/hands/animations/left/Pinky.anim" type="Animation" id=25]
[ext_resource path="res://addons/godot-xr-tools/hands/animations/left/Sign 1.anim" type="Animation" id=26]
[ext_resource path="res://addons/godot-xr-tools/hands/animations/left/Metal.anim" type="Animation" id=27]
[ext_resource path="res://addons/godot-xr-tools/hands/animations/left/Hold.anim" type="Animation" id=28]
[ext_resource path="res://addons/godot-xr-tools/hands/animations/left/Peace.anim" type="Animation" id=29]
[ext_resource path="res://addons/godot-xr-tools/hands/animations/left/Pinch Large.anim" type="Animation" id=30]
[ext_resource path="res://addons/godot-xr-tools/hands/animations/left/OK.anim" type="Animation" id=31]
[ext_resource path="res://addons/godot-xr-tools/hands/animations/left/Pinch Ring.anim" type="Animation" id=32]
[ext_resource path="res://addons/godot-xr-tools/hands/animations/left/Pistol.anim" type="Animation" id=33]
[ext_resource path="res://addons/godot-xr-tools/hands/animations/left/Pinch Flat.anim" type="Animation" id=34]
[ext_resource path="res://addons/godot-xr-tools/hands/animations/left/Pinch Up.anim" type="Animation" id=35]
[ext_resource path="res://addons/godot-xr-tools/hands/animations/left/Spread pose.anim" type="Animation" id=36]

[node name="AnimationPlayer" type="AnimationPlayer"]
anims/Cup = ExtResource( 7 )
"anims/Default pose" = ExtResource( 6 )
anims/Grip = ExtResource( 4 )
"anims/Grip 1" = ExtResource( 8 )
"anims/Grip 2" = ExtResource( 9 )
"anims/Grip 3" = ExtResource( 1 )
"anims/Grip 4" = ExtResource( 2 )
"anims/Grip 5" = ExtResource( 5 )
"anims/Grip Shaft" = ExtResource( 3 )
anims/Hold = ExtResource( 28 )
anims/Horns = ExtResource( 23 )
anims/Metal = ExtResource( 27 )
anims/Middle = ExtResource( 24 )
anims/OK = ExtResource( 31 )
anims/Peace = ExtResource( 29 )
"anims/Pinch Flat" = ExtResource( 34 )
"anims/Pinch Large" = ExtResource( 30 )
"anims/Pinch Middle" = ExtResource( 21 )
"anims/Pinch Ring" = ExtResource( 32 )
"anims/Pinch Tight" = ExtResource( 22 )
"anims/Pinch Up" = ExtResource( 35 )
anims/PingPong = ExtResource( 19 )
anims/Pinky = ExtResource( 25 )
anims/Pistol = ExtResource( 33 )
anims/Ring = ExtResource( 18 )
anims/Rounded = ExtResource( 20 )
"anims/Sign 1" = ExtResource( 26 )
"anims/Sign 2" = ExtResource( 13 )
"anims/Sign 3" = ExtResource( 17 )
"anims/Sign 4" = ExtResource( 11 )
"anims/Sign 5" = ExtResource( 16 )
anims/Sign_Point = ExtResource( 12 )
"anims/Spread pose" = ExtResource( 36 )
anims/Straight = ExtResource( 10 )
anims/Surfer = ExtResource( 14 )
anims/Thumb = ExtResource( 15 )
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading