mirror of
https://port.numenaute.org/aleajactaest/khanat-client.git
synced 2024-12-21 00:48:44 +00:00
35 lines
1.1 KiB
GDScript
35 lines
1.1 KiB
GDScript
extends Spatial
|
|
|
|
var Creature = preload( "res://ressources/scripts/creatures_old.gd" )
|
|
|
|
export(bool) var gravity_enabled = true
|
|
|
|
var creature = null
|
|
|
|
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 )
|
|
|
|
|
|
func move( m_movment ):
|
|
if $model:
|
|
for child in $model.get_children():
|
|
if child is KinematicBody:
|
|
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 )
|
|
spatial.queue_free()
|
|
|
|
|
|
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 )
|