Forum rules - please read before posting.

Facing hotspots using head pos rather than feet pos

edited December 2020 in Technical Q&A

Sometimes the player faces the wrong way when looking at hotspot (with player action "turn to face"). I suspect it is because the players base pivot is used as the reference point between the player and the hotspot?

It would be great if we could assign a Game Object on a character to be the "facing origin". Or if I the character has a speak position specified, maybe that could be used automatically?

I'm not using any special head turning, I'm talking about the whole body facing a hotspot :)

Thanks!

Comments

  • You need to approach it from the other way around - as a property of the Hotspot, not the character.

    Assume the Hotspot's "look at" position is on the ground. You can override the centre-point in the Hotspot Inspector.

    Doing it this way allows for all characters to face a given Hotspot in the same way, regardless of their height.

  • Ok, here's an example taken when the player is looking at a Portal hotspot:
    https://1drv.ms/u/s!Amz_vh8OYDX3vNFICIfBwrK1yMdPCw?e=azCcHN

    1. The center point of the Portal hotspot
    2. The pivot of the player (that seems to be used when calculating face direction)
    3. The point I wish to use when calculating face direction
  • edited December 2020

    Changing the hostpots center point doesn't fix the issue. It is already set to the center of the portal. And should be there because it is, well, the center (and I show an icon there when the player holds down space to show all hotspots).

    If we only take the hotspots center point into consideration, any hotspot with a center position will always be looked at from the players feet.

    Besides, if no center point is specified, the player is facing the horizontal and vertical center of the hotspot collider rather than the horizontal center and vertical bottom which should be the case if the idea is to match the players feet with the root of the hotspot.

  • edited December 2020

    Relying on the relative screen position between the Hotspot and the character's head alone isn't enough.

    If the Player were to look at the drawer on the right in your screenshot, you'd want them to face up-right, not down-right - which is where they would face if relying on their head position.

    This is the problem when a purely 2D game tries to fake the presence of depth, which is why it's my opinion is that the best approach is to treat both the character and the position they should face as having the same altitude.

    To me, it seems the real issue is not being able to separate the facing position from the icon position. If you assign a Centre point (override) Transform, I shall provied an option to choose whether this override the icon position, facing position, or both.

    In the case of the portal, you'd then have the Hotspot's Transform centre be at its base (the Collider's centre need not be the same as the Transform's position), and have a Centre-point in the middle that then only overrides the Icon position.

  • If the Player were to look at the drawer on the right in your screenshot, you'd want them to face up-right, not down-right - which is where they would face if relying on their head position.

    That's a good point.

    To me, it seems the real issue is not being able to separate the facing position from the icon position. If you assign a Centre point (override) Transform, I shall provied an option to choose whether this override the icon position, facing position, or both.

    In the case of the portal, you'd then have the Hotspot's Transform centre be at its base (the Collider's centre need not be the same as the Transform's position), and have a Centre-point in the middle that then only overrides the Icon position.

    Yeah, that might be enough to solve it, I'm not sure what you mean by "have the Hotspot's Transform centre be at its base", though.

    Perhaps an intuitive solution could be to keep "Center point (override)" as it works today, and if that doesn't result in the ideal icon position, we can also specify a "Icon point (override)"?

  • edited December 2020

    I'd prefer not to over-clutter the Inspector with Transform fields, when the position of the override, and the Hotspot itself, should be enough to cover bases.

    I'm not sure what you mean by "have the Hotspot's Transform centre be at its base", though.

    I mean to have the Hotspot's origin (actual Transform position) be where you want the character to face (with his feet, so at the base of the portal), and then reshape the Hotspot's collider / reposition the override to match the sprite.

    Of course, with the ability to have the override only affect the facing position, you could alternatively have the Hotspot's origin be in the centre of the sprite (presumably where you'd want the icon to be), and then place a centre-point at the base to override the facing position.

  • edited December 2020

    I see what you mean, looking forward to trying it out 👍

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.