Camera Controls


I've added the ability to go back to the previous selected item when you've taken control of a controllable unit.

If you hadn't selected anything it will select the ground.

I also updated the tween and the controllable unit so that mouse movement doesn't work while the tween is active, this should stop the miss-alignment when taking control of a unit.

While doing this I noticed that there was still some miss-alignment so I updated the code to lock things a bit more.

Before:

if target_node.is_in_group("controllable") and new_target == null and not tween.is_active():
  transform.origin = target_node.transform.origin
elif new_target:
  [...]

After:

if target_node.is_in_group("controllable") and new_target == null and not tween.is_active():
  transform.origin = target_node.transform.origin
  transform.basis = target_node.transform.basis
elif new_target:
  [...]

I don't know if this is the right approach but it does the job as far as I can tell so far.

I've also updated this bit of code to set the controllable unit as controlled:

if target_node.is_in_group("controllable") and new_target == null and not tween.is_active():
  target_node.controlled = true
  transform.origin = target_node.transform.origin
  transform.basis = target_node.transform.basis
elif new_target:
  [...]

And then later in the script that gets set to false:

if target_node.is_in_group("controllable") and new_target == null and not tween.is_active():
  [...]
elif new_target:
  [...]
  if old_target and old_target != target:
    var old_target_node = get_node_or_null(old_target)
    if old_target_node.is_in_group("controllable"):
      old_target_node.controlled = false
  [...]

Files

kaiju.x86_64 33 MB
Version 5 May 06, 2021
kaiju.zip 25 MB
Version 5 May 06, 2021
kaiju.exe 33 MB
Version 5 May 06, 2021

Get kaiju

Leave a comment

Log in with itch.io to leave a comment.