mirror of
https://port.numenaute.org/aleajactaest/khanat-client.git
synced 2024-11-17 04:52:01 +00:00
30 lines
870 B
GDScript3
30 lines
870 B
GDScript3
|
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 )
|