Forum rules - please read before posting.

parallax+teleport doesn't seem to work

Hello there,

I am pretty new to unity and Adventure Creator (which is a wonderful tool, thanks Chris !).
I am encountering a problem in the making of my first 2D project and would appreciate some help.
Unity version : 2021.2.7f1
Adventure Creator is up to date (1.75.4).

Here is the thing :

My project is made of a big illustration, divided into layers that all use AC's parallax effect.

Basically, I want a chosen object to blink when clicked, in the middle of camera movements and dialogue.
To have the object blinking, I created a small animation of the object colored to my liking, and moved it outside the scope of the main camera.

Here, the scene, with the animated objects to be teleported inside the screen stored outside of view, specifically, the gun, top left :
https://ibb.co/30zYMvL

You click, the engine zooms in, some dialogue occurs, the blinking animation is teleported, the game waits for a bit, and teleports the animation back outside of the screen to another marker, and moves on to dialogue, and camera movements.

The object blinks, everything works. That's cool.

That is, until I add a parallax effect.

Every layer in my project involves layers moving using the parallax effect from AC, the trigger being the cursor's movement.

Whenever I add this effect to the blinking animation, it simply doesn't show up on teleport.

The coordinates of the animated layer don't seem to change during the action.

The animated blinking layer uses the same parallax settings as the "normal" layer it will overlap.

If I leave parallax everywhere but on the blinking layer, this animation is teleported normally to the marker I created, but due to the lack of parallax (compared to what's under), it will not be aligned with the underneath layer.

I also tried using another parallax script I found online, and the result is different, somewhat better, but still not what I expect. When using this other script, the animated blinking layer shows very briefly, incorrectly aligned, and disappears.

_The zoomed in part of the image, with the gun that should blink yellow in a second : _
https://ibb.co/MVP7DV3

_The zoomed in part + the blinking layer teleported on spot, but misaligned since I deactivated the parallax effect for this animated part : _
https://ibb.co/DYWTwbD

_The actions : _
https://ibb.co/8BpNkr8

I hope everything is clear and that I simply missed something or that this can be fixed one way or another.
Best,

tengu

Comments

  • Welcome to the community, @tengu.

    The Parallax2D component works by taking control over the position of whichever object it's attached to, so you'll get a conflict if you try to reposition that same object by other means, e.g. via the "Object: Teleport" Action.

    If you moved the sprite itself to a child object (so that the root has the Parallax2D component, the child has the Sprite Renderer / Animator), you can then move the sprite object independently of the Parallax2D component's effects.

    Alternatively, you could hide the gun by animating the "enabled" state of the Sprite Renderer. Rather than teleporting it off-screen when you want it hidden, disabling the Sprite Renderer will prevent if from being renderered. This could be incorporated into your existing Animator.

    Alternatively still - if you need it to remain in the same on-screen position - you should be able to do away with the Parallax2D component and instead parent the Marker to your MainCamera. That way, it will always appear in the same screen position no matter where the camera is at the time.

  • Hey Chris,

    Thank you very much for your swift reply.
    I put back in place the animated layer, replaced the teleport action with visibility, and made sur my animation was alternating between sprite/no sprite (previously, one of these was blinking with a sprite renderer check/uncheck, and that does the trick.

    I think I'm getting the hang of it, there are many different ways to achieve something, really cool !
    have a nice day,

    tengu

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.