khanat-client/ressources/scripts/entity.gd

30 lines
870 B
GDScript3
Raw Normal View History

2020-03-21 09:10:26 +00:00
extends Spatial
export(bool) var gravity_enabled = true
var creature = null
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:
child.translate( m_movment )
# child.move_and_slide( m_movment, Vector3( 0.0, 1.0, 0.0 ) )
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 )