mirror of
https://github.com/godotengine/godot-demo-projects.git
synced 2026-01-04 06:09:46 +03:00
Minor typo and style fixes for the IK demo
This commit is contained in:
@@ -320,12 +320,12 @@ func chain_apply_rotation():
|
||||
|
||||
# A bit of a hack. Because we only have two bones, we have to use the previous
|
||||
# bone to position the last bone in the chain.
|
||||
var last_bone = bone_nodes[i-1].global_transform;
|
||||
var last_bone = bone_nodes[i-1].global_transform
|
||||
# Because we know the length of adjacent bone to this bone in the chain, we can
|
||||
# position this bone by taking the last bone's position plus the length of the
|
||||
# bone on the Z axis.
|
||||
# This will place the position of the bone at the end of the last bone
|
||||
bone_trans.origin = last_bone.origin - last_bone.basis.z.normalized() * bones_in_chain_lengths[i-1];
|
||||
bone_trans.origin = last_bone.origin - last_bone.basis.z.normalized() * bones_in_chain_lengths[i-1]
|
||||
|
||||
# If this is NOT the last bone in the bone chain, rotate the bone to look at the next
|
||||
# bone in the bone chain.
|
||||
|
||||
@@ -10,14 +10,14 @@ export(bool) var use_our_rotation_y = false
|
||||
export(bool) var use_our_rotation_z = false
|
||||
export(bool) var use_negative_our_rot = false
|
||||
export(Vector3) var additional_rotation = Vector3()
|
||||
export (bool) var position_using_additional_bone = false
|
||||
export (String) var additional_bone_name = ""
|
||||
export (float) var additional_bone_length = 1
|
||||
export(bool) var debug_messages = false
|
||||
|
||||
var skeleton_to_use
|
||||
var first_call = true
|
||||
|
||||
export (bool) var position_using_additional_bone = false
|
||||
export (String) var additional_bone_name = ""
|
||||
export (float) var additional_bone_length = 1
|
||||
var _editor_indicator = null
|
||||
|
||||
|
||||
func _ready():
|
||||
@@ -131,9 +131,9 @@ func update_skeleton():
|
||||
func _setup_for_editor():
|
||||
# So we can see the target in the editor, let's create a mesh instance,
|
||||
# Add it as our child, and name it
|
||||
var indicator = MeshInstance.new()
|
||||
add_child(indicator)
|
||||
indicator.name = "(EditorOnly) Visual indicator"
|
||||
_editor_indicator = MeshInstance.new()
|
||||
add_child(_editor_indicator)
|
||||
_editor_indicator.name = "(EditorOnly) Visual indicator"
|
||||
|
||||
# We need to make a mesh for the mesh instance.
|
||||
# The code below makes a small sphere mesh
|
||||
@@ -150,7 +150,7 @@ func _setup_for_editor():
|
||||
indicator_material.albedo_texture = preload("editor_gizmo_texture.png")
|
||||
indicator_material.albedo_color = Color(1, 0.5, 0, 1)
|
||||
indicator_mesh.material = indicator_material
|
||||
indicator.mesh = indicator_mesh
|
||||
_editor_indicator.mesh = indicator_mesh
|
||||
|
||||
|
||||
func _set_update(new_value):
|
||||
|
||||
@@ -95,7 +95,6 @@ __meta__ = {
|
||||
skeleton_path = NodePath("../../../BattleBot/Armature/Skeleton")
|
||||
bones_in_chain = PoolStringArray( "Left_UpperArm", "Left_LowerArm" )
|
||||
bones_in_chain_lengths = PoolRealArray( 1.97, 3 )
|
||||
chain_iterations = 10
|
||||
limit_chain_iterations = false
|
||||
use_middle_joint_target = true
|
||||
|
||||
|
||||
Reference in New Issue
Block a user