#blueprint
402296 messages Β· Page 753 of 403
I think you're running into the reason FName was created
whats that
Or even GameplayTags, which are just nested FNames mostly.
Hi guys! Help me with the question. I'm making a game where the character is controlled with the WASD buttons (moving forward, backward, sideways). But I need my character to turn in the right direction regarding how the input is being used. I mean to be able to rotate the character with the mouse inputs.
As far as I understand, do I need to somehow convert float values to rotate?
Can anyone visually show how it should look?
Sounds like regular add pitch add yaw, using control rotation?
If you mean the moving the mouse left/right will rotate the character left/right, then definitely just do AddYawInput. If you mean to have the character look at the cursor, I'd recommend doing a mouse projection with some math via LinePlaneIntersection functions.
I tried to do it through the cursor trace. It works, but there are nuances. It is necessary to fix a lot of elements of the environment. I wanted to make such a logic that the character looks in the direction that is relative to him to the cursor (but without the cursor), which means through the mouse inputs.
So regular add yaw input?
That's how I have a rotate right now. And I want to replace it with mouse inputs.
But how to do it (due to the fact that I am a beginner in the engine), I donβt know how to do it.
I want to attach a cable to a skeletal mesh and after an event, the skelatal mesh will be destroyed and i want the cable to have attach start unticked
how do i set that up in blueprint ?
Search for the variable AttachStart or something similar (I don't exactly recall) and set it to false, it's a Boolean
Sorry, I had to take off for a while. Are you in a cable component blueprint? Unless it has custom code, you don't need to subclass it.
Alternatively did you just create that variable?
Oh this is level blueprint. Drag off the cable component and search for AttachStart. Choose the SetAttachStart and make it false
Yeah?
This variable gets set off the begin play, and I can see that it was set, yet when this function gets called, in the Message Log it says that it got None when it tried to read the property for the variable. Everything in the editor runs just fine, but I want to clear this error.
probably something with it not replicating correctly? perhaps try over at #multiplayer
It doesn't need to be multiplayer though as this is going to be a UI function
have you checked that it's not a replication issue though?
I've changed the custom event to no replication as well and same result
right but I mean when it's being read by the game
What actor is the In Game WRef being set?
It's the player character actor
Can you show the code you're using to set it?
Essentially this is just sending a message to show up on the screen, fancier than using print string lol
What comes before that?
Hooked into a sequence off the begin play
What is the object that is being plugged into the cast?
oh sorry
So that cast is failing
OR
You don't have In game WRef set in your BP Jig Character
I ran a isvalid? check after it was set and print string and it set correctly.
double check via breakpoints
What you mean by break points?
With a node selected press F9 - it'll mark the node so that when executing it'll pause at that point. Allowing you to inspect variable values by hovering over pins and validating the logic.
F9 again with the node selected to remove it once you're done testing
What is W Game Wref? Is it a widget? And are you playing as client?
It is a widget, I was playing in Standalone but switched to client, and still same issue.
The widget is initially set in the character, the component that is attached to the character casts to the character to get a quick reference and then calls for the widget so it can set a direct reference to the widget as well inside the component.
This way the component can use the widget reference to call the function that will send notification messages to the player
So widgets won't exist on server, so that's part of the issue.
If you're creating the widget on begin play and then also trying to get the reference to the widget on begin play in your actor component you might be running into an issue here..
Instead you may want to consider just creating the widget reference in the actor component instead and let it bind itself to it.
Okay so i'm struggling to figure out how a blueprint can read another ones' variable. Does only casting to the object work?
Lets say I want to pick up a key, set that ones variable to true and in the doors blueprint i want to ask for it?
I have set that variable and it works as intended, however when i try to access that variable from another blueprint, its not working?
So, begin play, is that always going to be like a server side thing?
Begin play fires on server and on any clients that it's relevant to.
You can usually use a Has Authority switch, but they don't exist in actor components.
What I usually do in that case is check the owner's authority instead.
Further to this image, since the widget doesn't exist on server, you can't pass a reference of the non-existant widget to the client.
that's what I meant when I said check if it's being replicated
Oh ok. I'll try swapping it around then.
Yeah sorry I thought just switching the custom event from client to not replicated was enough to test that
Can someone help me and explain why the lines are not white ? , IΒ΄ve been trying to fix this for an hours and nothing seems to work
I alredy tried that
take a look at #animation I posted the result there
i'm trying to make a minimap using rendertarget. is there any way to isolate only specific objects? i just need to capture my vehicle and the track
Hi everyone, how would you make a system of "rising" ? I have a level in which some lava is at the bottom and it need to rise up forever. I thought about using a timeline and a node which set the actor location up until like a billion unit very slowly so that it works during playtime (it's a infinite game that's why I need to make it that long), do you think that would work ?
Instead of the lava rising, why not make the level/platforms shift down while the lava stays still?
If you actually rise the lava, you'll screw things up due to floating point error in large numbers.
How can I get sublevels of my persistent level in BP?
Let me know if you find a better way than this... https://forums.unrealengine.com/t/get-names-of-streaming-levels-in-editor-world/252148/3?u=eobet
I think I solved it, but this is so dumbβ¦ π€£ And dear lord, this is how to get the level name that each actor is inβ¦ π€¦ββοΈ Iβm really, really hoping for Cunninghamβs Law to kick into action nowβ¦ π Now, hereβs the really, really twisted thing: The level name that an Editor Scripting Utility wants in order to switch level is NOT the same a...
what do you mean by "floating point error" ? It's just a plane with a box collision above it which once the player touch it make game over state. There is no big details on the lava beside the material & it's a side scroller, the lava is only affected by the player btw
@dim robin There is a list thing on the capture component. This needs to be filled with the actors you want to see and then there's a setting to show only those.
if all your levels are known, store them in a data table that you can then load in on your game instance
I've done a similar thing, except it's extending UDevSetting on the cpp side
so it's in the project settings
Eventually if you move far away from origin (0,0,0) floating point math will start to break down as they can only be so precise with larger numbers. If you are constantly moving upwards with your character, assuming that the level goes on infinitely, then you'll eventually be very far away from the origin, which means a very large floating point number, so the precision goes down.
So if you have something like an infinite runner, or your case, a potentially infinite tower, it actually makes more sense to have your level move rather than the player moving through the level.
i made this setup to check whether or not the player is looking at an actor. this works as long as i dont face the opposite direction of the actor. if i face left or right compared to the actor, it knows that im not looking at the actor, but when i face all away from it, it thinks im looking at it for some reason. is this a bug, or do i miss something?
I don't know your game type
but if your camera is first or third person, you can make an easier setup for yourself
its first person
in that case, use the dot product between the camera's forward vector AND the vector difference between the camera's location and the actor's location normalized
so something like
Dot(camera.Forward, (camera.Location - otherActor.Location).Normalized())
hmm
that's one of the cheapest checks you can make generally
ok, ill see if i can figure this out in blueprint, 2 sec
sure, feel free to paste screenshots if you're in doubt
I don't have the editor open right now
normalize is a function
for vectors
I'd see if you can use the actual camera, and not camera manager
just in case
im using the character blueprint, so at the moment im not sure about how else i should get the camera
isn't there a camera component on the first person character?
nope. ive always just gotten it through the camera manager
alternatively you can probably assume that the character's forward vector is pointing in the way of the camera as well
is this the normalize function
hmm yea. ill try that
yeah that's the normalize
ok. wait so that is normalizing?
1 means that the actor is facing the other actor, 0 means it's to the side of the actor, -1 means it's facing the other way
ok, ill test this out
ok, im doing something wrong here lol. so what should i put after the dot?
i can see the number changing depending on where i look, but its in a lot of digits
the dot is your final check. so with what I said before, what do you want to do with that logic. do you need something to execute when the player is looking at something? when they're not looking at something? etc.
it should execute when the player isnt looking. so i was thinking about a simple, greater than, or less than, branch. but the numbers also change depending on my position. it should only be depended on rotation to check whether the object is inside the screen or not. btw thx for the help so far, i appreciate it.
yeah so basically any number less than or equal to 0
maybe less than 0.25 or something, but that's something you can adjust potentially
ok no, its still huge numbers
when i look at the actor its negative numbers, and when i look away its positive numbers. but this change when i walk past the actor
you have to normalize
i should add a normalize function after the get camera location?
after you subtract
yes
the two locations
before the dot
yes
aah, i got it
hmm... how should i explain this. when im on the -y axis and +x axis relative to the actors location, the dot number is positive. and negative on +y and -x axis.
it shouldnt be based on your axis
it should be based on whether you are facing the other actor
well right now you are doing it with the plane
Hi!
This calculation should get an individual player score and add it to their team, it works fine so far but the calculation itself is flawed. if a player has 1 kill, the team has also the value of 1. so if that same player kills another enemy, this means the individual player score (Enemy Kill Point) has the value of 2 and the team already has a value of 1 which then gives the team the value of 3 in total but there are only 2 kills performed. how to avoid this nonsense or what is the prober calc. for that?
yea. i was doing it with an array of planes before, but i just chose one to make this easier to work with. it should work the same way with one plane.
do it with a random actor instead
if you are just testing
the plane will not give you correct results
as it is below the player
no, its a plane on the actor
that wont work at all
Just add 1 instead of the existing enemy kill point?
ok so, i have my player, and another actor. the other actor has a plane component on it. thats what im using now
and the numbers do correspond to the location of the plane
they just change depending on where my player is
it should be facing direction
I don't know where that plane is
but judging by your setup it seems to be sharing local space with your player
the blueprint is on the plane actor. i reference the player from the plane actor
so the plane and the player are not related
hi!
if it comes down to just adding +1 for a player kill that makes sense, I am also planning in adding more ways to gain points instead of just 1 kill = 1 point, so i tried to make a uniform function that does the calculation and basically stack these numbers on top to then calculate the team value -- if that makes any sense
anyway the calculation is the one you want to use. it's your setup that is wrong basically
and maybe the player camera manager
(potentially)
aaahh... the minus input had to be swapped
it should still give you the same value
not when its minus
well it's a value beween 1 and -1
these had to be swapped
it is still a value between 1 and -1
it doesn't change
you just reverse the direction you are checking against
i mean... actually i have no idea. i just stopped with the weird location stuff, with positive and negative numbers
i can try to switch it back, 2 sec
can you show me your print out?
ok, im freaking confused. you're right, it does just inverse the output lol
@wise mantle there is a function called "was recently rendered on screen"
Or do you you mean directly looking at?
If your team score is just an accumulation of the points earned by your players on that team, then whenever a player earns points, you add whatever points they received into the team's points, not what the player's current score is. So if your player earns 1 point, that 1 point should also be credited to the team they are on, and that's it. If the player does something that adds 5 points to their score, then that 5 points should be added to the team's score.
yea i did try the "was recently rendered", it had some limitations tho. what CE showed me might work better. so far ive tried a bunch of different methods to know whether an actor is on your screen or not... i mean, i get that programming isnt the easiest thing in the world, but ive spend pretty darn much time on just figuring this out effectively
There is last time rendered on screen, aswell as recently rendered, aswell as time recently rendered. There is also a "line of sight" function. Don't really want to set you off track here but worth checking out if you continue to not find a solution
I guess I tried to over-engineer this, it is as simple as your said it
thank you
Casting to BP_PlayerCharacter fails but I feel like this cast, in the PlayerController, should work, even though I can see it fails when starting the game
Or am I being stupid? 
actually... from what ive gotten so far, @odd ember 's solution actually seems to work really well
light of sight is much more expensive. you usually use it in combination with the dot
after the dot is true
Yup
which is perhaps worth mentioning: dot has no way to see if there are any walls
you have to check that yourself
i have a raycasting system to check that
but this works perfectly with the rotation of the player
it's not time rendered on screen
it's last rendered
occlusion rules are not always straightforward
sometimes it renders off screen. and sometimes, really offscreen. from what i remember, it also had some weird issues when looking in the opposite direction
Oh ok
but thanks for the recommendation, and also thanks to @odd ember . i really appreciate it. this is working perfectly π
Imma just

owner of the player state is pc
player controller
Isn't the PlayerController owned by the Player state?
The player state is owned by the player controller.
But even still, casting a player controller to a player state doesn't work. You need to get the player state first, then you can cast the reference to your desired playerstate class.
If you want the player character, then you can get the owner of the playerstate, then get the controlled pawn, then cast to your desired character class.
where's that diagram
I feel like I'm really misunderstanding this, or like I send the wrong thing
The blueprint is in the PlayerController
that's not how object oriented programming works
the player state may have a reference to the player controller
but that does not make the player state owner of the player controller
in the pattern of UE4's multiplayer framework (I suggest reading the guide that one of the mods has made, it's probably pinned in the multiplayer channel), the player controller is the manager for all player related classes
this means player controller manages: player character, player state, player camera manager, etc.
so if you want any of those, you can go through the player controller
Caveat: If you're running something on the client, they don't have references to all player controllers, only the local one.
yeah the server knows all, client only knows their own
Well casting from the player controller doesn't really work either so 
I guess I confused this together at some point 
Hello, I have a pure function that has an output. The output is coming from a refernce variable and then getting a certain variable but what I want to happen doesnt seem to work.
Here is the function. Is this due to the ComputerScreenREF only being set once so anything that happens after that doesnt get applied?
no, the reference holds just a pointer to the real object
i guess whatever you are doing with the result might be wrong
the method you showed looks okay
except for it's weird name π
Hm. So the output of this function (Product Struct Map) goes into the input of an add function, so it should be setting the values of the Product Struct Map in the ComputerScreenREF, correct?
not sure, it might just return a copy of the struct
so it never gets applied to the real struct on your computer screen reference
that would fix it yes, but i don't know if you can return a reference
Ok. So what are my other options?
I have a struct variable in the current class so could I set cast to the Computer Screen, get that struct, then set the current struct to the Computer Screen Struct, then just reference the current struct as needed, then once does, set the Computer Screen Struct equal to the current struct?
structs in BP are all copies, not pointers
which makes it a bit harder to manage them properly when you want to set them
if you do what you did in the function in the same graph as you add to the struct, it might work, but i'm not 100% sure
Oh, instead of making it a pure function?
instead of making it a function at all
The only problem with that, is this pure function is used multiple times.
technical debt is real
What other option do I have?
right now? I don't think there is any
That seem to have worked. Odd that using the pure function does work even though the contents of the function are the exact same as what is working now.
structs in BP are nebulous entities
Yea. I guess doing it this way is nice as now I only need the referenced variable instead of updating this variable each time I needed the updated verison.
I had an issue with my AI structs not working when I created them in BP. I then wrapped the same struct creation in a cpp function and everything was fine
Crazy things. Welp, I keep going at it and see if this continues to work. Thanks for the help.
I don't think I did anything, but you're welcome I guess? π
anyone know what i have done wrong here? the actor wont be destroyed properly on clients
it stops taking damage but mesh remains
on server however it fully disappears
If it's a replicated actor, you only need to destroy it on the server.
Hey all, hoping to find an answer on here. I have an enemy character that can be hit and damaged by different kinds of projectiles, how would I set up the BP to allow for multiple hit events? Since I can only use a single hit event, I'm guessing I need some sort of flow control leading off of it, but I'm not sure.
Your projectiles should probably handle most of what needs to happen. You can use these nodes to pass and receive damage from your projectiles to your targets
i dont know why, i already setup the start with actor location and end with actor forward vector, or its not the problem? idk
Perfect, I'll get that implemented. Thanks so much!
The funky thing I'm seeing is the forward vector + float. I'm thinking you wanted a forward vector Γ float.
The "+" in the screenshot would add a flat 500 to each axis of the vector, which wouldn't produce anything useful
damn, its work lmao thanks man
btw, whats the meaning of vector * float? like how its work and why we should use it that way?
What can I do to make this work. The left example is working. But when I connect a String node to it it's not working. I've got the C++ source and I think the UPROPERTY needs something more added to it. Anybody?
Vector * Float means you're multiplying each part of the vector by the Float amount.
So if you have a vector of 1, 2, 1 * 500, your output vector will be 500, 1000, 500
Your forward vector usually has values between -1 and 1 for each of the values to represent the "forward" direction. Multiplying it by 500 basically means 500 units forward, and then since you're adding your actor's location, that means 500 units forward from wherever your actor is.
Does the variable have a value set in it? Ie. Put a breakpoint on the node, get it to run up to that point and hover your mouse over the variable's pin to see its value.
i figured out the problem
didnt tick replicate on the actor in class settings or something
lol
Yes the variable has a value. the C++ code doesn't recognize it. And when I try to debug Visual Studio says I have no debug symbols and I don't know how to generate them.
if im not wrong you download them for binary engine builds
however i highly doubt that the c++ code wont recognize the value, that seems unlikely
c++ doesn't actually even see any difference between a value provided from a variable vs. one defined in the input field
Hello. I have a question. I have a blueprint with a static mesh actor. I want to have it not collide with other objects so I set it to "No Collision". But I also want to recognize it by "Get Hit Result Under Cursor By Channel" is there some other collision setting that provides this functionality?
use a custom collision profile and set everything to ignore except for the channel that you use for the trace
Can UE4/5 translate blueprints into C++?
Feel like it should be able to since its the same functions
UE4 has blueprint nativization which can do it to some degree, I think UE5 is removing this feature though
what
removing it sounds like a step backwards
they probably plan to replace it with a translation to their in-house language they're working on
From what I understand it has a number of caveats, and it's not that hard to rewrite performance intensive blueprints in C++
Majority of the time BP performance is entirely adequate so you don't really even need that feature
oh god i hope not im just starting to learn ue's c++
i know
probably not the proper channel at this point but what do people use c++ in ue for
if you know how to write it sometimes it can be faster than laying out all the bp nodes or there are some things you can write more efficiently performance wise I suppose
I write a lot of my core logic in C++ because I find it's a bit more robust that way
I use blueprints to do some more gameplay related logic on top, like triggering sound effects or such
ok that makes sense thanks
nvm I realized an addon is probably the best and easiest answer to my problem
Hi. May I ask how would you go about attaching a weapon to a socket when the animation switches the main hand during reload? I usually have a problem like this one wherein a specific animation uses the right hand to reload something and the left hand tries to grab the gun. But if the reload animation reloads with the left hand and the right hand is holding the weapon, I have no problems.
Currently I am using procedural weapon sway on my setup and left hand transform to position the left hand. The gun grip point is attached to a socket under hand_r bone. I believe it is related where the grip point is attached like the socket hand_r bone but I saw some templates before that also uses the setup but I could not pinpoint how they are detaching the socket during a reload animation like this one. My current alternative is to dynamically change the grip point during this type of animation, transferring to a left socket on the left hand bone.
Thank you
Sounds like step backwards, but it's a step forward because it's an abomination.
Not only does the C++ code unreadable (think of it as what reverse engineering tool outputs without any manual labour), it's not intuitive to set up. Some blueprint asset types refuses to get nativized, like struct/enum assets
How to move static mesh component in the viewport?
select it in details pannel
There's only scale
Then it's a root component. You can't move a root component since it's what everything else relies on for moving.
Yes it is
So i shouldn't make the staticmesh as the root component?
Not if you want to offset it from the actor's root position.
Actor's Position is always it's root component's position. GetActorLocation for instance literally gets the root component and gets it's position. So you can either move the entire actor to move the mesh, or the mesh needs to be parented to something else like a SceneComponent.
Yea i'll just make the scene component as the root
What's different between Interface and Function?
Seems like same thing aren't they?
Did you try connecting from Heads Up Display and finding HUDCanvas?
im trying to connect hudcanvas to add child canvas as a target
but my hudcanvas is character sheet
and there is a border of the character equipment and stuff
well unless your character sheet is of type canvas this isn't going to work
and his hudcanvas is empty, and im very very confused
@timber cloak Sort of. I think you're thinking of an Interface Function vs a Class Function. An Interface is like a secondary class that multiple classes can use to call similar functions on multiple different objects.
Why does my multiboxtracebychannel not hit all of the cones? As you can see, the red lines are the box trace boundaries, and I tell the cone to turn green if it is hit by the box trace. It returns values very inconsistently
hey guys, do you know how Can i have a cutscene on a first person game that has a blend between the actor's view camera and the sequence camera?
Thanks for the explanation.
Also, How can I disable just the movement
and not the mouse input ?
umm
oh so i setup a flying movement
and setup the movement speed to 0
that' should work
Hi, I would love some BP assist with a tricky problem! I have a vector (weapon muzzle) that i need to know the rotation of to face where my cursor is, but the rotation need to happen around my characters origin point. I can kinda do this with a RotateVectorAroundAxis node, but instead of giving me a consistent result the corrected point just orbits around the origin, where as I need a fixed position. I am doing this to check LOS between my weapon muzzle and cursor regardless of how my char is rotated. Any tips on how to accomplish this?
ahhhh i see, thanks for the explanation ^-^)
If i have an animation that walk forward, how can I put the same one and not resetting to the original position?
what is the start and end trace vector of your trace function?. it should not be same. the end trace will be starttrace+ (5+5+5)
My issue illustrated:
get muzzle forward vector, multiply with negative value, like -5000 and then add cursor location to that vector or muzzle location
the cursor could be anywhere though. im not trying to look directly behind the muzzle, sry if my illustration is a bit confusing.
get hit result under cursor by channel will convert mouse location to world space location. from that location you can add to -muzzle forward vector, which is explained above
What are the Get Hit Result under Cursor Nodes in Unreal Engine 4
Source Files: https://github.com/MWadstein/UnrealEngineProjects/tree/WTF-Examples
Note: You will need to be logged into your Epic approved GitHub account to access these examples files.
yeah i have no problem finding the location of the cursor.
you need to negate the forward vector
X and Y are the same, startZ is 5000 endZ is -5000
Im not really sure about this -5000? my objective is to find to location of the yellow point
get muzzle forward vector, multiple with negative value like 1000, and then add muzzle location to it
@fierce axleIs this top down?
its third person
@gritty elm sry im probably not explaining it right, but i cant get that solution to work, thanks though!
Pretty sure you're looking for Deprojecting the mouse location. Via PlayerController. You can use that in a LinePlane function at the player's location
Are you doing this in the character's blueprint?
im not trying to find the cursor. i can already do that fine.
yes
i need to rotate the muzzle point around the origin of the char somehow. after that its easy enough for me
i can already do the LOS check from origin to the cursor but thats a bit imprecise. i want to make the LOS check from where the gun will be IF i decide to fire.
sry its technically top down i guess? just not directly 2d topdown but the ARPG view.
This is complicated for the simple fact that animations move the muzzle. If those are taken out, then the math for it is fairly simple.
what would that roughly be then?
If I'm not mistaken. This should be fairly close for a start point for the muzzle.
oh thanks, ill check it out!
would someone be able to help me this linetracing problem?, it's likely something painfully simple , i've done a simple placeable cube and when i build one on top of the other (so 2 cubes high) the line tracing only gives a valid position that lets me place more cubes as long as either the x or y is greater than the target cube,
is the muzzle distance to the origin dynamic?
Yeah depends on the weapon
or is it automatically handled somehow?
ok
there is deproject screen location to world
once you have the location of the cursor in world, you can find the corresponding forward vector you want the muzze to be at
basically it's (Origin.Location - MouseInWorld.Location).Normalized(). then you can do something like RotationFromXVector to find the rotation
that leaves the issue if how the muzzle is rotating. if it's parented to the origin actor, you may want to rotate the actor instead of the muzzle
oh i dont want to rotation the actor here. the main objective is just to "know" if i will hit a target "if" i shoot.
when scanning around with the mouse
I see
so i can put an icon over the targets head etc.
then you should still get that unit vector, and compare to the forward vector of the muzzle via Dot
yeah ive used that for the rotatevectoraroundaxis thing
that will give you a value in range of 1..-1, where values closer to 1 are pointing in the same direction, and values closer to -1 are pointing opposite
you can then granulate exactly how close you want it before it registers
but isnt there just plainly a way to rotate a thing around another thing?
1 means the unit vectors are an exact match
there is, I gave you that
if my only output is a strict rotation then its still just rotating around ist own axis no?
you have to rotate the parent
you can do this by either rotating the main actor it is on
or you can create a parent scene component
hmm okay
in either case, when the muzzle is parented, the difference in origin will rotate with the parent
well im not stricly trying to rotate the muzzle but rather "know" where it will be
the calculations are still the same
the only difference is that you don't apply them
like something like this node, only it keeps rotating for each frame
you can use FindLookAtRotation aswell
yeah im using that a bunch
so you should be set then
thanks ill look into.
3D rotations = pain
what's the proper way to store/access data I'm calculating via blueprints in-editor which won't change in the shipped game?
I was thinking I'd use Save Game.
can you give a concrete example?
Save games could work β I use one for a custom visual logging thing. You can also mark actors & components as "editor only" IIRC.
one example: In a static, voxel-based map, I'd store line-of-sight data per-voxel. (i.e. each voxel would have a list of every voxel it has line of sight of within x radius)
I'd use this data for some shading effects
you're making assumptions
voxel engines are potentially infintie
the scale would be very small, but that doesn't really matter because my question was meant to be a general one
whats the cheapest physics object type? sphere collision? probably better than having a custom collision for a rock, right?
you're trying to do something that is well beyond the scope of BP. this would be a massive undertaking even knowing cpp and renderers
never mind data management
Hard to say for 100% certain without knowing how physx handles it, but sphere seems plausible
yes the simplest collision is better, but ive tested hundreds of physics objects colliding in a scene and saw little difference between the types.
generally it's object traces that you see the difference
simplest way to do that would probably just be to sphere trace on tick across whatever duration you want for it to expand
point is, if I have something calculation-intensive that doesn't need to be done at run-time, how would I store and read that data?
I'm just gonna use Save Game in the future.
a data table or data asset. for what you want to do however, it doesn't make sense.
there's Timer
I think I've done similar, I believe I used timer in this case (but actually timeline might be best for this given you can use that as an alpha value for the sphere's scale)
@swift pewter
What about doing 3 sphere traces separated by a short timer? Inner ring fires and freezes, then middle ring, then outer. It won't be the most gradient, but it should get the job done.
what is the best way of getting a object from a class reference?
I dont like using get actor of class here
it's hard to say, your setup doesn't give enough context. but generally, you're looking at some form of blueprint communication
This is a WeaponsBought Array it gives me the Blueprint that are child to a Weapon_Base
if the player buys weapons, and they already exist as actors in the world, then just save the actor refernce from the start of buying them.
Its a manage gun input function that takes 2 integers (Gun to Disable and Gun To Enable) that come from this , i want to take the object at the integer and remove its input,collision,visibility etc and do the opposite to the GunToEnable int in the array
in that case it would be better to iterate over an array where all your guns are stored
and then based on the current gun picked, you can do your logic
feels messy what you are doing also
you already know what weapon is selected from Weapon Selected integer
not sure why Gun Input is taking in those integers..
yeah I would perhaps use a state machine in this case
given that you can only have one gun active at a time
(I assume)
although the level of repeat logic per state might not make it worth
i literally store a variable "CurrentWeapon", and when player switches, i change CurrentWeapon to the new weapon
hmm yeah okay
this is a reference to the weapon, but my switch logic, calls CurrentWeapon -> Unequip then sets new weapon to CurrentWeapon, then calls CurrentWeapon -> Equip
that plus a delegate OnCurrentWeaponSwitched
where you can pass the weapon itself as a variable
that is it, weapon handles hiding/showing itself
I see
mine is a tad more complicated, as it waits for the weapon to finish being used, etc.
but that is the general gist.
i have very little weapon code in the Character
Switching Weapons code is in the character right?
do you spawn weapons as actors and then attach them?
yea im only doing that on the character
but they call into the weapon, and weapon handles hiding/showing itself
rest is on the WeaponBase
Ohhh
Unequip function hides the weapon and detaches it from the player
Equip shows the weapon and attaches to the player
these are functions on the weapon, reason being is weapons can be attached to specific sockets
with specific offsets on the socket
which only weapon knows
mine is C++, or i would show you π
sounds like you want 2 different things that are at odds with each other
thanks! found that! amazing
I think what I did during the last few years of working in UE is bad practice, but there's not enough info out there to confirm it: I've been creating user widgets in various places like game instance, controllers, other widgets, individual actors and followed the "rules" which made sense at the time. Now that I want to reuse older work for a new project, I realize the UI com systems are so convoluted it stings my brain. Never used the HUD class for some reason π€·ββοΈ
This IS bad practice - isn't it? Even if it's more work at that very moment, shouldn't I have a certain class that handles all the user interface & coms? Some pro advice pls π
yes
@odd emberπ fair enough, short and to the point π
the general rules for good practice are:
- each class, in as much as possible, is responsible for itself
- a manager should have responsibility for communication and instantiation of each class
see also: MVC
@odd emberYep, looks that way now, came to that conclusion, but wanted confirmation. I'll also save the MVC pattern - never heard of it btw. Try to follow it. Thanks! π
And would HUD be a good manager class for all widget comms?
MVC is at the core of designing the player experience
How do I setup a HOTAS controller in BP? HOTAS is the airplane joystick with the acceleration slider thingy.
no clue, there might not be support for it without plugins
perhaps you can check the USB game controller utility in windows if you're using that, and it will give you some notion on how to translate input which could then be used with the standard BP input
π Having to do everything myself as an indie, couldn't afford properly studying anything really. Jacks of all trades stay jacks for a reason - unless you're a genius, which is hardly the case lol - so I came to various "standard" conclusions from experience and digging on a subject when confronted with it. @odd ember
Another question and I'll leave u guys alone π
Can you give me any link/keywords on how to search for (I don't know how it's called) - but I feel like I don't have consistency in how I do things, so whenever I need to revise/revisit older code after working something completely different, I'm lost and have to spend hours remembering/figuring out how tf I was doing things. Especially in bigger projects, it's such a waste. There has to be some model/way of doing things so that anyone looking at the code and knowing the model can understand what is going on... What is "that" called? Any documentation would be really helpful. Thanks!
you don't need genius level understanding. this is all stuff they teach you when you're learning programming
believe me if you did need genius level understanding we'd see a lot fewer people doing game dev
I'm and was in the wrong trade all my life - PhD in Educational Psychology, started as a musician so yea... But I love this, sad I didn't do this when I was young π
I think in your case I'd just try and sit down and study programming principles for OOP
OOP being Object Oriented Programming
For consistency i tend to find a programming pattern i like/find suitable, and try my best to stick to it
Honestly, there isn't any way to really go back to something after a while and just know it. I find myself looking at things after a few months that I've done, and it takes glancing back through my calls to realize what I was doing and why. The best you can do is just write organized code. Break things down, don't chunk stuff up into large functions.
Ok, great, that's a good way to start I guess π Thank you!
it might be a bit dry, but ultimately it's going to give you a lot of insights into how to structure you game
Along the journey one often picks up new tips and tricks, so every revision may differ despite following the same principle
and it is extremely important to keep many of these principles in mind so you don't accrue technical debt at an alarming rate
(you'll always accrue some degree of technical debt, blame entropy)
but if you set yourself up correctly from the beginning, many of the things you need to do will be laid out for you later on
I'm fine with dry, so I'll read up on that - fortunately, reading doesn't scare me at all π
in the case of my personal project, I spent about a year laying the groundwork for a game framework
Some people say to comment code and such. Maybe. I dunno. I find comments annoying and distracting. Logic should make sense on it's own. If they help though, use them.
Good code is self explaining
Comments tend to be part of bad habits, atleast thats how i see it
and because of this, I'm now at a point where implementation of new things comes fairly quickly. because there are already systems in place to handle what needs to be handled
Letting yourself get away with weird code because you put a comment above it..
good code doesn't exist
Yea well, I just jumped right into the action, did and publishes 6 educational minigames in my first year of working with UE, and then started a year-long game which sits on steam now (it's educationa, a good chunk of BAD 16+gameplay hours) So had no time for steady work unfortunately. Everything's rushed π€¦ββοΈ
good practices exist
Fair enough
this is the very nature of developing games for money
or really, any kind of development for money
well then, I'm "standard" π
experience comes from understanding how bad decisions came to pass
and knowing how to avoid them in the future
you're working alone now, so your decisions only affect yourself
but imagine if you were responsible for a team
or a department
or a studio
Don't even wanna think about that. I had the freedom to "adjust" the very game design according to what I deemed feasible during the timeframe + budget. It would have been impossible to do it if I worked with a team - so yea, ur perfectly right!
again, this article explains better the issue of working in development than I ever could
Going through it now - it's funny so far π
Funny, and yet very true
looks at Phil
Another issue i often encounter is over engineering
Don't doubt it π It's kind of like this in any academic/research field imho. If not even more so π
Mostly done by myself
over the years I've seen many people fall into the same traps
Instead of sticking to the projects actual needs, i tend to overthink and overcomplicate the systems that i needed, ending up wasting a massive amount of time on it, only to use like 10% of it
over engineering, preemptive optimization, shortcutting the learning process etc.
it always comes back to bite them/everyone in the behind
make it work, make it neat (readable), make it fast
^ thats it
I do the exact same thing!!! How do I avoid this?! Ideas pop up while making the structs, then I forget why TF the struct has 35+ vars out of which I actively use 5 and constantly feel the need of 2-3 which I forgot to add π
not enough time -> next? π
yea, ofc there isn't π
programming is much less about doing logical statements and operations and much more about how to manage those logical statements and operations in structures that make sense, that can be extended and that don't require (excessive) detangling
but I think i've heard in some Epic livetraining or read up somewhere about some conventions meant to streamline coding workflow. Can't remember what it was called, can't find the vid for the life of me.
I'll just start with OOP principles, see where they take me. The problem I faced trying to read up on that is the terminology which is next-level of abstract (psychology is baby science compared to it). And I somehow need to translate those in blueprint language (which I probably can't). But I'll find a way to wrap my head around it. π
I think it's important not to try to overdo something. You're going to miss something, or mess something up. Set things up in the simplest manner possible, and then add onto them when you need to. Trying to do anything more is just wasting time.
also it's worth keeping certain game design/fungineering notions in mind:
- have a core game loop that you can scale up/down
- extend the game only insofar it benefits the core game loop
- layer esoteric decisions on top of the core game loop only if you can prove that you won't have to modify the core game loop to include them
GoF description of patterns are legendary in how terribly written they are
GoF?
spoken like a true veteran in the field π
here's a better source that explains the use for (some) of these patterns in a more comprehensible way: https://gameprogrammingpatterns.com/
just to add a final point to this conversation: I mentioned technical debt before, but didn't really go into detail. just in case, https://en.wikipedia.org/wiki/Technical_debt
Technical debt (also known as design debt or code debt, but can be also related to other technical endeavors) is a concept in software development that reflects the implied cost of additional rework caused by choosing an easy (limited) solution now instead of using a better approach that would take longer.As with monetary debt, if technical debt...
Great! thanks for the resources & input everyone! π
sounds like you could try asking that in #animation
not sure what it has to do with BP
its kind of both but ill post in there just in case
Anyone know how to remove foliage instances on collision? This isn't working. I know the hit event triggers but it doesn't get removed.
Break the Hit struct and try using the HitItem as the index.
It's either HitItem or HitElementIndex. Can never remember which off the top of my head.
I can't imagine instanced foliage has blocking collision, let alone generates hit events
perhaps try with overlap instead?
It does have hit events .. we're talking trees here.
Like I said that part works. Just can't remove it. I'm super new to blueprints too.
Tried this also, it's not working either
@maiden wadi i am not familiar with that approach. I will try and look into it, thanks.
I mean you can have the Event Hit as a node
that doesn't guarantee that hit events are being generated
This also isn't connected.
ah
Oh shit something happened! It just destroyed all the trees instead of one. But it's progress!!!
Break the blue pin at the bottom and try what I mentioned above.
Hi I'm working on an action hack and slash type of game. When the player attacks I want there to be a small amount of aim assist/lock on to the target if there are not quite exactly in front of the player's cross hair. How would I got about implementing something like this?
Hit struct is populated with the instance of the ISM when colliding with it/tracing it. Did a lot of that for a building system.
@odd ember I have no idea if it's just an UE5 thing because I didn't actually use UE4 but yeah the block / hit events on foliage definitely work I printed a log message before
Auth is correct, then you can use RemoveInstance node with the item/index number from the Hit.
ty
Animstate
With directors to next combo
Which is a new section in the montage
Ye
As always theres a 100 ways
But the epic one seem pretty solid
Could probably adapt it a tad to make it work with different montages instead of sections
I was planning on it in one of my projects, but figured it'd be one heck of a setup for something inprobably dont need (as talked about above, with overcomplicating stuff that dont need to be )
It's not working @maiden wadi
What is hit item printing?
73
I thought maybe the target passed to "Destroy Instance" was wrong ... but it won't let me pass the "Other" variable from "Event Hit" directly in there
Odd. That should be working.
isn't it because you're going too deep in the hierarchy?
I don't know how ISMs are setup on the inside
use Hit component from the break hit, cast it to foliage, then remove instance.
if it's a parent ISM that has child ISM components
ok I'll try that Gallonmate thanks
I think it works
I mean it's kinda wierd with the whole Lumen thing
but thanks a ton
I mean it's kinda wierd like it's deleting unrelated instances
Idk
Ok I got it
I need to combine that approach with the Hit Item index
yeah sorry didn't mean for you to remove that wire lol
It's cool I think I am getting what an Instanced Static Mesh is .. like it is not itself a single instance, but a collection of instances
Next step is to try generating a different mesh in its place ... but that might be for another time..
The context here is like a monster stepping on a forest and so the trees get replaced with fallen trees
there's tutorials out there for swapping instanced meshes, chopping trees is the popular one that pops up first when u google it
ok cool thanks
Hello i have made a Controls Option Menu where i want be able to change Input Action and Axis Bindings but i want them to save after you exit the game and start over .Is there a way? I am using the Save Key Mapping Node but after i exit the game . It shows that everything has been unbounded
is there an efficent way to retrieve an item from a map with a gameplay tag being the key without looping? I know i could just loop over the keys in the map and call HasTag on the container, but i'd like to avoid looping and do a straight grab from the map.
isn't there getAllActorsWithTag or something?
Find?
whatever, unless you don't overdo it, you can go with it
GameplayTags, not FName Tags.
im confused , why can't you use Find
@deep hound Fairly sure this is what you're after?
I mean. It still loops internally, but it's a lot more efficient than BP loops.
I use it pretty often with UI setups.
maps use a hash, don't they?
Yes
Which is slower than the Loop if it's only a few elements I guess
But there are always freaking Terms and Conditions
it's still cpp so it resolves faster regardless
Iirc the GameplayTag is an FName and those are mapped to an Index anyway?
So it should be fairly cheap?
Idk how that all works deep down, but either way, it's not a loop.
Dunno. The thread I followed before leads right to a loop.
the problem is i have a gameplay tag CONTAINER. so how do I plug that into the find?
The Map's key is a Tag, or a TagContainer?
the map contains keys of GameplayTag, while the item i'm using to get something out of the map is a GameplayTagContainer
Then you might not get around the loop
how do you know what gameplay tag you want from the container?
C++ might have some lambda based find, where you could put some custom condition into
I think the diea is
That they want the value
of the tag
That is part of the container
E.g. "Loop over Tags, check if Tag is in Container, if so give value."
You could turn the Container into an Array.
What is in the container? I mean if the container only has one tag, convert it. Otherwise you're looking to retrieve multiple things anyhow.
maybe it's easier for me to describe what i'm trying to acomplish. I'm trying to categorize items in a container by tags. An item would contain this tag within all the tags it has. Categories would always be something like Game.Items as it's parent. So a valid category is Game.Items.Ammo. Game.Items.Ammo would exist in the map as a key. Give an item's gameplay tags, i want to retrieve the matching item from the map.
does that make sense?
Yeah sounds like a loop to me
Originally i just had a switch statement with all valid tags, but that requires hard-coding all possible tags in my function, which becomes difficult to maintain
my approach now is to pre-define the map with all possible keys, and just iterate that
but i'd like to avoid iteration if possible
I wish FName functioned like the dynamic Enum type it was meant to be π
So Game.Items is part of a Container with multiple Tags inside an Item
And you have Game.Items.Ammo, Game.Items.Weapon, etc. in the TMap
And you wnat to get all the TMap entries that have Game.Items
Something like that?
How many entries are we talking about
In the TMap?
not quite. the idea is that the item might contain multiple tags that aren't just the Game.Items parent. I want to say, given this item's game tags in the container, find the relevant entry in the TMap. As for the number, so far around 15
the ONLY items in the TMap are Game.Items already
What's the worst case of num entries
idk, it's whatever the number of categories the game designer comes up with
Anything around the thousands?
lol i'd hope not
Then you are optimizing the wrong end
HashMaps aren't superior to Loops in low numbers
So just loop
eh
Aren't
fucking brain of mine somtimes
lol yeah
i figured
just thought i'd ask if there was something i was missing since i'm fairly new to gameplay tags
thanks tho!
Na, the conversion between Tag and Container for something like a key is not that straight forward
Or possible
Not helping here, but also have a look at GameplayTagQueries
Sometimes they help and not a lot of peeps know them
is there a "null" state for a tag?
With the limitation in mind you could also check if you can replace the TMap with something better here
like can I reset a variable holding a tag to nothing, and verifiy it's nothing?
would this be true?
FGameplayTag someTag = ...;
if (someTag.IsValid())
{
someTag = FGameplayTag::EmptyTag;
}
Not sure how that would look like in BPs
But you best just check the API
A single gameplay tag, which represents a hierarchical name of the form x.y that is registered in the GameplayTagsManager You can filter the gameplay tags displayed in the editor using, meta = (Categories =
can someone give me some information on how to create a death respawn timer? e.g player dies, the umg widget gets created and added to viewport, then countdown starts from 5 to 0, once it reaches 0, all widgets get deleted, and player will respawn..
i have only found so far a lot of info on using tick function, but tick runs at the start of the game always? how to make it so that when i overlap, i can call a custom event which adds/removes seconds?
You could just call a custom event. The custom event would use a delay node.
Is there something more to the question Iβm not understanding cause that answer seems to simple lol
I have created an overlap event which destroys the character after 5 seconds, and it also adds a UMG widget to the screen. My question was, how can I make the countdown in the UMG go down, from 5 to 4, then from 4 to 3, etc, until it reaches 0. I don't understand how would I achieve this. would I have to use some type of loop with -- decrement int to remove it 1 by 1? it doesn't work.
Oh ok
i put the variable into playercontroller and casted from UMG to playercontroller
to get it
but idk how to decrease the value after i touch the actor
Well you can use a umg binding, or yes, you can make a looping timer to handle it.
Might just be simpler to use a looping timer
right now basically i have a set timer by function name, and that custom function destroys the actor after 5 seconds
but yeah the visual is problem
Then
Change the timer duration to one second, and make it loop
And make a counter variable
Each iteration of the looping timer, increase the counter
When counter equal to or greater then 5 destroy actor
But
is there a way to hit a breakpoint for design-time blueprint code in widgets?
what type of loop would be best for this?
I mean you can keep using the timer you have
oh ok
There is a setting, when you set the timer, that makes it loop
But
You could also just set a new timer at the end of the timer finish function
But why not just use the looping Boolean
Easier
since this is all based on the player controller's relationship with the pawn
you could bind events to activate OnPossess
likewise you could do the same with OnPawnDeath
bind all widgets (or the widget controller) to destroy widgets when the pawn dies
when a new pawn is possessed, spawn new ones
Iβm not sure if thatβs answering his question
Except thatβs the part heβs confused on smh
No trivial to everyone
And thatβs the part heβs asking about
The thing is, there are a gazillion ways to do this
either way you'd activate the delay (however you'd want to implement it) OnPawnDeath
Yep
Yes lol a million.
If you want to help them either go into detail on how they are doing it atm
Can a controller be without a possesed pawn for a while? In relation to op question
Or give enough info, cause throwing random things like possess into the mix will confuse them
Yes it can be
Pawns are optional
I see. Thanks
I don't think not knowing about possess when the question revolves around pawn death and respawning is conducive to good discussion, let alone good practice
Bruh
Maybe. But it's not the top solution either depending on what they are doing
They wanted a visual number
That counts down
That's kinda all
Which if we keep it to umg would be a timer in there or a sequence. Given they already have respawning setup
if you accumulate tick time and truncate it to int it'll automatically preserve time format (e.g. 1 second per int). then it's just about updating the widget, either per tick or whenever it reaches a whole number
SetText or the like
so something like RespawnTime = RespawnTime - GetWorldDeltaSeconds in a timer or per tick will work
Yea that route would work to.
But itβs kind of confusing
I wouldnβt know what your talking about, if I didnβt even know how to make a looping timer update something
It also ignores his foundation that he already has
Heβs already using a timer handle
Yea
For display timers, I was always a personal fan of just using a start time and duration. Pass that to a widget, let it tick and display the timer based on GetGameTimeSeconds and some math. Tick isn't gonna do much here unless you're planning on having a thousand of them on screen.. and at that point.. what the shit are you even making? Method works very well with networking too since you pass two floats, once, and let clients simulate it with GetServerWorldtimeSeconds.
Hello. I'm making a particle effect. Now I have this gradient. I can change the Red outer color. But how do I change the yellow inner color?
Used to remember that. On a side note, it's worth a mention that Cascade will be removed sometime in the future. Good time to start learning Niagara. π
I did some Niagara tutorials and liked that a lot more. This effect was in a free FX pack I got from the marketplace.
you may get better help in #visual-fx
Ok will try it there, thanks a lot
Oh man I don;t know how I did it but I changed it to red already xD
Sorry for asking in this channel.
When I call this for the first time, it works, however when I try it again ingame, the menu doesn not appear.
if you try with breakpoints, you might be able to see why it stops working
it's hard to tell just from what you're posting here
Well now I am confused. I added a breakpoint on the IsValid node and it never activated.
What is supposed to happen is when E is pressed, the event dispatcher is activated on this actor and I add a widget to the players screen. I didnt want to keep creating the widget so when the game first runs, the SCS REF variable is empty so the variable is not valid, so it creates the widget and sets the variable so that the next time I try to open the widget the ref variable is not populated so I just use that variable and add it to the viewport.
I can see what the code is supposed to do
but if it never activates then that's probably where the focus should be
I can also see that you mentioned dispatcher... but the event is an interface call
Oh sorry, yes it is an interface.
so I'd investigate and see why the interface call is never made
Ok, so I added a print string to the end of each set input modes with different colors and they both show up one after the other as they are supposed to, but the top one never seems to show the widget.
again, breakpoint it and see what happens. if it doesn't show up as going through the breakpoint, then you might have to change the actor instance from "none"
sometimes it does it automatically, sometimes it doesn't
What do mean by setting the actor instance from none? I havent had to do this before.
I don't have the editor open right now, but while PIE is running, you can change the between the actor instances that are running in the game
so you can check the breakpoint of each individually for instance
How are you hiding the menu after the first time?
sometimes it doesn't automatically take you to the first breakpoint on an instance, so if the print string triggered but the breakpoint didn't... you'll have to switch it
or are you removing it from parent?
Yea.
You could just hide it and then show it again.... It's easier that way.
Especially if it's being used a lot in your game.
Then you can change your code up a bit.. I always create my often-used widgets upfront and then just show and hide them throughout the game.
So would you just set the visibility of a parent canvas or is there a way to hide the entire widget class?
how would I go about making a simple dodge left and right?
oh yeah sorry, here is where its a bit too complicated for me ( Im very new). The camera will lock onto enemies and follow them and I want the player to be able to dodge either left or right. Camera is behind the player. For now since im just trying to figure stuff out I just want the player to be sent in either direction
this would usually be handled through animations with root motion if you're thinking about something like dark souls
but if you want something simple where it's just the movement that matters, if it's something where you need to do it over time, you can consider a timeline that lerps an offset or an alpha value for an offset
Okay, ill try my best with this. Thank you
So I changed my system to show the widget and this is what I have, however the widget doesnt show.
The variable there is set, and the event does fire.
Is the Cast failing? Are you adding the widget to the Viewport somewhere else?
is there no way when debugging blueprints to allow the game to resume until the next breakpoint is hit?
wait a second.
because "Resume" seems to ignore my breakpoints again
That's the natural design - to allow the game to resume until the next breakpoint is hit.
What if you put a breakpoint on two back to back nodes? Does the same thing happen?
That was a test to see if your game is actually making it to another breakpoint when you resumed...
- it looks like it's not.
I mean making it to another node where you have a breakpoint.
but it does
i have a print string
i put a breakpoint on it
the print string executes 3 times, but the breakpoint would only hit once
when i added a breakpoint to the subsequent node, then the debugger stopped on the print string each time
Hmm...that's strange. I'm not aware of the editor adding logic to do that. And you've tried closing and re-opening the editor?
Maybe something got out of sync. I'm glad that was helpful. Good luck.
So I got the widget working. However, I have code that adds widget to a scroll box on event construct. So now whevever I go back into the widget after leaving it, it now has another set of subwidgets.
When you go out of the widget that you are hiding? It shouldn't call the construct again since you aren't removing it from parent..
Thats why I am confused. I couldnt use the set visibitliy node due to how the widget is created so I instead use remove from parent.
Hmm...well, it will always call that code then. I'm not sure if you can move that construct code to a function and then have your blueprint call that initialize function - instead of the construct event.
Let me give that a try. Ill make it its own event though.
That seems to have worked. Thanks.
Great!
So I'm using PreConstruct to put some data in during design time to help me visualize my widgets while designing them. The problem is whenever I nest them, their pre-construct code still runs, which duplicates items that shouldn't be there. Is there a way to disable the pre-construct event when creating a widget?
don't think so, no. I think it's best to look at it as an encouragement to not place code there that you don't want to run at those times. but perhaps #umg can tell you more (or something different)
Thanks. I forgot about that channel
Hi! does anyone know how to set a widget to keep the same size always when on "screen" mode?
Without Zoom
With Zoom
on the character bp, how would i randomise the materials on the skeletal mesh? tryna find info on google but not much info, either materials or skeletal meshes
Material array, random element, apply to mesh.
Not 100% sure you can. I know you can by updating the rotation of the widget on tick to always face the camera when set to world space.
Hello, all. I started up a blank project to teach a buddy some UE4, but after creating a simple PlayerController subclass, BeginPlay is never called. I don't understand what I'm doing wrong, and i've been using UE4 for 5 years. What am I missing?
Did you set your custom player controller class in the game mode?
I had the same need a long time ago but then I realized it's an illusion. The widgets ARE actually the same size but when you zoom out of everything else, it appears to be bigger..but it's really the same size it's always been..
yeah, i just realized that. i'm gonna see if i can change it so it doesn't look so weird, maybe scale it down when zooming out
Crazy illusion, right? π Yeah, you can set some scale based on the performance but then the player wouldn't be able to read them. I tried all sorts of things but then I just left it alone because if you can't view them, you might as well not have them at all unless you are zoomed in....
@faint pasturethanks, just need to figure out the replication part everyones got different to what they should be lol
Well, this issue has completely stopped my teaching my friend for now. LAME
How do you know it's never called? Did you put a breakpoint on one of your nodes?
Yes, and a PrintString, and, as shown by the BP image above, I am expecting some UI elements to be created and added to the viewport. None of those things occur, despite the GameMode registering a PostLogin for the PlayerController and the level showing that it is indeed spawned
This is on UE 4.26.2, btw
I didn't see a PrintString in what you sent above. And I haven't seen the contents of the widget. Do you always use the base event begin play? I have never used it in my blueprints anyway. Did you try it without it? It should be fine but just curious.
The Base: BeginPlay is unnecessary, but doesn't do anything by default, and it's good practice (at least in my experience), in case I want to change the base class and expect things to work
I did try it without out Parent: BeginPlay and nothing changed
In my MainMenuWidget, I have all the vertical boxes, and images, and buttons, etc there.
But when I go to the event graph I don't see the vertical box variable? Am I meant to? How would I set it to be visible or not?
you have to activate it in the details panel in the widget editor
select the vertical box, top right next to the name theres a checkbox
Ahh ok thank you!
I believe your issue has to do with your Game Mode and Game State classes. If your GameMode's parent is GameModeBase, then your GameState needs to inherit from GameStateBase. If your GameMode's parent is just GameMode then it's ok if your GameState inherits from either GameState or GameStateBase.
Holy crud you are totally right! My GameMode inherited from GameModeBase but my GameState was from just GameState. CHanging my GameMode to inherit from just GameMode, everything now works. WTF WHY?
Thank you! That is some seriously strange behavior, preventing BeginPlay is disastrous
GameState and GameMode have additional functionality built into them beyond GameModeBase and GameStateBase and they're meant to work together - it's something I"ve come across a few times and I thought of it as it really doesn't make any sense why your playercontroller wouldn't fire.
Thanks all the same! I'll add that quirk to my LONG list of UE4 "gotchas"
My blueprint for runtime foliage replacement works! But the "code" is so Fn ugly it triggers me. Does anyone have a recommendation for how to make things cleaner? Worth learning C++ for this purpose alone?
As you don't have any latent nodes, you could consider putting this in a function so that you can utilize local variables which will reduce the amount of spaghetti lines
Oh ok yeah I was thinking was there a way to load data without lines, I guess I can use variables for that, thanks
Greetings folks o7
I want my pawn to rotate towards where its camera is pointing. But I want it to happen at a max speed, and ease into its new position. (so it feels smooth and a little laggy)
I have the camera's Forward Vector... Anyone have any cool ideas how to best wire this up?
Anyone know how to get character path movement along a spline to not be stuck to the spline? I noticed Iβm losing a lot of the character movement functionality when Iβm attached to it. Is the only way to move characters relative to a spline via local offsets?
You can use the spline as a guide of sorts instead of attaching the character to it
As in, get points along the spline, and use them as targets for navigation based movement
Thanks, made the modifier for the camera but I want it to use a dynamic material instance. Would this blow up?
Try it and see :D
:D
I think that's how you'd do it though
@earnest tangle I tried something close to this using a tick and getting the location of the path follower as it follows the spline and then setting my characters location to those values it kicked out. Which worked but because it was on a tick it was a not very smooth. I like your idea of getting the points of the spline though! Iβll try that next. Although I did just get movement to look decent with offsets Iβm open to trying any options right now.
How would I go about getting the info from a point on the spline?
So, I can set scalar parameter values and then retrieve it, but it doesn't seem to update the modifier. Weights are at 1.0 and I did test the material instance having a default value.
Print strings are as expected.
there's things like get location at distance from spline or something like this which might work
@woeful pelican not 100% sure tbh. My project has something sorta like this but it just uses materials and changes the parameter on them to control the effect
Do dynamic material instances work on just the material?
Thought it had to be Material > Material Instance > Dynamic Material Instance
What do you mean? A dynamic material instance is a material instance which is a material
I mean this
Ahh
Yes, you can give it just a regular material - it probably wouldn't list them as choices if it didn't work :)
Well I'm always sceptical if the smart context things are correct :)
The problem Iβm running into with a get location at distance method is that it needs a constant feed of that value updated. Which I think the only way to get that would be with a tick. But how can I get that new location to not be so stuttery as it updates?
You could probably set it up so that the moving actor requests a new move target slightly before it reaches its destination
I think this should prevent it from being stuttery, as it should be moving when it updates to a new target, which would hopefully prevent it from stopping momentarily as it changes the destination
Ok thanks Iβll see what I can come up with!
My gizmo is not at right angle it moves objects in two axis.
Can anyone know plz help.
try clicking this to toggle between object and world orientation for the gizmo
ok thanks
It helps to adopt a consistent style no matter what it is; putting getters & pure functions in a "logical" place relative to the executed nodes, and aligning the executed nodes in some linear fashion (keeping the boxes aligned or keeping the white wires straightened are the two major approaches). You can use reroute nodes to reduce the visual clutter of crisscrossing data lines. Collapsed graphs, macros and functions can also be organizational tools.
BP will always look like BP, but because it's visual, it's worth putting some effort into making your node graphs legible after you make them functional for the sake of your future self and/or collaborators.
alternative way to get reference of a widget instead of using 'get all widgets of class'???
kinda depends on what you're trying to do
but typically you'd get a ref to the widget's owner and access it through that or something along those lines
hey fellas, i've got a problem for some reason my animation BP is having an issue with casting?
though it all appears to be working just fine regardless.
my problem comes when trying to get this to sync online, and this is the only problem i've managed to find as 'this is a problem'
mmm because I need to call an interface
I am wondering if maybe using event dispatcher would be better in this case
@wary tinsel i concur with what zomg said
the problem is, when I package the game the hud reference is not working (is not calling the interface to display my score). If I respawn the player then it starts working
so I was looking for alternative way to get this reference
you could potentially 'pre-kill' a player to force it to work as a workaround
not the cleanest solution, but might help debug
Just tell HUD to store it's reverence in game instance
So you can read it from anywhere
yep I was about to try this...thanks dude!
Let me know how it works out π
how can I show actors on render target (scene capture 2d) AFTER spawning? I can't select those actor on the "show only" list.. daaaaamn
not working haha
Is the HUD spawned in the first place?
I spawn it from the player controller
gimme a sec
You mean this?
But can you see it when you play?
Without the reverence
yes I do of course
that works fine but not in the packaged version idk why
and if I respawn the player, it starts working
on this "show only actors" array I'm able only to select actors ALREADY present on the level. I need to add my pawn actor also to be visible, but the thing is that is not spawned until the start of the level, so it will not work.
I would like try the opposite also, by show everything first and then exclude every actors in the scene except the 2 i need to reveal. But I have no idea on how to tell to blueprint to "get all the actors in the scene"
So this?
If you work with actors
And not components
I'll try one more time but I think it was not working when i tried..
Did you try this?
nope i try it now
same result...working if I respawn the player but not when I start the game (in package version only)
maybe I should use an event dispatcher, should not be heavy in terms of performance if it only calls one function right?
Are you sure it is the reference problem then?
Since you force the reference to be set
I guess so because I tried many things before this. and I found out the problem was the reference
but you know...I may be wrong of course
in the editor/standalone it works fine
Can you try printing the reference after the part of code I gave you?
this is what giving me pain
Print string that is
so let me see if I understand this... you want to get a reference to the HUD at the start of the game, but it's failing if the player pawn is not spawned yet?
I need a reference to the start of the game (in my pawn) because I need to call some dynamic event on my widget (like score and stuff like that). To make this I did an interface an so far so good. It's working fine in the editor and in the standalone
Try doing it in in the possessed event of the pawn
when I package the game I start playing and I can't see these dynamic events. If I respawn the player it starts working
At that point the player controller exists which manages the HUD mostly afaik
if i understood the problem you need to do this after the player possession, otherwise i think it won't work
hence using possessed where it should work I think :)
I thought that too ( I set my player as default pawn class)
so I tried to spawn the player, possess and set the reference but still nothing π¦
there is a possessed event in the pawn
similar to begin play and such
if you need to do the logic in the pawn, that's where you could try doing it... not sure if you did it there specifically
additionally - in your GameMode there's a function called PostLogin which you can override
the HUD should exist at that point
(it gets created before PostLogin is called)
created the reference from there but same result
How did you create it there?
with get all widgets of class
Where does the widget actually get created?
in the p controller
where in there?
on the begin play
Show code
I guess the player it's spawning first?
Hmm, I wonder if the controller BeginPlay is guaranteed to run before the pawn gets possessed
I think it is.
He should show code. And get all "something" of class is really suspect to me. I hate using such nodes.
It doesn't scale well when you have multiple objects of that class
I agree...I tried to created a reference from c++ but didn't managed
I set also to auto possess player 0 but the same result
Just show your code. Makes it easier to diagnose the problem
ok I managed...I put a delay after event possessed to see if the suspect was real
and yes probably it wasn't working because it was running before
thank you so much guys for helping me π
Yeah so I guess possess isn't guaranteed to run before beginplay for the controller then
is there a way to get ALL the actors (no matter the class) from the level and make an array with them (since they would be different classes?)
what you could do is you could create the widget in your player controller's possess function instead of beginplay
this should make it available during possession in the pawn
definitely
thanks dude
because these stuff become a nightmare when you package the game
Yeah
You can often "solve" these with delays... but that tends to just lead to things randomly breaking because the timings were a little bit off for one reason or other 
so if there's another way where you can guarantee the order of execution it's usually better
yeye hahaha I put a delay to quickly debug hahaha I agree
better work on events of course
I actually found an honest use for Delays. Bindings that can run many times in a frame, causes hitching when UI updates. Is better to delay it to the next frame with a 0 delay, then update there. Causes UI to only update once. Rather effective.