Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Rocko Bonaparte
Mar 12, 2002

Every day is Friday!
I think I'm understanding why games don't like to gave players melee spears. I just slammed one in the UE5 3rd-person pawn's right had and now it moves all goofy. I am guessing the spear is causing collision madness and wrecking how the player moves. I assume I have to disable collisions on it or something. That would, like, by the least of my worries though. How would I have the spear slide through the players hands for a thrust? All I have here glues the weapon to a hand and that's that. I also have the figure out how to add animations for working with a spear and two hands; I'd probably want to play with the UE5 mesh for a long time, and I've heard of animation packs that just add new animations, so I'm hoping I can somehow slap that pawn in Blender and add some new animations. Then again, I'd have to do that with a prop spear to make sure they're coherent. Oh boy oh boy!

Adbot
ADBOT LOVES YOU

jizzy sillage
Aug 13, 2006

Yeah disable collision for the spear mesh, author some animations that slide the spear in the characters grip, and if you want the spear to "collide" with something for damage, spawn a hitbox.

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!
How could I add some animations to the default player pawn? I can screw around in Blender a bit, but I don't know if there's some method to be able to monkey with the 3rd person pawn in it to add new animations. I'd assume it wasn't possible, but I saw stuff about packs people have made that have added animations. I have to assume it's a thing in some form or another.

Edit: I guess I could get the mesh as an FBX and just monkey with it? I just assumed with the whole thing with packs adding animations is that they somehow extended the animations to the existing stuff, but I never looked at the details.

Rocko Bonaparte fucked around with this message at 08:15 on Mar 13, 2024

jizzy sillage
Aug 13, 2006

Generally the asset packs on the epic marketplace target the UE4 Mannequin skeleton, so should be drop-in onto that guy. If it's a UE5 project then the new mannequins are Manny and Quinn, who share a skeleton, and Epic have provided a retargeter that will convert a UE4 Mannequin animation to a Manny/Quinn compatible one. There's lots of ways to do that retargeting.

If you're using a custom character with a different skeletal structure, you'll need to retarget marketplace anims yourself.

And yeah, you can export the Manny/Quinn/Mannequins as an .fbx and then animate onto them in Blender or Maya or whatever, there's guides out there on how to do that.

You can also animate onto Manny/Quinn directly in-engine, they come set up for that out of the box.

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!
Is the in-engine tools regarded well enough? I just took that for granted because I'm coming from Unity and just kind of assume everything's poo. I keep getting surprised from that bad assumption.

I'd just gauge it myself but I'm particularly stupid when it comes to the modeling side (I learn a lot about modeling Blender and then it all atrophies. This time I'm intending to integrate into game stuff as I go so it has to stick).

jizzy sillage
Aug 13, 2006

It's workable enough, I think the original thinking was "quick edits without needing to go back to Maya" but with UEFN they're improving a lot of the usability of in-engine workflows (see the 5.4 changes to retargeting to make it basically idiot proof).

Phigs
Jan 23, 2019

Does anyone know how to delete an unloaded actor in unreal 5? Like why can't I just select it and delete it? Anyway...

It was supposed to be a packed level actor, but UE crashed when I was making the blueprint so it won't load, because there's no blueprint. But I can't delete it because it's not loaded. So now it's sitting up there greyed out in my outliner. IS there a way to like go into the map and delete it outside the editor or some other trick?


EDIT: I found the solution! From here https://forums.unrealengine.com/t/world-partition-cannot-delete-unloaded-actors/525969/28 which says you need to enable the "Package Short Name" in the outliner, which displays the name of the uasset file on disk. Then you just search for that in your project's folder and delete the file (they only speculate you can delete it and do some other workaround, but you can just delete it).

I swear half of learning Unreal is learning how to not break it and/or fix it when it breaks. I have no idea why it is so fragile.

Phigs fucked around with this message at 12:54 on Mar 17, 2024

The Oid
Jul 15, 2004

Chibber of worlds

Rocko Bonaparte posted:

How would I have the spear slide through the players hands for a thrust? All I have here glues the weapon to a hand and that's that. I also have the figure out how to add animations for working with a spear and two hands; I'd probably want to play with the UE5 mesh for a long time, and I've heard of animation packs that just add new animations, so I'm hoping I can somehow slap that pawn in Blender and add some new animations. Then again, I'd have to do that with a prop spear to make sure they're coherent. Oh boy oh boy!

An alternative to parenting the spear to the hand bone, would be to parent it to a different bone that's animated in such a way that the spear slips through the player's hands. (Similarly, in an FPS you might want to have stylish reloads that spin the weapon around or throw the gun in the air temporarily or something like that)

I believe the ik_hand_gun bone is a good choice for this. Just be careful with some animations from the asset store though, because I've seen some asset packs just have that bone floating out in the middle of nowhere. Though usually that's just the asset packs that are intended to be used for unarmed players in my experience.

For creating your own animations, there's also the possibility of animating in engine using Control Rig, instead of using an external application like Blender. If you look on YouTube, there are some good tutorials for this.

The Oid fucked around with this message at 03:02 on Mar 20, 2024

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!
I had made a little animation sequence earlier in the week where the pawn would shake the spear over their head triumphantly, so I'm trying to figure out how to actually integrate that. I don't really understand the details of AnimGraph. State machines in general? Sure. This thing? I don't know what does or doesn't go into it.

I wanted to use that animation as a precursor to having an attack animation. So I want it interrupt player movement, play the animation, and then start it over at idle (where they can immediately go back to movement if they want). I am guessing I have to set up my own boolean to signal the transition, add the state for playing the animation, and integrate the boolean across the existing transitions. What I don't really know how to do is have the spear animation play just once all the way through before going back to idle. Where do I put that logic and how do I tell it played just once?

blastron
Dec 11, 2007

Don't doodle on it!


Rocko Bonaparte posted:

I had made a little animation sequence earlier in the week where the pawn would shake the spear over their head triumphantly, so I'm trying to figure out how to actually integrate that. I don't really understand the details of AnimGraph. State machines in general? Sure. This thing? I don't know what does or doesn't go into it.

I wanted to use that animation as a precursor to having an attack animation. So I want it interrupt player movement, play the animation, and then start it over at idle (where they can immediately go back to movement if they want). I am guessing I have to set up my own boolean to signal the transition, add the state for playing the animation, and integrate the boolean across the existing transitions. What I don't really know how to do is have the spear animation play just once all the way through before going back to idle. Where do I put that logic and how do I tell it played just once?

You’re looking for Animation Montages, which are wrappers for animations that can be manually invoked and tracked on a given actor. You can specifically say “play this animation once and notify me on completion”, and it will override the animation blueprint’s evaluation in order to do so.

Animation Blueprints are great for things that are state-based, like locomotion, but if you’re looking for things that need to be timed with specific effects, go with a montage.

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!
Hmm I wouldn't have soaked that in from the basic documentation on montages. They really emphasize the ability to tie together multiple sequences in it, so I'd think, "I just have one animation. Why do I use a montage?"

I somehow managed to plumb it all the way through from the 3rd-person character controller tonight. I'm surprised it ultimately worked. What really gets me is having to grab the character controller in the animation's event graph, and pull information out of the exposed controller's stuff to determine if I should play that animation. I kind of expected the controller to be able to grab the animation event graph's exposed stuff and set it (the other way around).

The Oid
Jul 15, 2004

Chibber of worlds
You certainly can grab the UAnimInstance/Animation Blueprint and push data to it, but there are multiple reasons not to do so. For one, if your player doesn't really know anything about their AnimBP, then you can easily swap it out for another one without having to rewrite anything (what if you have a player that is an old man and has a completely different animation set?). In software it's generally cleaner to have a one way relationship where only one side knows about the other, and the other side is completely agnostic.

Secondly, Unreal has relatively recently added a way for anim blueprints to grab the data it needs in a threadsafe manner, which means that the Animation Blueprint can be parallelized instead of having to line them all up and update them one at a time (which can be a performance bottleneck in a lot of projects). For this to work safely, you want the AnimBP to be able to grab what it wants, when it wants and not have other classes potentially changing information while it's updating.

Re: Grabbing information from the controller. This doesn't make a difference if you're making a single player game, but I would grab information from the pawn instead. In multiplayer, your controller only exists on your machine and on the server, which means that AnimBP's for remote players won't work.

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!
For years here, I would just screw around with "back end" game stuff and I just decided to finally actually get visual. I'm going to be a real moron with it for awhile.

First, can I get some recommendations for two-handed weapon animation? I am still struggling to figure out how to do this two-handed spear thrust well. I'm stuck on the approach for sliding the spear down the front hand--instead of both hands clenching to spear and jamming it. I'm guessing I should just stick to a single weapon bone and coordinate its animation in tandem with the player animation; it wouldn't be anchored to any of the player bones. I have seen some stuff about weapon IK but it's mostly animating the player holding a rifle and trying to bop somebody with it. I don't see anything for sliding something down a hand. I assume that kind of thing is just a pain in the rear end.

The Oid posted:

You certainly can grab the UAnimInstance/Animation Blueprint and push data to it, but there are multiple reasons not to do so.
This could be getting stupidly pedantic, but I wanted to double check something first. I thought I had my animation Blueprint grabbing the 3rd-person controller, instead of having the third-person controller grabbing the animation Blueprint. Or do you mean having the third-person controller Blueprint play an animation montage means I'm pushing data to the animation Blueprint?

I was surprised by the directionality; it would have made more sense to me the other way around. Having an animation montage execute from the 3rd-person controller works better in my head right now. But from what you're implying, having my controller ram that animation down its throat is not ideal.

quote:

Re: Grabbing information from the controller. This doesn't make a difference if you're making a single player game, but I would grab information from the pawn instead. In multiplayer, your controller only exists on your machine and on the server, which means that AnimBP's for remote players won't work.

I had to read that twice to figure out the intricacies there. I'm not doing multiplayer, but I'll try to use best practices as I can.

leper khan
Dec 28, 2010
Honest to god thinks Half Life 2 is a bad game. But at least he likes Monster Hunter.

Rocko Bonaparte posted:

For years here, I would just screw around with "back end" game stuff and I just decided to finally actually get visual. I'm going to be a real moron with it for awhile.

First, can I get some recommendations for two-handed weapon animation? I am still struggling to figure out how to do this two-handed spear thrust well. I'm stuck on the approach for sliding the spear down the front hand--instead of both hands clenching to spear and jamming it. I'm guessing I should just stick to a single weapon bone and coordinate its animation in tandem with the player animation; it wouldn't be anchored to any of the player bones. I have seen some stuff about weapon IK but it's mostly animating the player holding a rifle and trying to bop somebody with it. I don't see anything for sliding something down a hand. I assume that kind of thing is just a pain in the rear end.

This could be getting stupidly pedantic, but I wanted to double check something first. I thought I had my animation Blueprint grabbing the 3rd-person controller, instead of having the third-person controller grabbing the animation Blueprint. Or do you mean having the third-person controller Blueprint play an animation montage means I'm pushing data to the animation Blueprint?

I was surprised by the directionality; it would have made more sense to me the other way around. Having an animation montage execute from the 3rd-person controller works better in my head right now. But from what you're implying, having my controller ram that animation down its throat is not ideal.

I had to read that twice to figure out the intricacies there. I'm not doing multiplayer, but I'll try to use best practices as I can.

just... author an animation. use martial arts footage/etc as reference. most animations like that arent procedural, though there may be procedural blending between separate authored/captured animations

tango alpha delta
Sep 9, 2011

Ask me about my wealthy lifestyle and passive income! I love bragging about my wealth to my lessers! My opinions are more valid because I have more money than you! Stealing the fruits of the labor of the working class is okay, so long as you don't do it using crypto. More money = better than!
Even though I'm pretty comfy with C and very comfy with Assembly, I'm using an ancient copy of Gamemaker Studio 1.4. It's a lot of fun to write games and then export them to HTML 5 just to see them work on a hosted site. Gamemaker also obfuscates my code really, really well.

The Oid
Jul 15, 2004

Chibber of worlds

Rocko Bonaparte posted:

First, can I get some recommendations for two-handed weapon animation? I am still struggling to figure out how to do this two-handed spear thrust well. I'm stuck on the approach for sliding the spear down the front hand--instead of both hands clenching to spear and jamming it. I'm guessing I should just stick to a single weapon bone and coordinate its animation in tandem with the player animation; it wouldn't be anchored to any of the player bones. I have seen some stuff about weapon IK but it's mostly animating the player holding a rifle and trying to bop somebody with it. I don't see anything for sliding something down a hand. I assume that kind of thing is just a pain in the rear end.

Yeah a lot of the resources online that talk about weapon IK bones are going to talk about their primary use case, which is making sure that your player's hands stay on the weapon, even when you're blending a bunch of animations together, or retargeting to a skeleton with different proportions (which may cause one of the hands to become misaligned with the weapon). Typically the two IK hand bones ik_hand_l and ik_hand_r will be animated to follow the hand bones perfectly (but they don't have the same problem as the actual hand bones because they come straight off the root bone, so aren't affected by the transforms of other bones all the way down the chain from the pelvis to hand_l and hand_r.).

For this use case you typically use IK nodes to make the hand_l and hand_r bones follow the ik_hand_l and ik_hand_r bones. (Just giving you context here, I wouldn't worry about this side of it right now, cross that bridge when you come to it).
The ik_hand_gun bone should be animated in such a way that it has the proper offset from the hand that you want the weapon to have.

But a bonus of attaching your weapon to the ik_hand_gun bone instead of the hands, is that you can animate that bone in any way you want without affecting the hands at all.
Say for example your animation animates the ik_hand_gun bone to rotate relative to the hand that's holding the weapon, the weapon will now spin in the character's hand, because it's following the transform of the ik_hand_gun bone, not the hand bone directly. (For example, a fancy handgun reload animation that spins the gun around like Robocop)

Or, more relevant to your use case, if the ik_hand_gun bone moves relative to the hand bones, then the spear will appear to slide through the character's hands.

Rocko Bonaparte posted:

This could be getting stupidly pedantic, but I wanted to double check something first. I thought I had my animation Blueprint grabbing the 3rd-person controller, instead of having the third-person controller grabbing the animation Blueprint. Or do you mean having the third-person controller Blueprint play an animation montage means I'm pushing data to the animation Blueprint?

I was surprised by the directionality; it would have made more sense to me the other way around. Having an animation montage execute from the 3rd-person controller works better in my head right now. But from what you're implying, having my controller ram that animation down its throat is not ideal.

I had to read that twice to figure out the intricacies there. I'm not doing multiplayer, but I'll try to use best practices as I can.

Oh I just meant for the Anim Blueprint getting information that it uses to drive its normal state machine (walk, run, etc).
It's expected and normal that montages will get triggered externally.

The Oid fucked around with this message at 07:00 on Mar 27, 2024

Alterian
Jan 28, 2003

tango alpha delta posted:

Even though I'm pretty comfy with C and very comfy with Assembly, I'm using an ancient copy of Gamemaker Studio 1.4. It's a lot of fun to write games and then export them to HTML 5 just to see them work on a hosted site. Gamemaker also obfuscates my code really, really well.

Unity can also export out to html 5. I usually have my students host theirs on itch.io

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!
I had an animation sequence I made in UE5 recently lose its key frames. I can open it up and view the animation in a timeline, but there isn't anything for it I can edit any more. I was going to start over and replicate some of the stuff I did to see where it might have decided to toast it. Is there something in the engine where this happens like a bake step or something? I saw a few threads online asking about it without a resolution. Somebody just claimed it was a bug.

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!
Kind of answered my own question. If I try to open up the animation sequence in the content explorer, I don't get the key frames. I need to instead open the level sequence object I threw down to find the original settings. It wasn't really explained in tutorials outside of just being a necessary evil to use the sequence in the first place. I'm guessing I should create a bunch of these if I want easy, but separated access to different animations.

I also figured out there's a real big conceptual difference between the skeletal meshes and control rigs. I'm not sure how I would use a weapon bone in a control rig. The skeletal meshes for the mannequins have weapon bones already, but there's nothing in the control rigs for them. For now, I'm just dropping in the other objects and see how it goes trying to animate them together. I ran out of time to mess around with it after I got the initial positioning, so I expect this will immediately go to hell when I start trying to move them together.

Chillmatic
Jul 25, 2003

always seeking to survive and flourish

quote:

I'm guessing I should create a bunch of these if I want easy, but separated access to different animations.

I almost never have any idea what you're talking about. But I'm pretty sure you've been told multiple times that animation montages are what you are looking for, and for some reason you keep ignoring the advice or missing the point.

leper khan
Dec 28, 2010
Honest to god thinks Half Life 2 is a bad game. But at least he likes Monster Hunter.

Chillmatic posted:

I almost never have any idea what you're talking about. But I'm pretty sure you've been told multiple times that animation montages are what you are looking for, and for some reason you keep ignoring the advice or missing the point.

its his bit, just roll with it

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!

Chillmatic posted:

I almost never have any idea what you're talking about. But I'm pretty sure you've been told multiple times that animation montages are what you are looking for, and for some reason you keep ignoring the advice or missing the point.

I might be, but I was taking that as the way to trigger the animation, which I have started doing. There's some semantics/taxonomy crap going on here that I'm slowly understanding (I hope!). I'll just blast what I think I know here in case somebody finds a fault that might clear me up:

1. The skeletal mesh has all the bones that moves all the different parts of the mesh within constraints.
2. The control rig is a separate thing from a skeletal mesh. The control rig is what is manipulated when animating. Instead of a hierarchy of bones, there's a hierarchy of controls. I didn't see a control for the weapon I wanted to move around in the rig for the mannequin, so I'm not sure how I'm supposed to do it. I haven't figure out how to add a control, and the fact there wasn't one already when the skeletal mesh already has a bone for it makes me think this is not how it's done.
3. A level sequence is necessary to create any kind of animation at all. Key frames are edited within this using the control rig. I am really confused by that because I figured that kind of editing would happen in an animation sequence. In tutorials for animation, this object is treated like some quick, necessary evil that you vomit into the project and then you move on. I've seen it not explained multiple times. It's one area I'm just looking up independently.
4. The animation sequence was the first thing I was triggering for my animations and was talked out of in favor of using a montage. It does contain an individual animation but opening it up only brings up a player for it. I have to edit it within a level sequence. I don't know why.
5. The animation montage is created from an animation sequence and is what I trigger to perform the animation. It's simpler to trigger a montage than an animation sequence. The montage also allows blending and mixing different animation sequences. I wouldn't be too surprised if I am supposed to have separate spear animations that I merge with the player animation in a montage, but it just doesn't smell like the right way to do it.

I haven't had much time each day to take a stab at it, so I mostly just look up or watch something and try the result each night. Along the way, I had lost track of where to even go to edit the actual animations. It's really strange in UE5. I actually thought Blender's system for it was much more straightforward years ago--of all things (at least single-object animation; I don't know about sliding a spear around).

Jabor
Jul 16, 2010

#1 Loser at SpaceChem
My understanding is you want to use a Control Rig for this. If you've created a new bone for the weapon, then you'll probably need to poke around the Control Rig Blueprint editor to rig an appropriate control point for that bone and define how things move as you animate that control point.

If you haven't created any new bones and you're just using a model that came with a weapon bone already defined, check if that model also came with an appropriate control rig and use that instead of whatever you're currently using.

jizzy sillage
Aug 13, 2006

Most of what you wrote is correct. Yes, you need to edit animations in Unreal in a Level Sequence, they bake out the result to the Animation Sequence which is the UE representation of the animation file. The Level Sequence is your workspace for editing this and other animations done in this Level Sequence.

It's kind of jank because UE wasn't designed ground up as an animation tool. Blender may make more sense in this regard because the file you have in Blender is like the Level Sequence in Unreal, and when you export the FBX of your anim, that's like the Animation Sequence in Unreal.

So:

Level Sequence: thing that contains the animation data for you to work on, make edits, move things around and keyframe them. Can edit anything here. LS is for edits.

Animation Sequence: like a wrapper for an FBX file, plays the animation you authored. Can't edit the keyframes here, can only adjust things like playback rate. AS is for playback.

An Animation Montage is a combination of one or more Anim Sequences. You can chain three AnimSequences together in a single AnimMontage if they're meant to be played back to back.

AnimMontages are used for playing single, discrete instances of animation. The player was running but now wants to do AM_SwordAttack01, you just Play Anim Montage and give it AM_SwordAttack01 and it overrides the AnimSequences being played by the ABP - this is an oversimplification but close enough.

Chillmatic
Jul 25, 2003

always seeking to survive and flourish

jizzy sillage posted:

An Animation Montage is a combination of one or more Anim Sequences. You can chain three AnimSequences together in a single AnimMontage if they're meant to be played back to back.

AnimMontages are used for playing single, discrete instances of animation.

I think descriptions like this can get confusing/contradictory.


Animation Composites are the class/object that are actually intended to combine animations in UE. Montages can also do this but over the years their purpose has morphed into being "fire and forget" one-off animations that can be called from any object in code or script. They've become popular for things like attacks, transitions between movement states, and traversal actions such as mantling/climbing. Montages can be played on specific, custom-defined skeletal layers like "upper body", useful for things like reloading animations which should not affect or influence the lower body bones (just as one example).


Rocko Bonaparte posted:

There's some semantics/taxonomy crap going on here that I'm slowly understanding (I hope!).


No doubt. Epic does a terrible job at teaching and describing things. For example blueprint interfaces are something they teach as a "one to many" communication class, like for calling the same functionality but overridden/differently implemented on a per class basis...but neglects to ever mention how ideal they are for simple class communication and passing data around, especially in contrast to casting, hard level references, and other expensive crap.

Ultimately I don't think that Unreal's built in animation stuff is ready for shipping or general use. For what you're describing with spears etc. it would be exponentially less time-consuming to author the anims in blender/maya or whatever, and then invoke them in the engine. Attach the spear to the socket/bone of your choice, look into weapon-hand IK setups, and be off to the races.

jizzy sillage
Aug 13, 2006

Chillmatic posted:

Animation Composites

Ah that's cool, I hadn't played with Animation Composites.

Seconding the "make it in a proper software" advice, too.

TaintedBalance
Dec 21, 2006

hope, n: desire accompanied by expectation of or belief in fulfilment

Rocko Bonaparte posted:

I think I'm understanding why games don't like to gave players melee spears. I just slammed one in the UE5 3rd-person pawn's right had and now it moves all goofy. I am guessing the spear is causing collision madness and wrecking how the player moves. I assume I have to disable collisions on it or something. That would, like, by the least of my worries though. How would I have the spear slide through the players hands for a thrust? All I have here glues the weapon to a hand and that's that. I also have the figure out how to add animations for working with a spear and two hands; I'd probably want to play with the UE5 mesh for a long time, and I've heard of animation packs that just add new animations, so I'm hoping I can somehow slap that pawn in Blender and add some new animations. Then again, I'd have to do that with a prop spear to make sure they're coherent. Oh boy oh boy!

Besides all that and everyone's suggestions, the main reason games avoid them is because they have a completely unique set of animations that can't be easily shared with any other attack animations besides some overlap with other polearms (sort), and maybe staffs if you're not being too particular/are clever enough. Pole based weapon combat makes extensive use of the entire shaft and striking with either end at various grip points that is a lot of work to make look and good and work well in games, while any grip based weapons (or grip approximate) can easily be swapped in for each other as is or with minimal changes. It is a lot of extra work for something that brings questionable additional value to a lot of games. The main irony here of course being that spears and polearms made up the vast majority of pre-gunpowder implements of war, but people love swords, so whatcha gonna do?

I suppose we could train animators and riggers like we do martial artists by starting with the staff when they move on to weapons, since once you've mastered all the basic movements of that weapon, everything else comes much more intuitively (and you're way less likely to maim yourself/others around you), but I don't see that getting traction any time soon.

Raenir Salazar
Nov 5, 2010

College Slice
Anyone know a clean way of connecting the output of a Custom Event to where I need it? Like I usually want to Bind a Dispatcher to my BP's Event, and also Unbind it, but I can't seem to store the event as a local variable so I can use a Getter to reference the Event. I.e the little Red connector wire I'd like it if I didn't have to have it criss-cross my other wires?

Chillmatic
Jul 25, 2003

always seeking to survive and flourish
Can you post a screenshot? I’m not sure what you mean about an event as a variable.

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!
Do you just mean that you want to listen for that event somewhere else?

All that goofiness with this stuff in UE5 makes me just second guess anything being asked.

Raenir Salazar
Nov 5, 2010

College Slice
I don't have a screenshot handy right now but I just mean when you create a "...New Custom Event" and you have the node, you can drag the Red Square as a connector, usually to bind it to a Dispatcher or unbind it. However to Bind and Unbind requires two connections, and to keep them neat they need to be near enough other, but so does the code/function the "New Event" node is executing. So I can just make a function and have the Event call the function and have the Connections to the Bind/Unbind nodes be above and below but I'm still nonetheless working around the fact that there doesn't seem to be a neat way of arranging the connections so the connection lines don't cross each other.

blastron
Dec 11, 2007

Don't doodle on it!


Are you looking for some way to reference the binding itself? So, rather than saying “bind Foo(), then, when X happens, unbind Foo()”, you’d say “bind Foo(), then, when X happens, clear this binding”?

I can think of ways to do that in C++, but I’m not sure if any of that is accessible in Blueprint.

Raenir Salazar
Nov 5, 2010

College Slice

blastron posted:

Are you looking for some way to reference the binding itself? So, rather than saying “bind Foo(), then, when X happens, unbind Foo()”, you’d say “bind Foo(), then, when X happens, clear this binding”?

I can think of ways to do that in C++, but I’m not sure if any of that is accessible in Blueprint.

Yeah its just a mockup and C++ would be overkill, I have a C++ global event system I would use instead if I was doing it "proper".

Here I made a example:



Ignore that the Event and the Delegate are in the "same" class, normally I'd put the Dispatcher in my Event Manager object.

Basically I'd like something like the "self" references but for the little red square (i.e the delegate output) from the Event so I can avoid the lines crossing.

Programming should not be a Geometry problem in of itself! :haw:

Chillmatic
Jul 25, 2003

always seeking to survive and flourish
I'm still not sure what the problem is or what you're asking for. There is the "create event" node which can be used to bind/unbind/assign event dispatchers, as such:

Raenir Salazar
Nov 5, 2010

College Slice
You should use "timg" so the image doesn't use a huge amount of space and gets embedded.

Chillmatic posted:

I'm still not sure what the problem is or what you're asking for. There is the "create event" node which can be used to bind/unbind/assign event dispatchers, as such:



I feel like I was pretty clear with my screenshot that I don't want the lines crossing (which they by necessity do in the screenshot), my problem here with your solution is what does "Create Event" actually do, are there any hidden costs or pitfalls? Is it doing anything that is bad practice or inefficient under the hood if I scale up and use this everywhere? "Create Event" sounds like it's initializing a new object in memory when it should just be possible to pass the same reference around.


e: What the gently caress Unreal, apparently you can't have events inside functions they have to be all in the main event graph :psyduck: why.

Raenir Salazar fucked around with this message at 15:00 on Apr 9, 2024

Chillmatic
Jul 25, 2003

always seeking to survive and flourish

Raenir Salazar posted:

I feel like I was pretty clear with my screenshot

Good luck with whatever you’re trying to do.


Raenir Salazar posted:

e: What the gently caress Unreal, apparently you can't have events inside functions they have to be all in the main event graph :psyduck: why.

You can call events from within functions. If you are asking why you can’t create events inside functions, that’s because functions do not allow latent actions like delay, timelines, etc. You can create multiple event graphs if you would like to keep different categories of events on their own graph.

KillHour
Oct 28, 2007


Raenir Salazar posted:

I feel like I was pretty clear with my screenshot that I don't want the lines crossing (which they by necessity do in the screenshot),

I'm not sure why you care if the lines cross, but it is possible to rearrange the nodes in your screenshot such that lines do not cross.

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!

Raenir Salazar posted:

You should use "timg" so the image doesn't use a huge amount of space and gets embedded.

I feel like I was pretty clear with my screenshot that I don't want the lines crossing (which they by necessity do in the screenshot),

For what it's worth, I didn't pick up on that at all myself.

quote:

my problem here with your solution is what does "Create Event" actually do, are there any hidden costs or pitfalls? Is it doing anything that is bad practice or inefficient under the hood if I scale up and use this everywhere? "Create Event" sounds like it's initializing a new object in memory when it should just be possible to pass the same reference around.

I haven't really thought about it, but I haven't seen a peep against it so far so I want to hope it's minimal. That or I'm just walking off the same bridge everybody else is. If you're having a real aesthetic problem with the created event's lines running around in your example: that should be the same output going both to binding and unbinding. If you don't like the big-rear end line, then you essentially save it off into a variable that you can plop down wherever it's needed.

quote:

e: What the gently caress Unreal, apparently you can't have events inside functions they have to be all in the main event graph :psyduck: why.
Heh I stepped on that rake at some point. I just internalized that the event graph is for events. If I wanted a function called when an event triggered, I had to plumb it in the event graph. If I wanted to block a function until an external event triggered, then, well, I dunno because I've dodged that so far but I did wonder about it.

aardvaard
Mar 4, 2013

you belong in the bog of eternal stench

Raenir Salazar posted:

I don't want the lines crossing (which they by necessity do in the screenshot)

Just swap the positions of the Hand on Something and Uninit nodes and they won't cross. No special features needed.

Adbot
ADBOT LOVES YOU

Raenir Salazar
Nov 5, 2010

College Slice

Chillmatic posted:

Good luck with whatever you’re trying to do.

I'm just going to say that this isn't helpful and people can be legitimately confused at other peoples confusion when they reasonably believe they gave all the relevant information that they thought they could give, which I legitimately believe that I did so; I can't help explain the problem any better without more specific information as to what isn't clear. Thank you for the suggestion regarding the "Create Event", hopefully it works out.

KillHour posted:

I'm not sure why you care if the lines cross, but it is possible to rearrange the nodes in your screenshot such that lines do not cross.

aardvaard posted:

Just swap the positions of the Hand on Something and Uninit nodes and they won't cross. No special features needed.

The first thing to consider is that aesthetics and making the resulting "look" of the graph pleasing by being neat and orderly matters to me; but the more substantive answer is that a messy Blueprint is hard to understand, debug, maintain, and fix any resulting issues.

The second thing just to be clear the screenshot is just a simple example that I quickly made to demonstrate the problem. A real world scenario is going to be more complicated and it won't be as trivial to rearrange it, or perhaps even impossible to make it so that the lines don't cross. This isn't the actual blueprint I'm working on.

Rocko Bonaparte posted:

For what it's worth, I didn't pick up on that at all myself.

Sure I hope understand where I'm coming from being confused at this :confused:

quote:

I haven't really thought about it, but I haven't seen a peep against it so far so I want to hope it's minimal. That or I'm just walking off the same bridge everybody else is. If you're having a real aesthetic problem with the created event's lines running around in your example: that should be the same output going both to binding and unbinding. If you don't like the big-rear end line, then you essentially save it off into a variable that you can plop down wherever it's needed.

Can you elaborate on this? As I see currently understand it, this is essentially my problem in that I can't see a way of doing this, there is no way to put an Event/Delegate as a variable to just plop it down wherever. Currently it seems like "Create Event" indirectly resolves this, but it is unclear what the costs or pitfalls might be, based on googling it is essentially creating a Single Cast Delegate which we're plugging in our other Event/Delegate into, which is fine but I worry that using it indirectly as a Getter for my Event probably is completing a Demon Summoning circle somewhere.

quote:

Heh I stepped on that rake at some point. I just internalized that the event graph is for events. If I wanted a function called when an event triggered, I had to plumb it in the event graph. If I wanted to block a function until an external event triggered, then, well, I dunno because I've dodged that so far but I did wonder about it.

So actually revisiting this now that I realize how the node works, the dropdown list of signatures only appears once you drag the Output "Event" pin into something like the BindSomeEvent node; then the dropdown appears but only for the functions/events of the class plugged into the "Object" input pin. It turns out that while "Add Custom Event" only works in the Event Graph, "Create Event" works anywhere! You can have a function for initializing/binding your events and then use Create Event to move the bindings to there. I was bamboozled by my googlefu.

Raenir Salazar fucked around with this message at 18:46 on Apr 9, 2024

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply