Merge branch 'master' of https://gitlab.hexaquo.at/ggjg20/bodypartfighter
This commit is contained in:
commit
7e7cffab61
@ -1,32 +1,48 @@
|
|||||||
extends Spatial
|
extends Spatial
|
||||||
|
|
||||||
const ROT_MOD = 10
|
const ROT_MOD = 500
|
||||||
|
const ROT_DECLINE = 0.1
|
||||||
|
|
||||||
var _viewRot = false
|
var _viewRot = false
|
||||||
var _prev_mouse_pos
|
var _prev_mouse_pos
|
||||||
|
|
||||||
|
var _velx = 0
|
||||||
|
var _vely = 0
|
||||||
|
|
||||||
|
var _torso : RigidBody
|
||||||
|
|
||||||
# Called when the node enters the scene tree for the first time.
|
# Called when the node enters the scene tree for the first time.
|
||||||
func _ready():
|
func _ready():
|
||||||
PhysicsServer.area_set_param(get_viewport().find_world().get_space(), PhysicsServer.AREA_PARAM_GRAVITY, 0)
|
PhysicsServer.area_set_param(get_viewport().find_world().get_space(), PhysicsServer.AREA_PARAM_GRAVITY, 0)
|
||||||
|
_torso = get_node("Torso")
|
||||||
|
|
||||||
|
func _process(delta):
|
||||||
func _physics_process(delta):
|
|
||||||
if _viewRot:
|
if _viewRot:
|
||||||
var mouse_pos = get_viewport().get_mouse_position()
|
var mouse_pos = get_viewport().get_mouse_position()
|
||||||
|
|
||||||
var x_dif = mouse_pos.x - _prev_mouse_pos.x
|
_velx = (mouse_pos.x - _prev_mouse_pos.x) * delta
|
||||||
var y_dif = mouse_pos.y - _prev_mouse_pos.y
|
_vely = (mouse_pos.y - _prev_mouse_pos.y) * delta
|
||||||
|
|
||||||
print (x_dif)
|
|
||||||
print (y_dif)
|
|
||||||
|
|
||||||
rotate_x(x_dif * ROT_MOD * delta * PI/180 - global_transform.basis.get_euler().y)
|
|
||||||
rotate_y(y_dif * ROT_MOD * delta * PI/180 - global_transform.basis.get_euler().y)
|
|
||||||
|
|
||||||
_prev_mouse_pos = mouse_pos
|
_prev_mouse_pos = mouse_pos
|
||||||
|
|
||||||
|
if not(_velx < 0.001 and _velx > -0.001) or not(_vely < 0.001 and _vely > -0.001) or _viewRot:
|
||||||
|
_torso.rotate_x(_vely * ROT_MOD * delta * PI/180 - global_transform.basis.get_euler().x)
|
||||||
|
_torso.rotate_y(_velx * ROT_MOD * delta * PI/180 - global_transform.basis.get_euler().y)
|
||||||
|
|
||||||
|
var decline = (1 - ROT_DECLINE * (delta*100))
|
||||||
|
|
||||||
|
if decline > 1:
|
||||||
|
decline = 1
|
||||||
|
elif decline < 0:
|
||||||
|
decline = 0
|
||||||
|
|
||||||
|
_velx *= decline
|
||||||
|
_vely *= decline
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
func _physics_process(delta):
|
||||||
|
pass
|
||||||
# Get the camera
|
# Get the camera
|
||||||
#var camera = get_node("GUI/HBoxC/ViewportContainer/Viewport/Camera")
|
#var camera = get_node("GUI/HBoxC/ViewportContainer/Viewport/Camera")
|
||||||
|
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
extends "res://Ingame/BodyParts/PushingBodyPart.gd"
|
extends PushingBodyPart
|
||||||
|
|
||||||
|
|
||||||
# Declare member variables here. Examples:
|
onready var anim = get_node("Mesh/AnimationPlayer")
|
||||||
# var a: int = 2
|
|
||||||
# var b: String = "text"
|
|
||||||
|
|
||||||
|
|
||||||
# Called when the node enters the scene tree for the first time.
|
# Called when the node enters the scene tree for the first time.
|
||||||
@ -11,6 +9,14 @@ func _ready() -> void:
|
|||||||
pass # Replace with function body.
|
pass # Replace with function body.
|
||||||
|
|
||||||
|
|
||||||
|
func action():
|
||||||
|
anim.play("ArmatureAction001")
|
||||||
|
|
||||||
|
|
||||||
|
func push(body):
|
||||||
|
# TODO: Hardcoded values - maybe try to generalize
|
||||||
|
base.apply_impulse(transform.basis.xform(Vector3(0.0, 0.0, -3.0)), base.transform.basis.y * 10.0)
|
||||||
|
|
||||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
#func _process(delta: float) -> void:
|
#func _process(delta: float) -> void:
|
||||||
# pass
|
# pass
|
||||||
|
@ -2,30 +2,7 @@
|
|||||||
|
|
||||||
[ext_resource path="res://Ingame/BodyParts/PushingBodyPart.tscn" type="PackedScene" id=1]
|
[ext_resource path="res://Ingame/BodyParts/PushingBodyPart.tscn" type="PackedScene" id=1]
|
||||||
[ext_resource path="res://3D Input/untitled.glb" type="PackedScene" id=2]
|
[ext_resource path="res://3D Input/untitled.glb" type="PackedScene" id=2]
|
||||||
|
[ext_resource path="res://Ingame/BodyParts/Arm.gd" type="Script" id=3]
|
||||||
[sub_resource type="GDScript" id=1]
|
|
||||||
script/source = "extends PushingBodyPart
|
|
||||||
|
|
||||||
|
|
||||||
onready var anim = get_node(\"Mesh/AnimationPlayer\")
|
|
||||||
|
|
||||||
|
|
||||||
# Called when the node enters the scene tree for the first time.
|
|
||||||
func _ready() -> void:
|
|
||||||
pass # Replace with function body.
|
|
||||||
|
|
||||||
|
|
||||||
func action():
|
|
||||||
anim.play(\"ArmatureAction001\")
|
|
||||||
|
|
||||||
|
|
||||||
func push(body):
|
|
||||||
base.apply_impulse(touch_area.transform.origin, base.transform.basis.y * 6.0)
|
|
||||||
|
|
||||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
|
||||||
#func _process(delta: float) -> void:
|
|
||||||
# pass
|
|
||||||
"
|
|
||||||
|
|
||||||
[sub_resource type="SphereShape" id=4]
|
[sub_resource type="SphereShape" id=4]
|
||||||
|
|
||||||
@ -33,7 +10,7 @@ func push(body):
|
|||||||
radius = 0.591769
|
radius = 0.591769
|
||||||
|
|
||||||
[node name="Arm" instance=ExtResource( 1 )]
|
[node name="Arm" instance=ExtResource( 1 )]
|
||||||
script = SubResource( 1 )
|
script = ExtResource( 3 )
|
||||||
|
|
||||||
[node name="PartCollider" parent="." index="0"]
|
[node name="PartCollider" parent="." index="0"]
|
||||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -8 )
|
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -8 )
|
||||||
@ -41,6 +18,9 @@ shape = SubResource( 4 )
|
|||||||
|
|
||||||
[node name="Mesh" parent="." index="1" instance=ExtResource( 2 )]
|
[node name="Mesh" parent="." index="1" instance=ExtResource( 2 )]
|
||||||
|
|
||||||
|
[node name="Skeleton" parent="Mesh/Armature" index="0"]
|
||||||
|
bones/2/bound_children = [ NodePath("BoneAttachment") ]
|
||||||
|
|
||||||
[node name="BoneAttachment" type="BoneAttachment" parent="Mesh/Armature/Skeleton" index="1"]
|
[node name="BoneAttachment" type="BoneAttachment" parent="Mesh/Armature/Skeleton" index="1"]
|
||||||
transform = Transform( 1, -1.98247e-23, -2.98292e-24, 6.50669e-24, -9.49949e-08, 1, -2.07684e-23, -1, -9.49949e-08, -2.23781e-16, -0.0078205, -5.05441 )
|
transform = Transform( 1, -1.98247e-23, -2.98292e-24, 6.50669e-24, -9.49949e-08, 1, -2.07684e-23, -1, -9.49949e-08, -2.23781e-16, -0.0078205, -5.05441 )
|
||||||
bone_name = "bone_2"
|
bone_name = "bone_2"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user