Prototype 2

This commit is contained in:
Segey Lapin
2019-07-20 04:28:54 +03:00
parent 29dfe621c1
commit 90d2938eca
30 changed files with 34688 additions and 14 deletions

View File

@@ -0,0 +1,47 @@
extends KinematicBody
var orientation: Transform
var velocity: Vector3 = Vector3()
var skel: Skeleton
const GRAVITY = Vector3(0, -9.8, 0)
# Declare member variables here. Examples:
# var a = 2
# var b = "text"
# Called when the node enters the scene tree for the first time.
func _ready():
orientation = Transform()
skel = get_children()[0]
func idle():
var sm: AnimationNodeStateMachinePlayback = $AnimationTree["parameters/base/playback"]
sm.travel("Idle")
func walk():
var sm: AnimationNodeStateMachinePlayback = $AnimationTree["parameters/base/playback"]
sm.travel("Walk")
func set_walk_speed(spd: float):
$AnimationTree["parameters/base/Walk/speed/scale"] = spd
func get_walk_speed() -> float:
return $AnimationTree["parameters/base/Walk/speed/scale"]
# Called every frame. 'delta' is the elapsed time since the previous frame.
#func _process(delta):
# pass
func _process(delta):
orientation = global_transform
orientation.origin = Vector3()
var sm: AnimationNodeStateMachinePlayback = $AnimationTree["parameters/base/playback"]
var rm = $AnimationTree.get_root_motion_transform()
orientation *= rm
var h_velocity = orientation.origin / delta
velocity.x = h_velocity.x
velocity.z = h_velocity.z
if !is_on_floor():
velocity += GRAVITY * delta
velocity = move_and_slide(velocity, Vector3(0, 1, 0))
if is_in_group("master"):
orientation *= controls.frame_tf
controls.frame_tf = Transform()
orientation.origin = Vector3()
orientation = orientation.orthonormalized()
global_transform.basis = orientation.basis
skel.rotation = Vector3()

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,66 @@
[gd_scene load_steps=14 format=2]
[ext_resource path="res://characters/female_2018.escn" type="PackedScene" id=1]
[sub_resource type="AnimationNodeAdd2" id=1]
[sub_resource type="AnimationNodeAnimation" id=2]
animation = "stand"
[sub_resource type="AnimationNodeAnimation" id=3]
animation = "additive-wiggling-loop"
[sub_resource type="AnimationNodeBlendTree" id=4]
nodes/Add2/node = SubResource( 1 )
nodes/Add2/position = Vector2( 580, 120 )
nodes/Animation/node = SubResource( 3 )
nodes/Animation/position = Vector2( 100, 260 )
"nodes/Animation 2/node" = SubResource( 2 )
"nodes/Animation 2/position" = Vector2( 120, 100 )
nodes/output/position = Vector2( 1020, 160 )
node_connections = [ "output", 0, "Add2", "Add2", 0, "Animation 2", "Add2", 1, "Animation" ]
[sub_resource type="AnimationNodeAnimation" id=5]
animation = "walk-loop"
[sub_resource type="AnimationNodeTimeScale" id=6]
[sub_resource type="AnimationNodeBlendTree" id=7]
nodes/Animation/node = SubResource( 5 )
nodes/Animation/position = Vector2( 80, 120 )
nodes/TimeScale/node = SubResource( 6 )
nodes/TimeScale/position = Vector2( 400, 120 )
nodes/output/position = Vector2( 820, 160 )
node_connections = [ "output", 0, "TimeScale", "TimeScale", 0, "Animation" ]
[sub_resource type="AnimationNodeStateMachineTransition" id=8]
[sub_resource type="AnimationNodeStateMachineTransition" id=9]
[sub_resource type="AnimationNodeStateMachine" id=10]
states/Idle/node = SubResource( 4 )
states/Idle/position = Vector2( 194, 105 )
states/Walk/node = SubResource( 7 )
states/Walk/position = Vector2( 344, 217 )
transitions = [ "Idle", "Walk", SubResource( 8 ), "Walk", "Idle", SubResource( 9 ) ]
start_node = "Idle"
[sub_resource type="AnimationNodeBlendTree" id=11]
graph_offset = Vector2( 0, -268.75 )
nodes/base/node = SubResource( 10 )
nodes/base/position = Vector2( 80, 140 )
nodes/output/position = Vector2( 420, 140 )
node_connections = [ "output", 0, "base" ]
[sub_resource type="AnimationNodeStateMachinePlayback" id=12]
[node name="female_2018" index="0" instance=ExtResource( 1 )]
[node name="AnimationTree" type="AnimationTree" parent="." index="1"]
tree_root = SubResource( 11 )
anim_player = NodePath("../female_2018/AnimationPlayer")
active = true
root_motion_track = NodePath(".:root")
parameters/base/playback = SubResource( 12 )
parameters/base/Idle/Add2/add_amount = 0.3
parameters/base/Walk/TimeScale/scale = 1.0

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long