2020-03-21 09:10:26 +00:00
|
|
|
extends Spatial
|
|
|
|
|
2020-03-26 09:39:29 +00:00
|
|
|
var Creature = preload( "res://ressources/scripts/creatures.gd" )
|
|
|
|
|
2020-03-21 09:10:26 +00:00
|
|
|
export(bool) var gravity_enabled = true
|
|
|
|
|
|
|
|
var creature = null
|
|
|
|
|
2020-03-27 11:43:49 +00:00
|
|
|
var is_moving = false
|
|
|
|
|
|
|
|
#func _process( delta ):
|
|
|
|
# if self.gravity_enabled and $model:
|
|
|
|
# for child in $model.get_children():
|
|
|
|
# if child is KinematicBody:
|
|
|
|
# child.move_and_slide( Vector3( 0.0, -9.81, 0.0 ), Vector3( 0.0, 1.0, 0.0 ), true )
|
2020-03-21 09:10:26 +00:00
|
|
|
|
|
|
|
|
|
|
|
func move( m_movment ):
|
|
|
|
if $model:
|
|
|
|
for child in $model.get_children():
|
|
|
|
if child is KinematicBody:
|
2020-03-26 09:39:29 +00:00
|
|
|
var spatial = Spatial.new()
|
|
|
|
spatial.rotate( Vector3( 0.0, 1.0, 0.0 ), child.rotation.y )
|
|
|
|
spatial.translate( m_movment )
|
|
|
|
child.move_and_slide( spatial.translation*10.0, Vector3( 0.0, 1.0, 0.0 ), true )
|
2020-03-27 11:43:49 +00:00
|
|
|
spatial.queue_free()
|
|
|
|
|
2020-03-21 09:10:26 +00:00
|
|
|
|
|
|
|
func turn( m_rotation ):
|
|
|
|
if $model:
|
|
|
|
for child in $model.get_children():
|
|
|
|
if child is KinematicBody:
|
|
|
|
child.rotate_x( m_rotation.x )
|
|
|
|
child.rotate_y( m_rotation.y )
|
|
|
|
child.rotate_z( m_rotation.z )
|