Forum rules - please read before posting.

Aligning objects in player animations with scene objects 2D

edited April 24 in Technical Q&A

I am using Sprites Unity Complex to animate my character. I want to play object-specific animations when the character interacts with objects. The game is 2D.

For example, the scene object is a wire sticking out of a wall. I want the Character to move to the wire, grab it, pull it several times, rip it out, and put it in his pocket. The whole interaction would be a specific Character animation, including the image of the wire. Ideally, once the animation is triggered, the scene object would disappear, with only its animation counterpart visible, so the transition would appear smooth.

But I need to somehow align the position of the wire in the animation with the sprite of the wire in the scene. This would require setting a Hotspot marker correctly in a very specific position. Also, I would have to account for the sorting map influencing the scale of the Character, including its animation. This creates quite a complicated and laborious situation.

Does AC provide any solution for this?
Or does anyone please have any tips or better ideas on how to do this?

Comments

  • The best way to sync different object animations together is often to use Unity's Timeline feature, which AC can control via the Engine: Control Timeline Action.

    For the scaling: you can use the Follow Sorting Map component's Edit-mode preview option to give the character the correct scale while moved in Edit mode, ready to be animated.

  • edited April 25

    I think I didn't explain it properly. The timeline function you talk about seems to be more for cutscenes, but I am looking for common gameplay usage. For picking up items and otherwise interacting with the environment.

    I have an Item object on the scene. It can be picked up. I also have a specific Character animation for picking up this item. I need to somehow align the sprite of the item with the part of the specific Character animation that includes this item (so f.e. a sprite of a football placed on a scene aligned with the sprite of a football that is being picked up as part of the character animation - I want the Character to come to a football and pick it up and put it in his pocket).

    The Follow Sorting map does not seem to affect objects - is there any other way for Scene items to be affected by sorting map scaling? I need the objects to follow the scale of the Character rather than the other way around.

    Would there perhaps be a way of previewing the Character in a certain animation frame while placing a Marker on the scene in Editor? So I can align that with the item sprite?

  • The timeline function you talk about seems to be more for cutscenes, but I am looking for common gameplay usage. For picking up items and otherwise interacting with the environment.

    Timeline is essentially a way of running multiple animation tracks together - regardless of their length. It's a valid option for basic interactions, not limited to "proper" cutscenes.

    Either way, you'll first need to make sure your character is standing in the correct place. Use of the Object: Teleport Action, to fix the Player to the intended Marker, would be recommended to ensure their position is exact. If this causes a slight glitch because they were previously standing "close by" the Marker, you can configure AC to give more precise movement - see the Manual's "Precision movement" chapter for details.

    Follow Sorting Map isn't intended for static objects that don't need to change their scale dynamically. You can build the animation at 1:1 scale, and then resize the e.g. football in the scene to match the scale the character has when standing at the Marker.

    It's a visual question, so any screenshots you can share to help illustrate the situation will be welcome.

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.