Home Unreal Engine

actors, skeletal meshes, trigger volumes, blueprint

Mcbeardo
polycounter lvl 4
Offline / Send Message
Mcbeardo polycounter lvl 4
Hello and hi

I have been fiddling with unreal for a short period of time. 
Now i wanna learn to make gameplay happen. 

Like put box on button to activate a windmill that activates a raft (once activated will loop forever) that the player then can use to move cross the water. 
That's what i wanna do.

So far ive managed to get the trigger volume to activate the raft to go to its end location, but that's it. 

i had a stupid notion that its better to rig models then import them and be able to control them a lot more by using joints.
Sadly it feels like its even more difficult since i don't know if i should treat the prop actor as a character or not.
To me all i want to do is activate the windmill when i hit the trigger volume and then activate  the raft to go in a loop back and forth.

Feeling unsure on what's the good practice here. 

I have googled and youtubed and tried to find anything in the wiki but there isn't anything on this type blueprinting. 

Here are the skeleton meshes i was to activate by a trigger volume. 

https://youtu.be/loda5IYKfzo

Ill gladly take links, explanations, screenshots, feedback and what not. :)
Thanks in advance. 




Replies

  • Obscura
    Options
    Offline / Send Message
    Obscura grand marshal polycounter
    You do not neecessarily need to use skeletal meshes for this kind of stuff, and I would maybe even advice against it in a lot of cases. Simulated movelemt would not play well with character movement. I would likely push you out with a big impulse in a lot of cases. What you can do, is to import the moving parts separately, assemble it in blueprints, add collision boxes, and use a timeline based animation. This is how they usually do moving platforms for example. It could also be a matinee or sequence though but if its multiple differently moving parts, I'd just go with a timeline. And apply math based motion on the static mesh components. Pivot points needs to be placed smartly, they should be at the location where you would put a bone in the case of skeletal mesh.

    For triggering them:

    You would probably want reusable actros in your game, so you could make like "interactive bridge" actor that has an "open" and "close" custom event, and some parameters to adjust the motion etc. Then, you could also have a specific trigger volume, that can trigger interactive bridges. You could also have "interactive moving object" class instead of moving bridge one and then from this point its much easier to get correct references to man different actors, but it makes thinking about the base class much harder. Still worth the time thinking about it... So lets say you only made interactive bridge and not a shared base class. Then you would have an actor with the trigger volume, lets say it triggers on overlapping with the player. It should have a variable that is a type of your moving bridge reference. You make it public, so you can edit its value per instance in the level. You place one bridge actor and one of this trigger. You pick (eyedrop icon next to the exposed variable on the details panel) the bridge as the reference in the level. The trigger actor would have an overlap event where it would call open or close even on the bridge. Having the direct reference to the bridge that you picked in the editor per instance would allow you to access those events easily on an instance that you want.

    I have a breakdown of such an approach but from what I see now I made it pretty much the other way around, but it doesn't matter, you could do it both ways, check out this thread - second page, after the middle of the page:
    http://polycount.com/discussion/157279/the-wonders-of-technical-art-unreal-engine#latest

    Hope this helps.

  • Mcbeardo
    Options
    Offline / Send Message
    Mcbeardo polycounter lvl 4
    well i am at a loss so yeah anything is better then nothing. :D Its shame of wasting purdy models on nothing :D And really thanks for the info and input Obscura, i'm gonna dig in deep with this. I have been reading up on blueprints but, there's so many nodes and that's the biggest issue for me, i don't know what my options are or what nodes there i and which ones to use in different circumstances.  But if i can get this to work, i will have come a "long" way from where i was :D Ill keep posting here for the progress.  Again, thanks man!
  • Obscura
    Options
    Offline / Send Message
    Obscura grand marshal polycounter
    You're welcome. I also have 3 beginner level blueprints tutorials, some of them could be useful for you I think. Not direct application but bits and pieces of it:

    http://polycount.com/discussion/158846/ue4-technical-tutorials-chapter-1-custom-hp-bar-damage-heal#latest
    http://polycount.com/discussion/158863/ue4-technical-tutorials-chapter-2-healer-pad-custom-actors-actor-components#latest
    http://polycount.com/discussion/160680/ue4-technical-tutorials-chapter-3-usage-of-custom-actors-design#latest

    I'm showing some examples of blueprints communication when you don't have direct references because you need to get them at runtime or is unknown.

  • Mcbeardo
    Options
    Offline / Send Message
    Mcbeardo polycounter lvl 4
    the problem i've found is that a lot is different in unreal since 2015. like A LOT. Many things are removed or in someways placed elsewhere. Hence iam wondering if your tuts are up to date?:dizzy:

    I have been looking into the sequenser but most ppl seem to be using the matinee for a lot of things. ITs scarce with tuts on the sequenser. 

    I need of course all those things.  i just havent worked on them in that order. i just wanna get going with the puzzles,. and if its fun ill continue else ill do something else. :D

    Il ldo your tuts. maybe something will land :P Thanks again man! 
  • Obscura
    Options
    Offline / Send Message
    Obscura grand marshal polycounter
    I quickly checked out what did I use in those tuts and I can reassure you, all of those nodes are called the same, still. Except the custom events, since you name those to whatever you want.

    Matinee/Sequencer/Timeline anime - for what you want to use it for, I would definitely go with a timeline and no matinee or sequencer.
  • Mcbeardo
    Options
    Offline / Send Message
    Mcbeardo polycounter lvl 4
    So " I wanted the circle to be green when the player is healthy, and red, when its dying, so I did a lerp between red and green, based on a collection parameter, called "hp". A collection parameter is a parameter that can be accessed by blueprints, and can be changed dynamically. I used a power on this value, because I wanted the color to go non-linearly..."
    I am getting an error  in the 
    in the collection parameter, but its due to the fact i havent added any data inside it.  what do i add in there? iam getting an direct error on the collection parameter. i think ive done as u done but it does not look it. 
    :D
  • Mcbeardo
    Options
    Offline / Send Message
    Mcbeardo polycounter lvl 4
    So i made the button trigger animation as a bp instead of using the level sequenser.

    And it works. Now how do i reference the bridge bp inside the button bp. 

    Bridge bp not working but i dont know since i cant trigger it:P
    Its just that connection i need.


  • Mcbeardo
    Options
    Offline / Send Message
    Mcbeardo polycounter lvl 4
    And i have tried most nodes, and google doesn't wanna talk about this subject much either :/
  • Obscura
    Options
    Offline / Send Message
    Obscura grand marshal polycounter
    You can just make a public variable. As I mentioned earlier, if its public, you can pick it with the eyedropper when the actor is placed in the level and selected. You will see the public variable on the details panel.
     This way you can set up which button trigger which bridges for example. Or like in my main thread, you can have an array or references so it triggers multiple. There are a couple of images there like this:

    http://polycount.com/discussion/157279/the-wonders-of-technical-art-unreal-engine#latest

    This does the same thing, its done with using a public array.

    parameter collection -> use a simple scalar parameter instead, and you can change its value in bp with "set scalar parameter value" - not the collection one.

     If you are still unable to reference it for some reason, I can take a some time into this and make an example tomorrow.

  • Mcbeardo
    Options
    Offline / Send Message
    Mcbeardo polycounter lvl 4
    well iam noob to blueprinting so ill take any help i can get. Since this seems like a very complex thing. 
    trigger with static mesh that animates looking like a pressed down button thats an bp wich will be moveble anywhere in the game. 
    Connect that trigger button to the interactive bridge through the variable "interactivebridge" in the trigger button bp referencing the bridge bp. 
    Starting the timeline animation of "lowering" the bridge down and then stops and stays down. 

    To me, its easier to maybe do it in the level sequencer, but then i cant rotate the bridge actor cause that seems to mess up the rotation on the pieces of the bridge static mesh making it not play using the transformation values/location values. And besides i just wanna drag and drop 1 actor instead of selecting 3-5 static mesh pieces. anytime. 

    Good practice is good practice, and its hard learning it. :p 


  • Mcbeardo
    Options
    Offline / Send Message
    Mcbeardo polycounter lvl 4
    I am using ver 4.14.3 but i have no issues using the latest if that would be better. 

    still on healthbar 1 tut: 

    I created custom events, Damage & Health. made them into functions, but i cant attach the player reference to the damage and the heal target since it does not accept that playerbp reference connection. 

    Cast to player
    Here there are several cast to, but none named cast to player. i tried using cast to player state but its not working either.  

    Both of those are criticial to progress, i assume its also shit behind the stick so to speak. :p 
    Will continue on with the struggle, google and view the documentation. but its all scrambled and hard getting a clearity on it. 


  • Obscura
    Options
    Offline / Send Message
    Obscura grand marshal polycounter
    As I said, I'll get back to all of these later today and make you a working example in a way that you want your one. I'm at work currently...
  • Mcbeardo
    Options
    Offline / Send Message
    Mcbeardo polycounter lvl 4
    haha thanks man, have a good one. 
  • Obscura
    Options
    Offline / Send Message
    Obscura grand marshal polycounter
    Alright, here it is. I didn't actually make fancy doors and whatnot, this is more about the idea behind this whole thing. I'll try to describe what happens on each shot, and I'll also provide a video showing it working, plus the source files for the project so you can download it and examine yourself. It requires 4.16.1 or newer version.

    Wanted logic:

    - There is the player, it has an integer variable in it that we will want to modify through another actors later.
    - There is a trigger, when the player starts overlapping with it, the trigger will call a custom event in a third actor
    - There is a third actor that has a custom event to modify the int value in the player - this class isn't necessary, I made it to show better how to make like a chain reaction between different classes, and also to have more examples of blueprints communication in this explanation. This whole thing could be done with just the player and the trigger.


    Implementation:

    1.
    I started with the trird actor that will actually modify the players int value. 


    This actor has a cube as visual representation, but this is only for demonstration purposes to make the actor visible, its not necessary to do this. 

    Important - When you want to modify or call something in an actor,  you need to have an exact reference to tell it which placed instance to "talk to". To get a reference to the current player ID 0, you can use "get player character". This will return you something that is a "character" class, and its also the locally controller player char. I used a custom player character class, it inherits from character, this is why the cast will work from a "character" class reference, because basically my custom char is a child class of character. So I do get player char -> cast to my own character class, and I store it in a variable, as a reference to the player.  Cast to can give you exact references. Input object can be a parent class. I don't really want to talk much more about this now, its a bit more complicated than this when its a random actor with some class, get the basics first.

    Since we want to add some integer value to the players integer variable, I also added an integer variable, that is public, so when I place this actor in the level, I can manually set its value. This means I could place 2 of this, and they could add different values to the players int.

    On triggered, I print out who triggered it because why not, and then I call "AddToNumber" on the player.



    2. 

    Next step is to make the trigger class that will be able to call the "triggered" event in any triggerable actor. I also wanted to allow this actor to be triggered only by the local player, and nothing else so I again get a reference to the player on event begin play. Its important to note that if you implement respawning and stuff like that, You will need to get new reference on each respawn since the player won't be the same actor anymore. 

    I added a variable that is a type of my triggerable actor, and made it public, so again, it can be set on the placed instances - hand pick it. Then on the overlap event of the collision volume of this actor, I call if it was the player, it will call "triggered" on the given triggerable actor.



    3. 

    The player...


    Not much needs to be explained here, "AddToNumber" event adds the input of the event to the players current integer variable.

    Here is the whole thing in action, see the logs from the print string:
    https://www.youtube.com/watch?v=dWpUsXjrtc0&feature=youtu.be

    Here are the project files:
    https://www.dropbox.com/s/a2tffapenkdsihm/ReferencesTutorial.zip?dl=0

    Hope this clears out everything. Have fun!


    Note - I only implemented "wasd" movement and no turning with the mouse, so don't expect it to work. This is all for demonstrationg communication between different classes.


  • Obscura
    Options
    Offline / Send Message
    Obscura grand marshal polycounter
    You could also use functions or macros instead of events. The main difference between them is that some of them can be reused, some of them can't, and some of them can be executed over multiple frames (uses delay) and anothers cant.

    - event: can be executed over multiple frames, but can't be reused in another classes. 
    - function: can't be executed over multiple frames, and can't be reused in another classes.
    - macro: can be executed over multiple frames, and can be reused (you can have a macro library)

    The best one in these blueprints in this tutorial above would be functions because I didn't use delays, nor reusing of the logic. But basically any of these three can work.
  • Mcbeardo
    Options
    Offline / Send Message
    Mcbeardo polycounter lvl 4
    wow, ill dig in and hopefully i have something to show tomorrow. probobly not though:P But man You explain very well. A good teacher. I will get the latest version since it seems to have things id wanna test out later. Again thanks for taking the time! 
  • Mcbeardo
    Options
    Offline / Send Message
    Mcbeardo polycounter lvl 4
    Allright, i have followed and set up all the nodes. 
    Its difficult as hell to be honest. 

    Here goes. 

    These are the names i work with.
    My custom Player class =PhysicsBallBp
    Bp_trigger= ButtonBp
    Bp_Triggerable_actor= BridgeBp

    warnings: In both buttonbp & bridgebp the cast to PhysicsBallBp gives the warning:

    Warning 'Physics Ball BP' does not inherit from 'Character' ( Cast To PhysicsBallBP  would always fail).

    So in Bp_trigger= ButtonBp the cast to is casting to the playerbp (where the movement set up is located) & (in the bridgeBp, the cast node is set up to the playerbp aswell.) I assume this is wrong.  Since when i play it, nothing happens when i hit the buttonBp trigger. 


    As for the rest the most challenging part was getting the correct pins on the nodes.





  • Obscura
    Options
    Offline / Send Message
    Obscura grand marshal polycounter
    Ball should be made from character instead of pawn and then it the cast would work. Or instead of using get player character, there is get player pawn.  You can also plug the player into anything. For example, when the player goes into the trigger, player will also give you an overlap. On that overlap, you can get the overlapping actor from the overlap node, check if its your trigger class, and if it is, cast to your trigger class. The object going into your trigger class would be the overlapping actor coming from the overlap, and on the cast you can set the player variable. This is like doing it the other way around - instead of getting the player in the trigger, the player plugs himself into the trigger.
  • Mcbeardo
    Options
    Offline / Send Message
    Mcbeardo polycounter lvl 4
    Instead of using "get player character" there was a "get player pawn", and i plugged that, and the "cast to´s" warning went away. :)

             Again, iam truly grateful for the help and feedback! 

    When i hit play in the editor, i was blessed with a little special something in the editors output.

    Error Blueprint Runtime Error: Accessed None trying to read property ActorToTrigger from function: 'ExecuteUbergraph_Button_Bp' from node: Triggered in graph: EventGraph in object: Button_Bp with description: Accessed None trying to read property ActorToTrigger

    So thats my question to you, inside the My custom Player class =PhysicsBallBp

    what am i suppose to connect to the "set number" node. thats where its an issue right its not connected. 

    oh and also from the branch node in buttonbp  ive set the

    oncomponentbeginoverlap (button, trigger) > branch true > timeline "button pressed down anime" play
    oncomponentbeginoverlap (button, trigger) other actor > math equal to > branch
    player ref >math equal to
    But what am i suppose to connect to the branch false?
    When PIE´d. the button disappears totally and the bridge is still static and not triggered.  Also I got like 160 "playineditor" errors :P 





  • Mcbeardo
    Options
    Offline / Send Message
    Mcbeardo polycounter lvl 4
    So i wanted to show you. 

    Theres the button bp, when pressed start timeline animation and then trigger bridge bp .
    I think iam a little more bald now but it feels like i just had some really good sex. But better. 
    Next in line is to make it so i can push a box onto the button and activate it like that. 

    This was really tricky for me, but it feels i got know blueprinting a helluva lot more now. 

    I do however get a warning in the button bp. 


    And thats how i did it. 

  • Obscura
    Options
    Offline / Send Message
    Obscura grand marshal polycounter
    Why are you casting to that poor anim bp? :) That doesn't do anything for you. You get warning because anim bp doesn't inherit ( not a child class of) from actor class. Anyways, I'm glad you finally got it working, keep going!

    Hopefully this will clear out this casting a little bit:
    https://docs.unrealengine.com/latest/INT/Engine/Blueprints/UserGuide/CastNodes/

    Basically this is necessary when 2 totally different classes wants to access functionality or variables from / in each other. But please read the doc page, it will help.
  • Mcbeardo
    Options
    Offline / Send Message
    Mcbeardo polycounter lvl 4
    haha poor anim bp? Oh i think its suppose to be the thirdperson bp ahah that migth explain the error i guess:p 

    I have 1 thing i want to add as well to this whole thing and that's to either change material when bridge bp is activated. Cause i have 2 - 3 rolling hoops that have an animated texture. i am considering removing that though just so i dont have to bother with it.

    But then i feel like a bitch and don't really want to make anything really suffer due to incompetence from my part.  And something i personally love in games, its when its mechanical thingymajigs with several parts reacting to what the player does. 

    So what i did was that i separated the rolling hoops from the base mesh, the part where the animated parts are attached to. 
    So i can make either a new bp on the rolling hoop static mesh Or at least reference it. 

    So i found a tutorial on how to change the material from a non animated one to the animated one.  

    Made two materials, one not animated and one with the panner node. 
    and when player presses the button and activates the bridge coming down, i want this to activate as well.  but no matter where i connect the animated material node it just sticks with the non animated material.

    I can make this change with an event by itself, but since its connected to the bridge animation, i thought it would be best to add the material change the to the bridge bp. 

    Is it best to just make a bp and then cast to that from the bridge bp. 
Sign In or Register to comment.