#blueprint
402296 messages Β· Page 915 of 403
Not as worse as UMG/Slate when it comes to the most lacklustre part of the docs
But I'm not π₯²
Considering im an idiot and you know far more about this engine than I do
Im pretty sure you're smart bro
yes
I don't THINK
I K N O W
Well, I'm suck at C++ and multiplayer stuff
||and XR stuff
and ECS stuff
and mobile stuff||
That's ironic because multiplayer/networking stuff is something I know a good bit in
Anyway I gotta sleep kthxbye
NO WAIT
one more ounce of assistance pls
i beg
the "final color" node is not there
It's already midnight on the far east
Well, read the snippet description
nice
you are free from your chains, good night
Looking forward to the day where I can be the one who helps instead of the one who asks for it 
The problem of returning to the project after some time not working on it... >_<
I somehow made player push NPC Character actors out of the way when walking instead of them blocking the way, and now I need to change that either back or tone down the effect, and I don't remember how I enabled it in the first place. Any advice?
Im just brand new to C++ and UE4, im coming from a background of Lua, and JavaScript
C++ is fairly different in comparison
It's weird being part of a community that all collectively works as a team
A really good kind of weird, but definitely not what im accustomed to
I guess we are all in the same boat, after all
This came to mind because I just realized Makoto made that entire snippet literally just for me
It was uploaded only like 3 hours ago
Aka around when I needed help originally
Its a nice platform, hopefully i can provide some basic stuff to it aswell
Even if its just for my own library/sanity
H u h ?
Its strange for me aswell, never been part of anything like this discord server before
The new dev pages with community snippets
Oh yeah!!
It reminds me on how things like speedrunning communities also band together, sharing new tricks and secrets and what not
It's wholesome
Hello there!
I'm not sure if this chat is the correct one but are there any means to render mesh above everything including UI? (and no, making my mesh a picture is not a solution because I need to rotate and modify that mesh)
but will this mask help rendering my mesh above UI?
(and if it will help, "weirdness" doesnt matter, any working solution will be fine)
Not 'above' but through, yes
Or you could make your ui world spaced, but that could get tricky
can you show an example? I didnt hear about that kind of masks before π€
that will break everything I suppose π
does anyone know why when I launch 8 missiles some return with the delta as 0,0,0 but some have numbers like 24,180,180? they should all have 0,0,0 since the look at rotation and relative should align after rotating the actor right?
Im using WPO in material to animate my spear up and down when im walking.
Then when i face the enemy i lerp it into the horizontal position.
So what can i do for the WPO to still understand that the Z is still the spear direction?
Or this is not possible?
No. Its an instanced static mesh of a plane with the material, the spear
Not sure but if I see right, you're checking 2 unrelated things, you're setting world rotations but print relative rotations. I think.
in my current batallion i have 80 spears. Each batallion has 80 spears. And i intend to have many batallions.
the relative and world print out the same and they are unrelated until the set world rotation which should set the capsule rotation to the look at rotation right?
Oh and 'since the look at rotation and relative should align after rotating the actor right?' We don't know, we see the look at variable but we don't see how it's being set so we can't confirm if that's actually the case. π
So if i rotate the instance to become horizontal. And i do what you are saying it will now animate in the horizontal. But what if my enemy is a bit to the left or to the right? I could also control that angle?
they should align yes
Again, we don't know, all we see is that you apply the action, not what that action actually is.
In this case, yes, you are setting a capsule's rot to whatever it is stored in lookat var but you are printing relative rot which they are not directly related and we don't know what you are doing with that look at var so all I can say now that you are checking 2 different things and that yes, you are applying world rotation to an object. π
I printed with world rotation and got the same values as relative
the look at var just contains the lookAtRotation values and so this works but what I don't understand is why the difference between lookat and the roations are not all 0 as they are looking at the rotation if that makes sense
same it makes no sense as to why these don't equal 0 but some do like ?
Wait, is the rot instant? Cuz in previous print, you can see 0,0,0's too. If you interp, you might getting confused with that? Also, try on a missile to missile basis and see if one by one turns to 0,0,0.
Oh, wait, is the lookat only on 1 axis/based on 1 or 2 axis?
the rot is instant rinterp just flat out wouldn't work some would flip flop between facing the target or facing opposite of it
3 axis
Okay so I ran back into the same issue I had earlier
The Snippit Lerp plugs into "Final Color" which I do not have.
Aha! Solved it!
All this for a simple flashy widget π
yeah :')
I should study those materials one day....
"simple flashy widget"
Jooo... xD We need some fabulousness in our dev softwares man. xD
Come on man gimmie some c r e d i t
I wanna see the result first
I'm on your side dude. π β€οΈ
Then I'll give you credit
Well first I have to bring the result into this world
GL and do show!
Man... Now I wanna make my blender pink. Someone stop me, cuz I'm pretty sure it ain't gonna help in actual modeling. LMAO
I mean, combo green/magenta but... yeh
I should just turn to modeling at some point
Stop pretending to programπ
But then id need to learn that...
I made this bulky chest many moons ago
Blender uninstalled me as a user
I wonder if my delegate and function would've solved this an hour ago
SHHHHHH
Okay actually im gonna try your method
I did a blink effect on my nuke reactors a while ago
Actually hang on imma paste it down here
During stamina use, check for the condition
Launch an event dispatcher when stamina goes below your treshold
On stamina regen
Do the opposit
A single delegate with a bool should be enough
Below treshold, true or false :)
There
instructions ready to do
Okay so here, what should go in a function?
Well, good? π
Yes, it is
But to deplete it youd have a function ?
Atleast i would
Keeps it clean
Nope :')
anyways
But I can collapse them into a function B)
Okay so for a start, how can I set the treshold?
When depleting stamina, check after subtraction if you are below treshold
Well you can hardcode the value
Or make another float for it
Already part of the Stamina system, I think we're good there
Right
Stamina values coming up and down are all handled
So if newly below treshold, call the delegate
Oooh okay hang on
Yes you need an extra bool for it ^^
Delegate is the pink box right?
Erh, event dispatcher *
You need to create one for the stamina trigger
Name it usefully π
It should have a bool input
So how do I properly replicate an attack collision/switching collisions on and off?
Because obviously I want my weapons/actor hitboxes to only be active when an attack is going on, but clearly the method I'm using to go about it (using an anim notify state to turn on collisions for actor/weapon hitboxes) isn't working so well
How can I trace multiple lines around the character to find any collision object?
just use a collision sphere?!
@sudden zephyr I think I maybe figured something out there's never a negative yaw returned from this but there is in relative rotation
Hi so i dont know how to castthe password and the username content to an actor that i need to connect to my tcp server?
its my start screen i did
xd
Why can't I validate a HitResult? This thing is empty sometimes and it's breaking my code
It's pretty good
thx haha
Is valid checks if an object is null, hit result can never be null. You need to validate the specific value from the hitresult which is null
I would assume that would be Hit Actor
It really really looks like it's null
pay attention to what it says, accessed none trying to access HitActor
Ah wait I know the fuckin problem
tbh this one is a bit confusingly worded as far as it goes with these
I wanna stand on a huge rock and scream to the whole world that every coding language needs to have null-safe dereference operations.
Gimme my elvis operator, blueprints!
they should have replaced the accessed none with Accessed NULL. So much more obvious. Bugged me forever. -.-
That operator is not much different from Is Valid or Validated Get in context like BP's I think
The difference is when you chain dereference. With validated get, you need to validate each step of the dereference. But an elvis operator just returns null if any step is null, without throwing error on the next step
I suppose so yeah
impossible xD
Hey, does anyone know what the object can be when casting to something?
I'm so confused why does this return true but not this
Holy shit can it be anything??
It can, but you can't cast anything into anything
it needs to be the specific object you want to cast
Oh yes I know
It's supported in C++, C#, JS/TS, PHP, and Kotlin will lie and say it supports it but it doesn't
try having some other value than 0.0 in there and see if that affects it
How can I teleport my player to the cine camera using the sequencer? I tried to get the cine camera transform and plug that into setactortransform and my player just kinda... stayed where he started at
When casting to HUD, what do you think I should use as the object?
huh ok I entered in other values and that broke it this now returns false why? they match
My player doesn't teleport, can someone help plz?
Sorry I meant the third value for the == node
Because I think you are comparing an old value to current values?
Ping me if someone answers me please
You're comparing floating point values, and they are inaccurate sometimes, so you need to use a delta value like 0.01 to allow that amount of inaccuracy in the comparison
if you're comparing 0 == 0 then that tends to work without issues, but if you have values like 1.123123123 == 1.123123123 this can have problems because of how floating point numbers work
the values are so far off tho? only the pitch is dead on
I'm not sure what the values you're printing are
I'm printing the relative rotation after setting it to that previous screenshot values
p=y
No idea, either something changes the value or it's actually the same value but just represented in different range (instead of negative it shows it as positive or something)
How can I make it so that I will find the nearest point of trace to my mesh in Multi Sphere Trace By Channel
What zomg said and to add, that's why you use delta so you can define threshold/precision easier. Like, if delta < 0.1 etc, xD
delta didn't work for me and nothing else is changing the rotation so I'm lost but oh well I'll just come back to this another day
Yeh, take breaks, they do help with stuff like this too.
Does anyone know how to get a variable from a widget into an actor??
same way as getting a variable from any other object, you get the widget and read the variable
you can also do it the other way around if it makes sense, assign the actor into the widget and have the widget call a function on the actor to assign it
Can anyone help me please. Iβm struggling a lot
Ok guys I got my player teleported to the end of the sequence cine camera. How do I "ease" the cine camera to the player camera?
I tried Set View Target With Blend and set the blend time to 5 but it still cuts to the player camera
Try adding camera lag
How do I do that?
Are you using FollowCamera?
no
I'm using the level sequencer with a cine camera actor
and an end event to teleport and ease the player
You can see here
Hecc
?
I know that adding camera lag will fix it, but I dont know how to find it for your cam
Hang on ill look around
@trim matrix Found it!
Is your camera attached to a Camera Boom component?
no
O h
Well the camera boom is how you add camera lag
There might be another way though
Oh wait
I just need to know the player's looking height
is there a way to figure that out?
like the player's camera height from 0
the distance from the ground to the player's camera
You could always try to linetracebychannel from the camera to the floor
Maybe
Idk about that but that's my best guess :')
If it's a character where the the origin is where it hits/meets the floor, should be simple then.
Ok let me rephrase what I initially wanted to do
In cinematic sequencer, I want to move a camera with keyframes (I know how to do this) and then at the end, when its moved, I want to get the location and rotation, then set the player location and rotation to the camera's
but its not working right
Not working correctly how?
And are you sure the cinematic camera is actually at a location where there's enough room for the character? As in, the camera is high enough so that the character actually spawns on the ground and not in it?
it keeps teleporting to the wrong place, normally inches near AND doesn't rotate the right way
I don't know how to tell how high the camera should be
Hm...
Oh, btw, why are you casting transforms to the actor itself rather then moving the reference?
?
There's a pawn on the level already, right?
There's a player start
Hello, when doing a line trace, I'm getting only 1 hit for one box, if i duplicate the box in the world i don't a hit on the second one, why is that ?
https://prnt.sc/uJfeq4bVu2l2
I'm probably wrong but I think--if I read the code correctly-- you are tracing for a reference.
Yes, i get the reference of the first box, but not the second one in the level
If you duplicate a box, it's a new reference, that variable up there with name Box that goes in target I think.
Yes, you get the ref for first box, but what about the second? xD
On the second one i don't get anything
How do you get the box ref?
actor component https://prnt.sc/r2Oguw7oBLHC
Wait, wheres the code located btw?
inside an Actor BP
Ah, ok then. Thought you are tracking a box with the player, but it's like a wall lazer. Huh... Should work. o.O
I spend 2 days trying to figure it out, I tried all the lines traces, nothing works
Ok I figured out my problem π All I have to do is place the player start where my camera ends, is that the best way, or would you guys do it in blueprints?
I tried by tag, doesn't work, it's like it changes the name inside the level and only gets the first actor inside the level
Wait, how you know if and which one works?
It's the first actor placed in the world, that one works only, not the rest
Hm.. Asking all that because it's confusing as we don't know what, how or why you're tracking. Like, I see you're getting the actor but then track infront so we only at wild guess here of what it's meant to hit, if you know what I mean.
So I'm doing a trace to see if I hit the collision Box, but if i duplicate that in the level then it won't hit the second box https://prnt.sc/EC6FtpQnBhvE
So confused. xD
So you have a wall and you are tracing that wall from the player instead?
It's so weird as depicted here, sorry. xD
You sure trigger box wouldn't work here instead?
I can maybe show you if you join the voice channel π
I'm tracing the wall from inside the actor
I mean the collision box
Did you manage to complete the setup? Arriving at the pc now if not
I took a bit of a different path but yes! It is working!
Oh no I only changed a little bit :')
There were a couple of bugs I had to smooth out, but its all good now!
Aaand the result can be seen... where? π
I'm following this tutorial for a inventory and I'm following everything correctly but I cant connect these. How do I fix this?
Im doing this in the Third Person BP
You're trying to connect an array to a single struct break. Wouldn't work.
You have to pass the array to a foreach loop
Then break each item in the array.
HELLO GUYS! Do you know if using Set Hidden In Game I can propagate to only one children and not all of them ? cause I have some stuff that I don't want to affect! Please thank you !!
It's likely easier just to make a function that will set what you need hidden.
Oops hang on
Uhhhh how can I record a video to show?
OBS ?
Keep an open mind though as everything is VERY early haha
75% of the animations are not permanent
I can't.. it's a macro in a macro library
mkv ugh
Why did it
mp4 ty
Feels like something that should be a ticked uobject rather than a macro. Either way, you as passing self in from the character using it. You have access to the entire thing to hide or show specific components.
Hang on how do I fix that lmao
So I don't have to modify it from the macro library ?
Should I re-record it or did you already see it
re-record π
Well. You would if you want to modify the macro. Your only other alternative is to make a new execution output on the macro and handle the hiding in the character there, call that when you want it hidden.
I mean it's a dash where I disappear and blink so my mesh visibility goes off but not my rifle behind the back.. since I have two rifle one on my back and one invisible on my hand If i propagate to children i disappear with my rifles but then when my visibility returns on also my invisible rifle in the hand comes out
well dang!
looks like something could be looping with a 10th of the length, but gj!
how did you send a video so long lol i struggle to make it less tahn 8 mb
Nitro
oh okay
N i t r o
50mB
What's looping?
the animation could be looping
Which one?
the staminabar?
0 = infinity
Change My Mind
And beyond
Oh no it's not looping!
I always set them to 1 or more loops
What I did was I just made the Low Stamina effects go on for about 20 seconds
So that the animation doesn't end prematurely
right . but it should end when stamina reaches 0 i would think π
when the player stops depleting stamina ?
here's my video then haha
Not quite
Nice!!!!
If I had it so the animation ended when the player stopped losing stamina, it would cause the animation to end no matter if the player was under 25% stamina or not
When you invest in mechanics and not in art XDD
Well its up to you how you want it ^^
my game looks garbage
So I made it so that the animation would end when the players stamina went above 50 total
focusing 99% on the gameplay
It looks fine man! Just some polishing and it'll look awesome!
Yeah I need to find out how to fix this rifles visibility π¦
Right now what im doing is im getting the mechanics working, and then immediately polishing them and making them look nicer
Yes .. my friend is just doing maps and stuff.. they look very nice but then the game it's just a mannequin that walks
Oh, you're getting help? :0
No.. he's doing them for his game
Ohhh
I care about getting the base mechanic working and THEN polishing it
Honestly, mine looks kinda messy
I worry about polishing as soon as I can because I have ADHD and I know ill forget xD
What's that MAX program?
its a single ended clamp
brain hurt
Something possibly worth mentioning by the way!!
@tight schooner ugly
If you cast to your actor, you can drag off and use the variables from there, in the widget
im sorry
lol
and the regen function
Ok I did it .. I cast to the character in the bp and fuck it
What kinds of programs will cause performance drops?
Because I wanna make 100% sure that my game is well optimized
loops
Dont we love wasting time
Nah you're right
dont preoptimize
profile,
then optimize
if profiler showed anything
Actually we do. π
we're both here, so yeah π
Right?
Okay so im going to temporarily break the animation so I can clean it up
See you in a week.
Aye no
Full speed ahead captain
I got this dont worry, I know what im doing now B)
Binding for what?
the dispatcher
||erh, i keep forgetting marking them spoilers ||
Last time I said that at work, it took me a week to fix a five minute bug. :/
sh
Thats all in the past
im cool
i wasted a day on the UMG input
untill i just dumped it down to the relevant actor anyways
re-added the interface and it worked in 5 minutes
Now im wasting time thinking about my datatables
(Also, while im doing this, if anyone knows how to make a UI Material for water droplets, let me know)
Would personally do that in the Niagara UI plugin. Probably just as easy with a basic material though.
People love raindrop material textures. I don't think they're any different when for UI, just less vertex manipulation.
Actually nvm
Hey. i am trying to create a widget blueprint which displays a progress bar that is bound to my BP_ThirdPersonCharacter's health variable. It is bound to it and it follows it, but the progress bar inside of the widget blueprint only goes to 100% (if the health variable is above 0.0) or 0% (if the health variable is 0.0 or below). Any idea of what might be causing this?
I am using this event in the gamemode to handle starting behaviour for players (setting them to the intro camera, etc). However it seems to completely overwrite the normal starting behaviour as my players no longer spawn in.
What am I supposed to do so it continues as normal after finishing my custom BP?
Percentage goes from 0.0 to 1.0
what you're doing now is dividing their health by 10
100 / 10 = 10
try health / max health
that will get you the progress bar percentage you're looking for
Likely need a call to the parent function if it's no longer spawning characters and you want it to.
ahh yes i see now. i multiplied by 0.1 instead of 0.01
thanks
I still need help solving this issue. After possessing a pawn then repossessing my character, my walk, run, etc. animations don't play anymore but my character can still move. How can I fix this?
messing around with level switching and I cant figure out why this wont work.
When I'm in level 1, I want pressing e to switch you to level 2 and vice versa if that makes sense
For extensibility, it's still safer to just divide current by max. Even if max is 100. Good habit to make when making bars for stats of any kind.
Because you're removing state when you open level. That will always be whatever the default value is after opening a new level.
For more clarity. OpenLevel tells the current world to tear down and rebuild a new one. This destroys nearly everything except for GameInstance. This means that the blueprint you have these controls in is also destroyed and recreated.
Two options to fix. One, save state in the GameInstance. I don't advise this long term, but it's easy for beginners.
Other is to call GetCurrentLevelName and compare the string with your level's names to load the other level. Potentially better extensibility depending on your end goals.
silly question, but how do I do that? The parent is Gamemode Base but I am unsure how to call the handle starting player function in there from my BP
ah, thank you
That should make it run old functionality before the override, and then your set view target code.
Yep, my issue is gone. There are other issues but they are multiplayer specific. Thanks for the help
gotcha
So im watching a blueprint video and when he opens a widget blueprint the border of 1920x1080 or 180x720 is automatically outlined in blue for him but when I open a widget blueprint there is no outline and I cannot figure out how to add one
his looks like this
Add any widget to the hierarchy.
No widget.
Any widget but nothing hovered.
Hovered widget.
Thanks
Also a weird thing that happened
I added a progress bar and It was massive and locked in place
but I added a canvas panel first and then the progress bar
and it let me move it around
Widgets will try to take as much space as their containers allow them usually.
so the canvas panel first is kind of necessary?
How do you check on which "Text Box lets say" you dropped an item on?, like i want the OnDrop only take actions if the item is dropped on a text box inside my widget
When you add things to a Canvas, they're slotted as a CanvasPanelSlot. CanvasPanelSlots have sizes, and positions. Other slots like VerticalBox or HorizontalBox will only take up as much space as the child requests. SimpleSlots like a userwidget's base will stretch the contents.
Some slots have settings to stretch or not.
Fair question. You could probably math out the pointer operation for where mouse is, and the widget's desired size/screen position. But I wonder if the Hovered check returns true there? Honestly I rarely use Text for hit testability. Usually if I need that I wrap it in a border and set the border's draw to none for invisible.
I think that will require a lot of math for it to work correctly for every situation, i was hoping if there is a way to return the object that the item was dropped on be it text box, border, canvas panel or anything
Why does everything in here work except playing the animations after repossessing the player?
I have an NPC that randomly roams around. I have a dialog system set up and I want the NPC to stop moving completley when Im in dialog mode with them. I used Set Movement Mode and set it to None, he doesnt move location but he still keeps rotating to where he wants to move, how do I stop him from rotation as well?
thanks
is there a node called set rotation mode or something?
im only just learning so that might sound dumb but from what ive looked through and messed around with it seems like there are movement /rotation variations of alot of stuff
i used set rotation rate and set orent to rotation to dont rotate/0 rotation and it doesnt work
Would you care to elaborate on the second method? How would you compare 2 strings?
weird idk then sorry. I barely understand how I just made this healthbar work so IDK. I figured it was worth a shot suggesting it. Sounds like it would work atleast
Does anyone have any idea or resource where I could learn to make a procedural rope object of some sort, where I can modify it's length or on the fly? I've been using the cable component for a minute, but it doesn't have physics collisions
You can enable physics on cables but they can be janky so YMMV
I think another method is to have some kind of skeletal mesh for the rope, but I'm not really sure if/how you'd go about having a dynamic length for something like that (eg. you'd probably need to add new bones)
my unreal is being a piece of shit. I have a roaming npc and i set only roam if DontMOve is set to false, if DontMove is set to true from class default he doesnt move, if i set it to true through a cast node when i initate dialog itll print to say its set to true but he still keeps moving
Cable physics doesn't seem to work, it goes through stuff.
Yeah that's what I'm resorting to most likely
I think there's some paid cable plugins on the marketplace. I would hope they work better than the builtin cable comp lol
Sorry, stepped away for a bit. In your case, you could likely just == to one of them. It should more or less be as easy as this.
Haha. I think that is the Equal Exactly, including case.
Ahh right it's a Name and those are case-insensitive by default
Im confused. I have been doing my whole game using 3 ISM per soldier. One for the soldier itself, and another 2 for shield and weapon.
So i can animate each one separately.
And i LERP them all when i need to move the whole soldier.
But recently i discovered how to animate materials with WPO. So now im considering doing just 1 ISM with 3 Materials and animate the materials.
So should i redo everything?
Whats best for performance?
I feel like if you're trying to go with the TotalWar style soldiers, the new Niagara skeletal meshes thing might be a real way to go if you're worried about performance. I have yet to test it personally, but supposedly it can support several thousands of "soldiers" in a view at a time
I have seen it. Its a bit hard to implement. However i didnt go for it, because i want to maximize performance and downplay graphics and animations. So im not even doing the soldiers 3d, they are just planes, and they look alright. So that was my option.
Should i reconsider that? If i make them 3D, then i will also have to make them with fancy animations. As it is right now, i only move them around and move the weapon back and forth. I tested it today and it can handle many batallions.
Fair enough. Out of curiosity though. How do you animate individual soldiers in an ISM? I deal too much with widgets. π Less familiar with gameplay graphics implementations.
There are multiple ways to do that
You can animate hismc actually through vertex shaders iirc
With ue5 and CPP it would probably be a good candidate for #mass
How do you get the parent widget? i have a widget inside another widgets canvas panel but GetParent returns the canvas panel not the widget
Easiest way is to pass the parent as self to the child on construct
I use update instance transform.
i'd like to know the harder way xd
I do not know how to get the parent you desire as the parent is not just the userwidget hierarchy
You could ask the parent for the parent etc until you reach your wanted widget
You mean multiple GetParent nodes until i reach the parent i want?
Theoretically only one
Depending how nested the widget is i guess?
No
Make a current Widget variable
Get the parent of it
Save it to current widget
Check if it's the one you want
You 'can' bubble until you find the parent you're after, but generally with eXi on this one. Passing the parent you might need to the child widget is much easier and cleaner. That or store the parent somewhere globally that the children can get from World like a HUD class if it's that important.
If not, get the parent of current widget and set it again
That way you move up the ladder
Yea i was thinking of doing it without having a pointer to the parent, i think i managed to do it sometime ago with i believe either Multiple GetParent nodes or GetParent node with some other nodes but i can't make my self remember how i did
Multiple get parent nodes is def the worst solution
I wouldn't rely on that. It makes me cringe not knowing what the pointers I'm using might be. Correct framework is too important in UI for several reasons and the forefront of that is simplicity of use.
I'd be too sure someone would come along and add another canvas or other widget somewhere and break the whole thing.
The proper solution is the pointer to the parent being set by it
Namely me in 6 months when I forget.
I have not walked upwards in the widget hierarchy to find a parent in very long time
I think i'll just scrap that for now, my main goal was to get the widget under the mouse when dragging an item because IsHovered doesnt work when btn is down
But if you want to search anyway it something like this:
- CurrentWidget = self
- if (IsWantedWidget (CurrentWidget))
2.1. true -> done
2.2. false -> CurrentWidget = CurrentWidget->GetParent() - Go Back to 2.
That's why you only need one GetParent node
You just update some pointer to the current parent you are looking at
I have a memory that I did something with that using DragOperations. I know I did something similar to that with them for magicky ui particle visuals when dragging a widget from one inventory to another.
And replace it every iteration
Maybe I was relying on MouseEntered. Can't remember. Will run a couple tests.
MouseEntered is for the whole widget and doesnt work when dragged as i remember
Maybe. Though yeah, I was using it for inventory buttons. Which were their own widget class.
That algorithm is basically the one you use to walk a linked list where you only know next or previous element.
It's a good idea to get to know some basic algos from time to time :P
Thats what im trying to avoid, separate widgets for everything, becuase im sure i will have a messy project
Don't avoid it. Seriously. In UMG and Slate, embrace it.
The simpler and more reusable you make your widgets. The easier life gets.
Preferably you create yourself a reusable library of widgets:P
I have a bunch of parent UserWidget classes in C++ that I make BP classes out of to add UI elements to. BP is for little more than the widget hierarchy changes. Functionality mostly lives in the parents, and all I have to to to make a new window is inherit, throw some new UI in, style, do specific window functionality, and done.
But if you have a widget with alot of features and buttons inside you'll have to break it into alot of separate widgets, is it really the good way?
Can't count how often I have coded a button with text, a horizontal combo box, a tab manager etc
Hey folks, I'm trying to create a procedural mesh where I place cylinders in a circle. Do you see a way to make this distribute the cylinders evenly in the circle? It seems that I'm doing the calculations wrong because they're clumping up in an interesting way.
Yes at least for widgets you use more than once
Hehe you should write down what your math does
That way you learn the best what is going wrong
Your first iteration gives you 360 for the angle
The second 180, then 120, then 90 etc
Not what you want
Thanks for taking the time to help!
You want to divide 360 by your count and save that value before the loop
And then multiply it by the index and use it as the angle
So if your count is 6, it will be a step size of 60, so first is 0, then 60 then 120, then 180 etc.
Which should be what you want
@silver bolt
My phone seems to dislike "your"..
Consider one simple point for this question. Someone created both a Vertical and a Horizontal box. These literally are the same thing with some basic math differing. But in the interest of keeping ideology basic, they are two separate, very reusable container widgets. The same idea applies to Grid and UniformGrid. UniformGrid could easily just be grid, except with differing sizing math from a checkbox. Make small simplicities are a good way to keep stuff much cleaner. The more you stack onto singular classes, the more likely you're going to end up in places where you want to split them apart anyhow because one needs to do something in one place and one doesn't. And the branching just gets too much.
That's your problem!
Yaaas, thanks @surreal peak
I wonder if we can make a houdini-like reusable operations thing for procedural meshes in UE. Imagine you publish an operation and other people can use it in their procedural meshes.
I'm not sure how Houdini reuses behavior in their node graphs though
I have a base character which has 3 children. I think built into UE4 when a character is possessed it automatically changes the view target to it.
I don't want that to happen on a specific child. Is it possible to overwrite this within BP?
If it matters I am trying to make an intro cinematic in multiplayer, but when the character spawns in then it forces the view target to them and away from the cinematic. It is ugly to just wait for them to spawn before setting the camera because it jerks from the spawn point into the cinematic.
https://docs.unrealengine.com/5.0/en-US/BlueprintAPI/Game/Player/SetViewTargetwithBlend/
and on the PlayerController, there is
oo, that screenshot is interesting. let me try it
It means you might have to set the view target yourself in some cases
But its how you turn off what you want to turn off
yeah I use set view target with blend, but the issue is I set it and then the character spawns and re-sets it
yeah
this option should fix it tho
Yes, but again, pretty sure it will just not set the view target on first spawn too, if thats fine, then cool
If it's not, you'd need to add some code to make that happen when its appropriate
using set view target wtih blend
Yeah I manually set it anyways. It works perfectly now, I am glad it was just a checkbox and I didn't need to mess with C++. Thanks for the help
How do I import a megascan texture?
Advice: I'm making an arpg game and would like to dedicate host it like ark does. Where should I store the data for stuff thats unlocked to read it between maps and game loads? I setup easy multisave but I can't get my brain around where to put the data. I wish I could just use a simple ini file with all the collectables listed and if they are unlocked. I tried putting it in a save bp but struggling to cast to it to write/read the data. I just need a simple place to store basic info
hi, set render custom depth works perfectly fine on PC but on mobile, it won't work. Should i have to enable any other options or any other issues ? thanks for answers
noob question, anyone know what the blue green node is called ? is the blue node LinearColor ? (from a screenshot on the internet)
@teal talon generally Game Instance class, as it exists for the duration of the game instance (across maps).
Hovering over it might help tell you what it is
its a screenshot on the internet unfortunately https://img-blog.csdnimg.cn/20190531160038335.png
Looks like a node which converts a vector 2d to a vector. They're using it to set the z of the vector to 0
yes that's it! thank u very much π
Thats one conversion alright
I usually just multiply vector by vector
VectorA*(1.0,1.0,0.0)
if I reparent my BP to a C++ class with same function names, will my blueprints get corrupted/crash?
Yes
Personally i added prefix for them
To separate it
But it can become quite messy
So AddToInventory became cAddToInventory
But it also ment Inventory became cInventory...
Never bothered cleaning it up after my conversion was done. Lazy me i guess
It usually renames the BP functions for me, but I delete them anyway once the c++ functions are implemented
Id be more worried about the actual reparenting of the BP class having an issue
yikes
Is there any way to set up an array filled with a blueprint's components in the editor that can be iterated through for various purposes?
Trying to set up a weapon with multiple points for sphere tracing
I've had nothing but success reparenting any class that i convert π¬ not sure if i was just lucky
If you straight up use the same fn name it complains about it already being used iirc
Renames it aswell perhaps
yeah????
this is good to hear. I might just try this now
if my blueprints crash/get corrupted I will cry
Its always fixable π
Thats why i went for the safest approach tho
Prefixing π
Structs etc has to be remade in cpp aswell if you intend to use them(and didnt already make then in cpp)
Any way to add float only to one axis in vector3?
just right click on it and press split
aa ty
So I tried using sockets for spherecast positions on a weapon and it works so much better than manually creating the actual points in the blueprint, since it makes it easy for the weapon to be inherited
It also results in much more accurate collisions on fast-moving animations
Sweet.
Hi all, Iβm having trouble restarting a level when the player dies in a packaged version of my game. The restart code works perfectly in the editor, but if I package, it just doesnβt fire. Anyone know how to fix this?
So I've got an item pool with each item having a rarity enum and it picks one based on chance on each level up. Just wondering if anyone knows the best place to store this, on the game mode or game instance or something else entirely? Cheers
It currently gets all the items from the data table and sorts them into arrays, just wondering where to store the arrays so they only need to be fetched once
How can I find out the type of structures defined in the editor? e.g the padding structure? I want to define my own. I realize that may just be a vector 4, but there are others, and I need a general way to figure the types out
Is there a way to get complex Hit or Overlap events through Blueprints or is it C++ only?
Is there anyway I can change a variable on an instance editable and expose on spawn variable? Basically everytime i change the variable, I want it to run an in editor custom event.
For example if I change the weapon class var in the details panel while selected in world outliner, I want it to trigger this custom event.
Read your variable in the construction script, every time the variable is changes , the construction script runs
Generally speaking, I wouldn't worry about the fetching it multiple times in most cases unless you're doing this nearly every frame. Datatable lookup is fast. If you really want to store it somewhere though, I would probably advise GameState. GameMode usually shouldn't have a lot of actual data in it, it should largely be for safe server side processing. If you go multiplayer, this makes it so that players can still see the state when it's replicated.
I'm not sure how you'd handle that in BP. In C++ you can override some post edit functions. If construction script runs after property edit, you could maybe use that.
Okay thanks. Yea I only had it on a level up screen that pauses the game so maybe I should just leave all the functionality on there and sort the tables each time
Yeah. I wouldn't bother unless you're doing some Diablo level stuff where you kill 100s of things on screen and they drop stuff based on those tables a lot. π
Yea definitely wont be using it that much haha. Although I'm thinking of adding an item shop into the game as well which would work similarly, would I be better off storing it in the gamestate then just so I don't have to code the fetching and sorting on multiple menus?
Maybe. At that point I feel like you should consider looking into DataAssets. Datatables are nice, but they're static and have no functionality besides just holding data. DataAssets can both hold your datatables as properties, and also have functions in them that can pull sorted data, or whatnot. And you can get them globally from anywhere since they're static data.
I love Datatables for data entry. Their ui makes it much easier to do. But DataAssets make sane UI data handling possible. π
Oh that does sound much better actually, I thought it was weird that there wasn't really any functions to work with data tables and that must be why haha thanks for the help
Hey guyz, what's the node to draw the complexe collision on runtime?
Good point I think it might, unfortunately tho u canβt spawn stuff in construction script
You can't spawn actors in Construction Script, but you can create components.
You can spawn with editor functions tho
And probably loop around the construction script limitation by stuffing the spawn in a function aswell
The usual loophole
It sounds like a recipe for a disaster tbh lol
They actually fixed that in.. 4.26 or 4.27 if I recall. π Cause, y'know. Fix the stuff people mean to do intentionally, not the stuff that actually needs fixed.
I thought of putting it in a function but I didnβt want to jerry rig it lol
π damn
Say I have an open world survival game. What would be the better implementation of the world's subsystems? A separate actor placed in the world for each system? (audio, weather, Day&Night, etc) or should I make a single actor world manager that has all of the things listed above as components? Or maybe it shouldn't be an actor at all? and should be managed in the game mode?
If you're blueprint only, then maybe a component on GameMode/State might be better. Depends on what it's managing. If you're using C++, then a literal WorldSubsystem would be good for a world subsystem. π
Nothing really wrong with dropping an actor into map too if you want, but it's tedious to have to remember if you have multiple maps.
I am blueprint only, c++ is too much as of now hahah
Got it, thanks, i'll lkely do components on the game mode
Maybe the component. If you ever go C++, it'll be an easy translate to a real subsystem.
aye, thank you π
Do I understand it right that if I have a custom event with let's say 15 nodes in it and I call this custom event from a different BP then it fires the event and moves on immediately without waiting for those 15 nodes from event to finish?
Depends on the nodes. If they're not latent, then no. In computer logic, everything is one by one in order of logical operation. Latent nodes like delays start a timer and only continue after that timer and the timer isn't evaluated until next frame. So any non latent node will run in order until it's done.
Case one for non latent.
And with latent.
I've made a simple proximity door, however the player frequently leaves the box collision area before the door has finished opening, meaning it doesn't trigger the 'door closing' event went the player leaves the collision area. Any ideas how to fix this?
use Interface Class instead of the actual interface.
@maiden wadi Hmm... that's interesting, I was reading how we can't know when custom events finish, that we only know when they start, but from what you are saying it seems like non latent functions will always follow the order. That's a bit less headaches, thanks for helping out
thank you
hmm, you cant use interface it seems. but you can use class.
I think that might be a badly phrased point, or just someone who doesn't understand, I don't know. It is true that you can't always know, because you don't know if someone can latent it later or not. As someone who authors the entire logic chain though, you can absolutely know. If you need that form of security, you can just make the event a function too.
As functions cannot take latent nodes.
Either start closing the door immediately. Or when the door finishes opening, check if a player is in it's range and start closing it there.
Is there a node to check if the player is in range?
Oh wait I found it, thank you! :D
Hi everyone, do you know how to plug in 'ignore' input an array of StaticMeshComponent?
Its actors to ignore
Not components
Component != Actor
You'd need to filter that yourself
I highly doubt that. It's more likely that you think its set to false when its actually set to true. Try adding a breakpoint and stepping through the nodes one by one confirming the values are what you expect them to be.
hello guys
can you help me with vector maths? everything I want is some ray from X point that goes by red pointer then greent pointer and stops at blue dot
how can i filter that ?
When i switch Gamefeatures into active, it just activate dosen't it? but it doesnt π₯²
and "ChangeBundleStateForPrimaryAssets failed to find NameData" what this means?
Do you have the starting position of the red vector, the red vector itself and the blue dot's location?
1)start - yes
2)red vector - yes
3)blue dot - no. thats what I need to get
So how do you know where it should stop?
What is the logic for saying, "yup, this is where the blue dot should be" ?
just went through everything I know to try. I tried having the game set the booleans to false at beginplay. I tried it where I had the default value as false I tried having the boolean inside my character and out and regardless it always executes true and I am not sure why
I want length of green vector to be ~1000 of whatever UE measures distances
Apply your filter on the hit array
I think there is a node to get the reflection vector/rotation, not sure what it's called
So green vector is always -1000 in X direction?
Add a breakpoint (F9) and step through the code (F10)
on the branch?
i want to test lyra's PROTO inventroy feature, i did activated this features somehow accidently last time but now i did try it again, it dosen't work. and i can't figure it out how this turn on.
UE doesn't just randomly think bools are true when they are false and vice versa. The problem has to be that you expect it to be one value but its actually another.
Set the breakpoint on the start of the event, just anywhere before you are checking it on the branch.
Thanks
fixed it
direction on the screenshot is just for example
I want to know how do I make some vector turn left/right/upwards/etc after some distance
like on this screenshot
Add the vector with a forward vector from a rotation?
RedVector (normalised) * distance to corner + Rotate(RedVector (normalised), Rotator(0, 0, 90)) * distance left to travel
That would rotate it right 90 degrees
-90 for left
Your red vector might be ActorRightVector or whatever the name is
(for right) ActorRightVector * -1 for left
If you know the vector points (like from navigation) it is quite easy to trace along the path
well... looks like I fucked something up... can you tell me whats wrong? I really dont get it...
when I set it to Z the problem remains
and I want to rotate in all 3 axis
why am I still getting an accessed none error, even when using an IsValid check? how can it physically be wrong? and nothings even wrong in gameplay, I just want this error to shut up
I'm making a character creation screen and want to store relevant info such as an array of character classes to choose from.
Should I store this in the level blueprint or in the game mode?
Single or multiplayer?
Single player atm but curious how it would differ in multiplayer
would be a good use of either data tables, or Data Assets
you could add all associated trait modifiers
such as humans have 1.2x speed, humans have 0.8 charisma, etc
then when giving the user a selection, just load up all available the data table/data asset, and automatically apply all character trait modifiers
> atm
So it will be multiplayer later on?
i found out something weird bug, when i start lyra game it dosen't proto feature on despite of activation
but i press save actionsets , it suddenly features turn on
i just press save, then it working now on. but after restart editor i should do it again.
maybe it conflict with EnhancedkeyMapping, but i don't know.
LogAssetManager: Warning: Invalid Primary Asset Id LyraExperienceActionSet:LAS_InventoryTest: ChangeBundleStateForPrimaryAssets failed to find NameData
and this one is also i can't figure it out
Yeah let's just say it's multilayer
I mean, it's something that has to be decided early on. Multiplayer will be more picky in the workflow..
Yeah that's true but it seems like a lot of different things to calculate when the user switches classes. I have a lot of their stuff set up as data tables/assets in each respective blueprint instance so it seems to make sense just to switch instances
Converting from SP to MP can involve rewriting your entire game and all your animation assets if you do SP badly.
Just a heads up!
hey guys ! I've been having this issue quite a while and even tried different AntiAliasing methods and disabling Motion blur but nope. I get this weird looking effect on every Emmisive Material
havent found a solution on the forums ;/
Looks like temporal AA
tried it, and TSR as well
TSR gives me good results overall, but this kind of emmisive rotating and moving stuff gets glitched
How can I run multiple copies of an event with a delay node in it? I can't turn it into a function (cuz of the delay), and I can't simply retrigger it since it might not finish by the time it is triggered a second time.
Context: It is a function that triggers a list of other actors in a scene with delays. In this particular actor, there's two lists: one it starts at the beginning of it's function and another that it triggers at the end of it.
Then on save I save the game instance data? and on load replace it back in?
Short answer is you can't. Long answer is that you can add a component that manages each individual delay that automatically destroy themselves when the timer is done.
Damn, that sucks. Though, maybe good actually, for now I'll modify the logic so that the second targets will begin triggering only after first were finished (the actor will remember that they are to trigger)
You could sequentialize them in an array, and only start unique countdowns
hey
for the character controller
why does it teleport anytime I change a parameter?
Character Controller? Sounds a bit like you did some movement setup on the Construction script and it's running on property change.
Like when the game is running in editor
and I change a variable in the character movement
they just teleport
here's an example
is there a way to stop a delay while its playing
Yes. But not in Blueprint alone.
ok thankyou
there's nothing in my construction script.
Hey, is it possible to import a material inside another material? Or do I have to convert the 1st material into a material function?
Hard to say. Definitely looks like some sort of post edit reset. Hard to guess beyond the construction script.
Weird, I thought if it would reset; it would have sent it back to the player start.
Better question for #graphics. Not sure what you mean by import. You can make material instances (static or dynamic). You can render a material to a target and use that target as a texture.
Does anyone know what I should be editing for the character movement variables; I want my player to be harder to turn but still stop normally.
because currently all I can do is lower the friction, which does make him harder to turn, but also makes him act like he's on ice whenever he tries to stop.
The crux of the issue is transparent materials don't contribute to the motion vector map, which UE uses to retarget previous frames into temporal AA, and to do motion blur. The result is that motion ghosting you're seeing. Not sure what the workarounds are other than make stuff opaque or don't use temporal AA. Ask #graphics.
Thanks, I didn't know where to post.. What do you mean by "render a material to a target" ?
And by "import" I meant get the output of the material inside another material (to tweak base color for example, and add more functionalities)
Idk the process in detail but you can make render target assets, and use Capture components to render perspectives into it. Idk offhand if there's a version that renders materials into textures alone.
Oh yeah I see
You can add parameters to master materials in the material graph, and then create material instances of that where you can adjust the parameters
(in addition, in blueprint you can make dynamic instances if you want to set or animate the parameters during gameplay)
Thanks, I think I'll convert the material into a material function because I would like to keep the base simple
@blazing kite https://docs.unrealengine.com/4.27/en-US/RenderingAndGraphics/Materials/HowTo/Instancing/
Yep I know this stuff thanks ^^
Dose anyone know how to do a lock on system like zelda?
thank you very much!
Not entirely. I imagine you have to do some [shape] overlap actors thing to produce a list of targetable enemies in view, sort the targets in some fashion to select the most likely one the player wishes to target, and then use the Find Look At Rotation node to make the player face the target. I'm sure there are a lot of game-feel subtleties involved too in making that system feel nice. Override turning with strafing. Highlight the targeted enemy. Switching targets. Etc
Ok thanks for the info.π
is there a way to remove an actor from an array without providing index ?
Yep, just use the "remove item" node
yes i found it thank you
yo
for some reason
my line trace doesnt end directly in front of the camera
How can I fix
how do you expect it to ?
wdym
how do you expect it to end in front of the camera?
you're not providing the camera location
but it got its forward vector
tf
well I want it to start at the actors location
and end directly in front of the camera
in front
if you want it in front of you can invert the camera forward vector, multiply it by some number fractionally smaller than whatever cameraBoom length you got
my brain hurts
just do *-1
on the forward vector of the camera
and multiply by camera boom length
add that to the actors location
= Profit
how do i make an actor not be able to go into the array again of get all overlapping actors after removing it.
add it to some ignored list
is that a function or node in game or will i have to make one
you need to make it
and remove them from the list of overlapping actors if the actor also exist in the ignored list
Hello everyone π does anyone know how I would get my character to move around an object while moving left and right.
how can i use a variable that i have decleard in a blueprint in an other blueprint?
Gotta admit i was a bit disappointed by the content examples
But it shows some principles atleast
Hardcoding is seldom desired
anyone know why i'm getting these errors? i'm using default fps blueprint and animation blueprint and only things i've changed are circled in red
https://cdn.discordapp.com/attachments/660585049896386604/980223548331294750/unknown.png
https://cdn.discordapp.com/attachments/660585049896386604/980223617294016512/unknown.png
https://cdn.discordapp.com/attachments/660585049896386604/980223698399264778/unknown.png
and you have to check variable for validity
Does anyone have an Idea how to cast an String from a Widget to an Actor?
I dont know really how i can explain this. But basically i need to get a Variable from an Widget to the Actor because in the Actor theres my tcp client
Yes ... of course there are other ways and multiplayer considerations if applicable, but the class is intended to handle data across maps.
Blueprint Runtime Error: "Accessed None trying to read property K2Node_CustomEvent_Instance_2". Blueprint: ArmyPlanesAdjustable Function: Execute Ubergraph Army Planes Adjustable Graph: ForLoop Node: Branch
Im getting this error. And i cant locate where its coming from. When i click it, it brings me to a the macro for loop. How do i locate what's causing this?
I got the across maps to work today, thank you!!
ah iknow why
you mean when i receive it put it in a variable first and then make stuff with it?
yeah it does it when the actor spawns
hi
somebody can help me, when i move my spline, It has no effect, it keeps the basic spline as if it were in 0.0.0
How would I make an object shake up and down using blueprints?
hello, in this tutorial he uses a function called vector * float that i don't seem to have. its tooltip in the vid is Scales Vector A by B and Target is Kismet Math Library. I found it listed online but idk why i can't use it
I got a plugin from the marketplace called tcp client and server. Thr problem on the String to Byte thing is that i cannot connect the string pin to anything bc its put there as an output lmao
If you put UPARAM(Ref) before the FString parameter, it will fix it
(in the c++ source)
Shrug
is there a selector in the options where i can select visual studio version?
Or, tbh, just make it a const FString&
Just edit it with notepad
It's a quick edit right?
and btw do you know where the plugins are stored?
Your project/Plugins?
aah i got it xd
Find the function signature and change it... assuming it's meant to be an input parameter.
i got 2 folders
got it
Change FString& to const FString& (both there and in the header)
i dont know why its not working
You should be able to generate the solution files from your project file
And then open that with VS.
Not sure, but experiment with world and local space. Usually issues with things not tracking or being unexpectedly offset arise from that. Your "get transform" node has a world/local toggle, and you can set world space transform instead of relative (local). Play around with that.
that one?
In explorer
nah still there
Yeah, that.
still not working
Shrug
is there a blueprint node (or other way) that allows you to check if the currently running game instance is a packaged game?
alternatively, any way to check which build configuration the current instance is using?
background: I've got some logic I'd like to run based on if it's being played inside the editor or in a packaged game/standalone version.
Looks like there's only a way to do this in cpp for anyone else checking: https://forums.unrealengine.com/t/is-there-a-way-to-check-in-blueprints-if-your-in-standalone-game-or-not/284133/14
Hello, I have a problem/question, im trying to implement a system similar to Mortal Kombats Fatality system, if you press certain buttons in a certain order, something will happen, Im sure this is something easy but I just cant figure it out, so I was wondering if anyone could give me an idea of how to do this, Thank you!
Yeah there's some built in node like "is packaged for release" or something
Try searching the node library
Hi guys! Iβm new to the discord and to unreal engine and iβm having a hard time fixing an issue on my first game: iβm working on an endless runner but i want the player to be able to fall from the plattform but i canβt make an βinfiniteβ kill volume so i iconsidered making the kill volume follow my player on a single axis so as the player moves forward the volume will always be bellow them and make sure they die if the fallβ¦ any sugestions as to how i can acomplish this? Thank you very much in advance guys
Iβm also having the exact same problem with the player start so when they die they can respawn where they left off so if thereβs a way to also get that to follow the character or having some sort of checkpoint on every tile that would be a huge help. I haventbeen able to find anything online that helps π
You could quite quickly create a blueprint node that does this
(of course, that would require a C++ UBlueprintFunctionLibrary)
the suggestion here is to generally make the world move around the player and have the player just look like they are running across it
Free plugin with IsShippingBuild node and more on the marketplace LE Extended Standard Library
That makes sense but my character is just a ball with applied forces and getting pushed around by enemies so keeping the character static and moving the world may not give me the desired result. I already have spawning tiles and i was hoping something similar could be done for the kill volume
In this case it's more about not having them move forward towards the uh, direction the runner goes in
in case it is just one way
Here u can see a bit about what i mean
You could just check your z position, if you are below the tiles respawn at a position slightly back in correct position
just hope you don't go more than a few kilometers or so out max to avoid floating precision issues
should be fine though
How can i do that? It sounds like what iβm trying to do, but when the ball falls i canβt kill it and the respawn is at the beggining of the level which gets deleted after a couple seconds
you could also track the last position the ball was in
Yeah, just check the ball world location on tick, if the z value is below the track significantly you need to spawn it back on the track, or just move it to that location would probably work.
If the track is flat, you can also store the position if it is on the track z position, then use that as the restart location
Thank you so much guys! Iβll look into all of these suggestions
Yes itβs a flat track and iβm trying to set up the respawn system to get the x position so it respawns on the world but for some weird reason nothing seems to work and it goes back to the begining of the level
Probably because iβm not familiar at all with coding so i must be doing something wrong
This is my set up to get the x location of my character
And the spawning set up
Performance wise, is there any good place to store a player BP reference that can be accessed globally?
Like casting to player in game instance once and getting the reference when needed instead of casting to player in specific BP's.
Would that reduce memory usage/increase performance or would it just be as bad/worse?
If it's single player, then just create a blueprint function library and create a pure function that gets player pawn and casts it and then returns the appropriate player BP you want to use. Then you can just call that function globally and get a reference to your player's character.
There's nothing specifically wrong with casting when you need to. Casting only starts causing problems once you start casting like 100000 times a second (eg. On tick, looping through a large loop where you're casting to get the player character on each loop, but why would you do that when you could do it before the loop and then you're only casting 60-240 times per second depending on frame rate).
Alright, excellent answer, thank you!
Will look into blueprint function libraries more, haven't worked much with them.
Not sure if i overuse casting, i try to use it on begin play everywhere i need it and store a reference, i just feel i used it in a lot of places and worry it might slow things down/use a lot of memory.
Some people seem to avoid it like the plague and say it's terrible for performance, hard to know what is what π
Now that i think about it, is it bad to create the ref on begin play? Maybe it bloats memory with everything storing a ref to player (as that is a big class in my case)
You should think a bit about which classes you tie together tho
Nothing wrong really with storing a reference to it, but then you have to make sure the value gets updated if it ever changes eg. if the player's character gets respawned.
A reference is merely a pointer to the data, not a full copy of the object itself in memory, so it's relatively small.
Its also good practice to keep variables private, and have functions for modifying them instead, to give you easy troubleshooting/refactoring/adjustments later on without having to check a ton of other classes
Ah right, so reference could break if the player gets respawned and the level isn't reloaded since the object referenced would have changed? Never thought about that, thank you!
It could break*. Depends on how you restart the level really. Other actors can bind to an actors on destroyed tho, so you can react accordingly
i have a bpi call to get a player reference, don't need it too often so it works well for me. only other place i store a reference to the player is in the manager component on the player, and for respawning I just pass a reference to the game mode from the character.
( i is tired, late night had to fix my repetitive typo lol)
lots of great stuff, thank you everyone! π
Use OnTick, not OnBeginPlay to collect the spawn position, at the moment it is only when you begin the game. Set the correct Y and Z values for the Spawn position as well, but just align the restart to the center of the track.
wouldn't on tick set the position every tick? if you want them to respawn at the death spot i guess that would work
Cant you just fetch loc on death?
Yes, at the death spot x value, but aligned to the center of the track. Preferably gate the tick with a check for the z value prior to storing the position
Hey everybody. Has anyone had an issue with aim offsets in UE5 jumping all over the place as if the offset is being reset and reapplied every tick?
Wants to check if it has fallen off the track, check the z value. Just keeping it easy for a newbie
think it would be simpler just to get it on death like @gentle urchin said, so your not constantly setting a variable that you really don't need to.
OnDeath-> GetCurrentTrackPosition -> save as respawn position
Is this mario kart like? π
Oh nvm ball rolling
Well i guess it could be a tick check. Id prob just use collision volumes
ticks going to give same result as a on death though.
best to avoid using ticks when its not really necessary.
its just a quick way of doing it volumes work fine, but its their first game.
Makes the tick approach even worse then, imho
thinks back to when i first started
If people would of told me the correct way, rather then the 'quick' way on things, I probably wouldn't of had to recode, recode, recode.
no offense... just saying π
I agree you shouldn't use it needlessly, but in this instance its probably more useful than trying to explain setting up a moving volume for a small endlesss runner
Not just that, but the programmer may not be aware of the potential cost of using tick, how often its executed, or why its bad to do getallactors on tick with a looping distance check and whatnot
Anyhow :)
if i have a collision sphere on a character how can i see it in the game ? it there a way to make it visbible like sphere trace etc ?
^ theres a setting, hidden in game
select the sphere - uncheck hidden in game, and you might want to change the 'draw size' from 1 to like 5 so you can see it easier in game.
thank you
I have this connected to a event tick but it is being run multiple times instead of once, have can I make sure it only runs the code after the set delay to 5 once
timer?
im lost
what would that do tho
run every 5 second
I want it to check weather a value is == 0 and when it is to send a message 1 time
but it runs it 2 times instead
well show more code then
floats are inaccurate
so checking for 0.0 is usually not a good idea
why it runs twice, nobody can tell you based on what you've shown
check if the delay is <= 0
only making it smaller
yeah well idk either, when i put a print string after the set to 5 it prints it twice
in two frames i bet
?
need to see more of the logic
something is messing with your delay
resetting it at some point
if it fires twice
that is all the logic
Well ok then
doing this on tick, removing 0.5 from a 5.0 delay on tick,
its gone in 10 frames
at 60 fps thats 16ms
Unless he's set the tick rate to 0.5
Doubt it π but could be, i guess
?
Have you set the tick rate to 0.5 ?
tick rate for what
the actor running this code
don't think so
16ms @ 60 fps it is then
this?
yeah
I'd suggest moving this away from tick in the first place
for two reasons
- It doesnt seem to really belong to a "per frame execution"
- It can become very costly to use tick if you're not sure exactly why or how often it executes, and deciding if your code is fit for such rapid execution
Hint: Most things are not fit for tick

