Forum rules - please read before posting.

background animations

Hello, here we go again requesting your help Chris! 
I need to run some sprite animations in a scene but those animations should play in a very particular time and stop. The problem is that i have not triggers or hotspot to activate the animation as is an intro scene. 
Imagine a camera pan showing a house in the forest during the night. In some point during the camera movement one window opens to show the house's interior (this is the animation clip that i need to activate). But as there's no player or NPCs in the scene i have no way to activate this via a hotspot or a trigger.
I tried to use the animation as a gameobject and then access it via a cutscene with the Object - Animate actions without luck.
Any idea?
Thank you in advance!!

Comments

  • Adding an Animator component so that you can control it with Object: Animate is indeed the way to go, as you can run this as part of your opening Cutscene.  The bulk of the work with this method involves using Unity's Mecanim system, so make sure you've got that working before trying to change your Mecanim window's parameters with the Action.
  • edited March 2016
    Hello Chris, thank you for your help dude! I'm still confused. I already made my player character with the unity sprite method, should i change it to mecanim also in order to have object animate working for the background anims? I'm working with 2d sprites
    Tnx!!
  • If the background and player are separate objects, they can have separate animation engines - your player can still be Sprites Unity, regardless of the background using Mecanim.
  • Fantastic, thank you Chris!!
  • edited March 2016
    Hello again! Sorry for being so annoying but i have a problem that is driving me crazy. As you suggested i started to use mecanim for my animations.
    So i need to start running an animation at the moment when a 2D trigger collides with a box collider 2d (not the player, just an object called COLISIONADOR).
    So i set up the 2D trigger to change the value of a mecanim animation. The parameter is the STARTER boolean variable in the mecanim.
    But i'm doing something wrong as the 2D trigger is not working, and the new value for the parameter STARTER never changes, no matter what. So the second part of the animation in the mecanim never happens.
    Is ok to put the variable name from the mecanim animation into the Parameter to affect of the trigger? or it's a mistake?

    Maybe anyone can point out what i'm doing wrong. Here's a screen capture of the animator, and the scene.
    Thank you so much!!!

    image
  • Does the "colisionador" object have a Rigidbody2D component attached to it?  At least one of the two objects involved in a trigger detection must have one in order for it to work - see Section 5.6 of the Manual.

    If it does, check to see if the ActionList is being run vs the Action not working by creating a Dialogue: Play speech Action after it to see if that gets run.
  • Hello Chris, thank you for your quick answer!  Not, actually i don't have any rigidbody 2D right now. I was aware of it, i put one, but it didn't work. But i'll try again to be sure.
    Is the way i try to access to the boolean var in the mecanim animation right? I mean from the 
    Trigger, the Parameter to affect is the boolean variable?

    I'll also check the Action List.

    Tnx a zillion!!
  • Hi again! So i tested both things and still not working...maybe the boolean var for the mecanim never gets changed via the trigger...i don't know...

  • Yes, the Action looks correct.  But again - try using a Dialogue: Play speech Action (or something that you know works normally) in the same list to determine whether the Trigger is being run correctly in the first place.
  • Thanks Chris, i'm on it. I'll keep you posted!
  • edited April 2016
    Hello, i'm here again. I started to  reproduce this trigger issue in a simple environment (one player sprite vs a collider) and still doesn't work.
    The player has a simple mecanim animation with two anims (idle and changing color). In a normal situation the player has not changes at all, but when it hits the collider it should activate the second animation component, by changing a bolean parameter and activating the alternative animation.
    But i can't get this variable change from true to false (or viceverza) using the Action Type Object Animate with the Method Change Parameter Value.
    I'm assuming i'm doing something wrong but i can't find the problem...i put the files in my dpbox
    if you're so kind to check it out, thank you so much!

    <REDACTED>
  • edited April 2016
    Please read the forum rules!  Posting links to AC's source code publicly is not tolerated on this forum.  I'll let it go this once and get back to you on this issue, but please do not let this happen again.
  • The issue is that you are using a 3D Trigger to detect a 2D collider.  As your player is 2D, you must use a Trigger 2D prefab - it should be a square rather than a cube.  So long as your Camera perspective in your Settings Manager is 2D then it should be listed correctly in your Scene Manager.  You will have to remove the existing Trigger and replace it.
  • Sorry for the source code Chis, won't happen again. I'll check your solution right now. Once again, thanks a lot for your fast help
  • edited April 2016
    Hello Chris...i followed your suggestion and still can't make it work...
    I have a player (tagged player) with a Rigid Body 2D and a 2D Box Collider and a 2D Collider prefab.
    The idea is to trigger a dialogue when the 2D colliders hits the player...but nothing happens. I also tried to trigger a mecanim animation under the same situation but without luck. I also tried to edit the collider shape to have two boxes (instead of a circle vs a box) but nothing changed.
    Maybe i'm getting it all wrong, i don't know. I tried almost everything... Here's a screen capture of my stuff. 
    I'm sorry to be so annoying man, but this is driving me insane...;)
    image

  • One more thing: i tested the same but from an Cutscene...and guess wath? it works! image
  • The shape of the collider(s) on your Player are unimportant, but one of them must have Is Trigger? checked.  Try dropping the 2D Demo player, Brain2D, in the scene to test with - if it works then, we'll know the problem lies with your player prefab.  Otherwise, it'll be with your scene.
  • Ok, thank you once again. The is trigger option is on for sure.
     i'll test your suggestion and keep you posted! I've been making some custom action scripts to add to the ones you made and the worked perfectly. Great stuff Chris, i'm really enjoying it! Tnx
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.