Under review

When using ActionLookAt to look in the direction of a LocalVariable object, the character looks to the center of the screen instead.

mode80 2 weeks ago in Game Creator updated by Marti (Lead Developer) 2 weeks ago 1

When using ActionLookAt, if lookAtPosition is specified in the editor as a LocalVariable holding an object, then the following line inside ActionLookAt.cs, gets back (0,0,0) from the call in first parameter. As a result, the character ends up turning toward the center of the screen instead. 

targetTrans.LookAt(lookAtPosition.GetPosition(target), Vector3.up);

Tracing through , it appears that it's failing inside TargetPosition.cs at the switch statement on line 120 where it fails to match any of the case options. (it should go into case GameObject)

switch (this.local.GetDataType(invoker))

I think this comes from "invoker ambiguity" where the invoker inside of ActionLookAt.cs is assumed to be the thing being looked at. However that's not where the LocalVariable lives, and GetDataType in the switch statement assumes it does. 

Making GameObject the default case in the switch statement makes it work, but that's probably not the best solution. 

Unity version:
2018 LTS
Game Creator version:
Under review

Hi Mode80, this definitely seems like a bug. I'm opening a ticket to have a look at it. We'll circle back when we get hands on it. Cheers!