Opening Containers

  • #1, by GlenfxMonday, 11. April 2016, 04:30 4 years ago
    Hey guys, It's been a LOOONG time since I used visionaire and I can't remember some stuff and I think i'm mixing some procedures from other applications and it's bugging me a bit.

    So I have a question about object containers like trunks or trap doors.

    I have an object in a scene composed of a couple of pieces, so there is the static body and the lid on top of it. The lid has an animation of it opening so I call/play this animation in a frame of the character's open lid animation so his motion and the lid play at the right time.

    This works quite well but I have two problems that I don't know if I'm solving in the best or right way.

    First problem is when the lid animation is played, the closed static image of the lid is still being displayed, so In the first frame of the lid's animation I added an action of "set object visibility" to 0%, this seems like a solution since affects the image and not the animation of the same object, though I don't know if there is a more practical or simple solution to it (or if im doing it all wrong).

    Second problem is, after the animation plays, the lid disappears, and I want to keep the last frame of the animation visible, so i want to have the animation stop at the last frame and still see it. But I don't see a "stop animation" action, there is a play/hide action, but I need a "stop animation" action, I can't seem to find it in the list.

    To solve this I created a new object with the last frame of the lid's animation and a condition set to false in it's properties, and this one gets visible by changing the condition to true in the last frame of the lid animation and it works but now I have an extra lid object in the scene.

    So in the end every cabinet, trunk, or any object that opens up has TWO objects, one for the closed state and animation and another one for the opened state... is this the standard/correct procedure?.

    Newbie

    71 Posts


  • #2, by sebastianMonday, 11. April 2016, 06:31 4 years ago
    Yes, its one possible solution.

    What you can also try is:

    Create 3 animations:

    Open lid

    Lid closed (only 1 frame, infinite playing, high delay)

    Lid open (only 1 frame, infinite playing, high delay)

    Set the closed animation as default animation for the object. The object itself has no image.

    When opening the lid: hide closed animation, play open animation and wait, play open animation (dont wait), toggle condition
    When closing the lid: hide open animation, play open animation (reversed) and wait, play closed animation (dont wait), toggle condition

    Thread Captain

    2337 Posts

  • #3, by GlenfxMonday, 11. April 2016, 06:40 4 years ago
    That's quite an interesting idea, I will have to try it. Thank you for the suggestion.

    Newbie

    71 Posts

  • #4, by sebastianMonday, 11. April 2016, 07:25 4 years ago
    Oh, i just saw that i mentioned open animation and open a imation which are 2 different things xD
    The open animation with the wait is an opening animation smile

    Thread Captain

    2337 Posts

  • #5, by afrlmeMonday, 11. April 2016, 12:48 4 years ago
    You can also force which frames to loop in a animation.
    ActiveAnimations["test"].AnimationFirstFrame = 1 -- set the initial frame to loop from
    ActiveAnimations["test"].AnimationLastFrame = 1 -- set the frame to loop to
    1
    2
    3

    You can specify any 2 frames in your animations this way & as long as the animation loop amount is set to infinite it will permanently display those frames until you either change them via an execute a script action part or hide the animation manually with play / hide animation action part (or Lua).

    In regards to adding animations to objects containing static images... for some reason VS seems to randomly hide the images automatically when you play an animation that you added inside of the same object & sometimes it doesn't hide the image. I'm not really sure why it does that - it would be nice if there was an option as there's certain situations where you need it to do one thing or the other.

    Imperator

    6842 Posts

  • #6, by GlenfxMonday, 11. April 2016, 17:14 4 years ago
    Thank you AFRLme, I will try achieving it without using code since i'm helping out a friend and he has a really hard time understanding/using scripts and I want to avoid that.

    Sebastian.204, haha no worries, I think I understood the idea, I will be trying it out later today.

    Newbie

    71 Posts

  • #7, by afrlmeMonday, 11. April 2016, 18:10 4 years ago
    Ok dokie. No worries mate.

    What Sebastian said is perfectly valid. You can do that with a single object or you can spread it over multiple scene objects & control them with conditions - inside a single object would be better though.

    Imperator

    6842 Posts

Write post