Fix division by zero error in platformer
This commit is contained in:
parent
ad8b0fbeb4
commit
cdbb53c1c2
|
@ -120,7 +120,9 @@ func _physics_process(delta):
|
|||
var mesh_xform = get_node("Armature").get_transform()
|
||||
var facing_mesh = -mesh_xform.basis[0].normalized()
|
||||
facing_mesh = (facing_mesh - up*facing_mesh.dot(up)).normalized()
|
||||
facing_mesh = adjust_facing(facing_mesh, target_dir, delta, 1.0/hspeed*turn_speed, up)
|
||||
|
||||
if (hspeed>0):
|
||||
facing_mesh = adjust_facing(facing_mesh, target_dir, delta, 1.0/hspeed*turn_speed, up)
|
||||
var m3 = Basis(-facing_mesh, up, -facing_mesh.cross(up).normalized()).scaled(CHAR_SCALE)
|
||||
|
||||
get_node("Armature").set_transform(Transform(m3, mesh_xform.origin))
|
||||
|
|
Loading…
Reference in New Issue