I decided to do what I had done on PlayCanvas in the Godot Engine. I made a project and added the models from Kenney but realized that these were in the FBX format so I needed to convert them (edit: They also have GLB versions I just had FBX since that’s what I used for PlayCanvas), I went with using GLB models which were more in line with open source but, after watching this guide on using Scene Trees, I caame to the realization that the animations were not repeating I found this intereating tidbit which meant that I had to import the GLB into the scene, instance it then edit its AnimationPlayer (which is denied unless you do the Animation Player -> Animation -> Manage Animation -> Click Save on the Global animation -> Click on the Save icon -> Select Make Unique
for the first item, it doesn’t appear to change anything but it works), the funny part was trying to hardcode it and failing since having an Animation Tree will always override your Animation Player meaning that no, animation.loop_mode = Animation.LOOP_LINEAR
will not work.
Here’s the resulting Movement.gd:
extends Node3D
@onready var animation_tree = $AnimationTree
@export var SPEED : float = 0.1
var isRunning : bool = false
var z = 0
var x = 0
func _input(event):
if event.is_action_pressed('ui_up'):
z = 1
elif event.is_action_pressed('ui_down'):
z = -1
elif event.is_action_released('ui_up') or event.is_action_released('ui_down'):
z = 0
if event.is_action_pressed('ui_right'):
x = -1
elif event.is_action_pressed('ui_left'):
x = 1
elif event.is_action_released('ui_left') or event.is_action_released('ui_right'):
x = 0
func _ready():
pass
func _physics_process(delta):
isRunning = false
if x != 0 and z != 0:
isRunning = true
if z > 0:
$Rig.rotation_degrees = Vector3(0, x * 45, 0)
else:
$Rig.rotation_degrees = Vector3(0, -x * (180+45), 0)
elif x != 0:
$Rig.rotation_degrees = Vector3(0, x * 90, 0)
isRunning = true
elif z > 0:
$Rig.rotation_degrees = Vector3(0, 0, 0)
isRunning = true
elif z < 0:
$Rig.rotation_degrees = Vector3(0, 180, 0)
isRunning = true
position += Vector3(x * SPEED, 0, z * SPEED)
update_animation_tree(delta)
func update_animation_tree(delta):
animation_tree['parameters/conditions/isIdle'] = !isRunning
animation_tree['parameters/conditions/isRunning'] = isRunning
The performance is spectacular as is usual with Godot. No need to switch browsers.