Not Reproducible

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

mode80 2 months ago in Game Creator updated by Marti (Lead Developer) 1 month ago 6

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!

Not Reproducible

Hi Mode80;

I've been trying to reproduce this issue, but everything seems to be in order. I'm attaching a screenshot showing our setup. If yours differs, let us know and we'll take another thorough look.

This basically makes the Invoker (we're clicking on the Play button of the Action, so Invoekr is the object itself) turn towards the value of the Local Variable called "target".


Hm. Ok, since I've found a workaround, I'd call this low priority unless someone else has a similar issue. For reference my setup is below.

Above actions script is triggered by a modified IgniterPlayerStayTimout type trigger that I needed to work with non players. 

You can see it references a Local Variables component (shown below), which lives on its parent game object called "AI", where it gets the thisCharacter and currentOpponent game objects as the "Target" and "Look at Position" respectively. (Side note: the convention of calling the host gameobject "target" is especially misleading in the context of this action.)

I'm not sure that helps but like I said, can be low priority. 

Hi Mode80. Thanks for getting back and posting the work around. However, I'm still unsure where the problem is. Isn't retrieving the Local Variable's value working fine then?

Sorry what I posted was not my workaround, but rather a more detailed look at the broken setup. I've changed so much since then that I don't think I can help narrow it down further. Maybe it's best to mark this closed unless someone else encounters it. 

Hi! Despite this, I've fixed a critical bug related to how Local Variables get their value. There was an edge case with the Invoker that fits this particular case.

It should be fixed in version 1.1.2. If you still encounter it, feel free to reopen the topic :-)