#blueprint
402296 messages ยท Page 564 of 403
or how do i tell it about the pawn and keep it updated about its location which is controled in custom playercontroler
thought need a cast for it?
sorry i struggle still with cast, to fully understand it and explain it well
Aren't you already doing that though? Just GetPlayerController->CastToCustomPlayerControllerType
On a side note, it'll make your life a lot easier to wrap common calls like that.
how do i store "spawn actor pirate pawn" in "selected pawn"
For example, my typical game controller on this project is BPPlayerController. But instead of using GetPlayerController0->CastToBPPlayerController all of the time since getting the player controller is common, I wrap it in a BlueprintLibrary function like this.
Nah, it's just a node for the BlueprintLibraries. If you're making the function, drag off of the WorldContextObject and type GetWorld, it'll show up.
But if you made an array of the type you're spawning in the player controller, like I did here. My Array is of type BPSquadCharacter, not Actor.
Normal add would probably work too. Habit to use AddUnique when using pointers.
On a side note, this only works if you're spawning these after the controller has been created. Some events in game mode are called before that.
You shouldn't need to cast it if you make the array the PiratePawn type.
ok
i still struggle a bit
also i know i realy should start working with Blueprint Function Libraries... but just too much at once...XD
To try to explain casting, ignore the casting word. Think of it more like TreatAs. You're telling the compiler to treat this pointer as a type.
ok
To fully understand casting, you have to already know about inheritance as well. Because you can only cast an object to it's own type or that of a parent class.
if i get the direct reference to pawn, it should know what to work with
but the pawn is itself not an array, it will be spawned as an array in another bp
ok.. i have to think a bit hahaha
Because your variable isn't replicated and you're trying to use it from the client. You've spawned it and set it on the server, but your client has not set that variable. But in your serverRPC, you're sending a nullref pointer through for the server to use.
If you plan on passing more than one different type through that RPC, yes. If you're only ever calling it with that object, don't send it through the RPC, just call the RPC, and get that variable on the server.
Hello
I want to ask a question about logic nodes:
Are there any nodes like branch but for more inputs/outputs like we replace boolean with integer
there's a node called Select which functions for most types of values
I cant get how it works
are there any good explanations?
@maiden wadi do you know those times, when you solve your problem but you actually have kinda no idea how you done it? went blind in with my guts
i dont understand fully why, but it works
lol
@hollow drift The second picture you mean? Or?
@last walrus Select nodes are pretty simple. Consider that a boolean is actually a 0 or 1. Enums are 0 to 255. So a select on int is pretty much the same. Input an integer and it'll select one of the options based on it's inputs. Judging your question though, I think you might actually be looking for a Switch? Pretty much the same thing as Select, except for execution flow instead of selecting a particular value.
i'm having difficulty getting an actor to 'faceme' when running in simulation mode, since there's no player character as such
GetPlayerPawn, GetPlayerCameraManager, GetPlayerController seem to not get a handle of the simulation viewport
I am having trouble setting this simple following door mechanics: I want every time I overlap a BP_DoorOpener, All instances of BP_GenericDoor open
How should I set up this kind of communication?
without using level bp
@last walrus Select nodes are pretty simple. Consider that a boolean is actually a 0 or 1. Enums are 0 to 255. So a select on int is pretty much the same. Input an integer and it'll select one of the options based on it's inputs. Judging your question though, I think you might actually be looking for a Switch? Pretty much the same thing as Select, except for execution flow instead of selecting a particular value.
@maiden wadi I'll look for it thanks
@spark cliff I'm not sure that is possible. Maybe through an editor utility or C++
@little cosmos There are a couple of different ways. Do you only have one DoorOpener in the level at a time?
Let's suppose I do
ty
Authaer, thanks for your help earlier. had to hop of, gonna try out stuff now ๐
@little cosmos Easiest method is likely a dispatch or creating an array to call stuff through. Would allow you to continually add more and more doors with no change. Even if you have multiple door openers, it's probably still the best way the only change is how you reference the door opener. For example, if you want a simple single door opener, just have it call GetAllActorsOfClass on beginplay and return the doors. You can either bind an event in the doors or save the doors in an array for a call later on the overlap. The only change for multiple door openers, you'd probably expose a tarray of doors variable inside of the dooropener, add your doors in it in the level designer. Then do the same. Either bind an event in the doors on beginplay, or just keep the array around and use it to call a function on the doors manually in a for loop.
Hey guys, got a bit of an issue with my first person camera, it clips through the meshes when I'm crouching underneath them for some reason even if I have the collision test on the spring arm enabled
@little cosmos Easiest method is likely a dispatch or creating an array to call stuff through. Would allow you to continually add more and more doors with no change. Even if you have multiple door openers, it's probably still the best way the only change is how you reference the door opener. For example, if you want a simple single door opener, just have it call GetAllActorsOfClass on beginplay and return the doors. You can either bind an event in the doors or save the doors in an array for a call later on the overlap. The only change for multiple door openers, you'd probably expose a tarray of doors variable inside of the dooropener, add your doors in it in the level designer. Then do the same. Either bind an event in the doors on beginplay, or just keep the array around and use it to call a function on the doors manually in a for loop.
@maiden wadi That sounds complicated. I'll look into that. thanks
here I am crouched underneath a wall but the top right is getting clipped and I can see through
@maiden wadi both
the get in 1st image i use to select which pawn from the array i want to get, the second one is the construct to fill the array
@little cosmos Try something like this for quick test for a single door opener. Or for opening every door from any door opener.
I got it to work using event dispatcher on the FPSCharacter which is being called everytime I step on the BP_OpenDoors trigger
and I bind an OpenDoor event on the BP_GenericDoor
This works too. But do try to cut out the character. Because for example, if you decide you want this to work with multiple pawn types, or other things, it makes it easier to alter when you don't have to alter every one of those classes. You'd just have to change your Door Opener alone.
Okay man, thanks a lot!
@slender idol To be fair, I don't know why you have a spring arm there. It has no length so it can't push the camera in to avoid anything. There's a setting somewhere you might try, let me try and find what it was.
@slender idol Near Clip Plane. You might consider lowering that in the project settings. It should allow things to render closer to the camera I believe. Haven't messed with it much myself.
@maiden wadi all right, Ill try it out thanks
so i did a sketch of my problem, and i guess i got it now ๐
cool ๐
just gonna have to find an elegant node setup for that
Haha, what's it look like right now?
""""elegant node setup""""
kinda like that
๐
ffs is the last one?
its code before the days of loops
but i've seen someone do something similar...
idk, perhaps y saw it before. i tend to meme around with it a bit^^
damn, we need a code meme section
@spark steppe Wait, you still need to do the nodes on it you mean?
yea, i've only reached the point where i understood how to solve it
i calculate the required distance on a flat plane by my desired pitch and the height of the vector, so i ignore X axis first
then i rotate the whole vector around the z axis, so it stays in the desired distance but reaches the point where it belongs
Do you already have the green vector?
i would be done if i had it ๐
Do you have the red?
Do you know the distance from the character?
i can't use the distance as the vector has to stay in relation on its x/y axis
wait
That green would be I mean, from character to the green vector?
hey guys ๐ just a small question, in the animation blueprint state machine stuff
how can I transition on an event instead of a bool for example
Is Red in world or local space?
And is it supposed to remain around the center of the character like your image above?
Z wise I mean, up and down. Is it supposed to stay at that z level?
yes, it should move on the x/y axis until it's in the field of view, so away from the character
wait, so i got the height, i got the distance, it's aยฒ + bยฒ = cยฒ
xD
ffs, really?
If Red is already at the Z it needs to be, then for safety, just take red. Zero Z out. Normalize it. This will technically normalize it on a 2D plane. Use your distance on this and multiply this Zzeroed vector by the distance. Then readd your original Z.
thank you
Haha. Was that the math you needed?
yea, and i have the feeling that this is what you suggested earlier but i couldnt twist my head around that
thanks for your patience ๐
Nah, vector math is fun.
or wait
it's not all that i need
i still have to calculate the final distance before
i only know the distance to the green sphere
but i would have to multiply the direction vector by the distance of the green sphere
or am i wrong?
im right for this one^ ๐
The dist to the green sphere is the one you need.
yea
are there any nodes for making my life easier, or do i have to mess with pythagoras now? ๐
that's really my weak spot... i did trigonometry helpers in probably every language, and everytime i hated it (even in lua xD)
the crosshair of what?
@spark steppe Nodes like what?
well maybe some vector magic can get me around messing with cos/tan/whatever
@swift pewter Usually you would line trace from the camera, get the hit vector, and use that or the end trace, to do a second trace from the end point of a weapon to the hit location of the first trace.
actually i have to calculate the distance by the max pitch (lets say 33 deg) and the height offset from the head
so i got 2 angles (as the other one is 90deg) and one side
@swift pewter Hmm. It depends. Single or multiplayer?
You can if you center the cursor to the screen. But you can also just as easily make a function to return a camera's trace. I normally did it in the character that had the camera.
he probably has that, and might want to test it, because afaik that trace happens anyways?!
@spark steppe But anyway. Which distance are you after? Might be a non Greek way to get it.
rather looks like it does, as it comes without execution connector
well, the distance from head to green sphere, we can ignore x/y axis for that
so we know the z-distance and the angle of the head
actually, we know all angles
What determines the green sphere? Or the red sphere even?
the red sphere is defined from outside (either line trace or some specified goal by other means) so my controlrig just gets a vector where it should aim at
the green sphere is something we make up so that the head wont pitch over a certain amount
So in your display above, the red would be the goal, but it'd be too low for the character to look at?
yea
Hmm. Do you know at what pitch level you want it clamped?
yes
i already sorted out if its within field of view, so we can always assume max-pitch as angle, as it otherwise wouldn't correct the value
Ok so I I've tried some things with select node and now I want to know - how do I get a reference to fuction? for example I want to run 1'st func when the value is 1, second when it's 2 and etc
you should be able to do that with delegates
@spark steppe I wonder if you might just clamp the pitch from the look at rotation after the math is solved?
@last walrus you want to use a switch node
is it that easy? wouldn't i have to calculate pitch and roll then?
@last walrus Use this, click add pin. Use the numbered outputs.
as it would otherwise tilt if the head has also yaw applied
ben
if y want we can have a look together with it, perhaps we can find an idea together
hello guys, i have a small problem, can you tell me how can i add this
but with share screen perhaps?
@spark steppe Well, you have the look at rotation from the head to the green vector. Since you have the head location and the green vector. So you should be able to just break the look at rotation, clamp the pitch, reassemble the rotator.
under components
@maiden wadi i dont have the green sphere, thats why i need the distance of it actually
Oh right. Fair.
To be fair, the look at rotation to the red vector should output the same.
If you clamped the look at rotation from the head to the red vector? Which I suppose might make the green vector useless? Unless you still need it for something.
any ideas for my problem ?
the green vector is a control in my controlrig and drives the ik (as i have also spine rotation in the lookAt solving)
so thats why i want to get the control somewhere to drive the IK to an actual reasonable target
@carmine drum
the control is an empty actually
ok
it's basically a transform which has a location/rotation/scale
but some small extra perks ๐
lets do screen sharing, there must be a solution to it
@spark steppe Oh. Actually wait. I wonder if you could just do a pitch clamped rotator to the red vector, and use a plane trace to get green.
i just cant follow well text, looks like its more complicated
Sec, lemme show.
guess intersect plane is what you mean?
If my thought is correct, intersection from that would be Green.
Basically find the look at rotation to red, clamp the pitch to what it needs, use the rotation from where the head normally is in the direction towards where green would be, find that on the plane facing upwards on Z, at a location of red vector.
@swift pewter Are you doing both traces in the same function?
@frail condor Are you talking about transitioning between these?
@frail condor Either way, either here or in the AnimGraph, you can't really switch on an event because it's all state driven. You need a variable of some kind, either Bool, Int, or Enum to switch on. If you want to create an event to call, either do it in the owning character, or in the EventGraph of the animblueprint. Then you'd get that instance and call that even that'd set a variable for those switches to happen on.
@maiden wadi thanks for replying ๐ yeah i was talking about those haha
@swift pewter You need a SelectVector
@swift pewter Do this. That way if for any reason your first trace hits nothing, it has a vaguely right direction to shoot in.
Maybe. Is this for projectile spawning or line trace shots?
If it's for line trace shots, you probably don't want to do anything if they don't hit something with the second trace. So the hit location should be fine. Might want a branch to do it only if there was a blocking hit.
Otherwise you'd end up with particles hanging in mid air at the end of a line trace.
That's odd. It's like half of them are being shot towards 0,0,0.
Can I see your second trace stuff?
guessing there's no real way in blueprint to outright duplicate a component?
authaer that sounds like it might work, just for my understanding, the intersect plane node... isn't it more like a "trace" of line A vs line B?
the inputs in the control rig are a bit different, so i have a direction instead of the end point
the plane gets infinite extended from the origin into it's direction?
idk why i wont get a hit here
plane should be on the height difference between head and goal (start: 0, 0, 9,...) and extend on the x axis (plane normal: 1, 0, 0)
and the direction of the start point points towards that
or i misunderstood how the node works
@swift pewter Not sure why it's returning a 0,0,0. You might try branching on if there was a blocking hit before the apply damage.
I am trying to make a functionality for when I press Z on the keyboard the pawn changes from First person character to the default roaming pawn. how's that achievable?
@little cosmos one way is to carry around 2 cameras and just switch the active camera
@spark steppe That should be the same one as I posted if I'm reading that right. Basically PlanePoint needs to be the red vector. PlaneNormal should be 0X0Y1Z. This is to make it a plane that faces upwards, like a flat floor surface. Start would be the head's normal location, Direction would be the PitchClamped look at rotation turned into a normalized vector.
yea i was going a different way but the result should be kinda the same
so the plane should actually extend until it's hit by the line?
if we think of that node as a plane and some line going through space instead of the greek math that i try to avoid for hours now ๐
@spark steppe There must be a more elegant and simple way
(which it probably is)
how do I just switch between them?
setViewTargetWithBlend is what i use
and i think its better than moving the camera around
but whatever you prefer
Is that in Niagara by the way?
You put a branch right before the apply damage, right?
If the bool going into it is Blocking hit, can you print out the hit location on that? See if it prints anything, and see if it's 0,0,0 when it does.
@swift pewter Print on false I mean. Not on true.
Hi everyone!
I'm creating wallrunning, i've got it working, but you can move to the right/left by simply looking that way and moving forward or by moving right/left.
I'd like to have it so you'd just stick to the wall. How can i do this?
I am trying to make a functionality for when I press Z on the keyboard the pawn changes from First person character to the default roaming pawn. how's that achievable?
@swift pewter Actually I think I just realized the mistake. I completely overlooked that this is for traces. I'm so used to doing this with projectiles. Some of those are probably not hitting because the trace stops just at the wall sometimes and sometimes just barely hits it.
I'd bet if you drew debug points from the line end, each of them would show up on the wall, even the 'misses'.
So the simple answer is to ditch the second trace. Just do the shooting based off of the camera trace.
does OOP applies for classes too?
i am working on a very messy blueprint so I had to do that ๐
(cast fails or returns none)
@swift pewter Depends. That's design decision. In short, you could either do some vector math to trace from the camera little differently so as to only trace from near the character, or complicate it with a multitrace and a lot of vector checks and filtering.
@dense mica If it fails, it's likely that the instance of that's child actor class variable is either not set, or it isn't of a class castable to BaseUpgradeElement.
Child Actor Class node is pure Actor class, CurrentChildActors is BaseUpgradeElement class
Basically problem was this
@swift pewter Personal preference for simplification would be to just move the trace start. Ditch the second trace, and only trace from next to the character or weapon You can solve this pretty simply. Let me connect a few nodes.
@dense mica Right. It'd be like adding an AActor pointer to an ABaseUpgradeClass pointer array. You'd have to cast that AActor to ABaseUpgradeClass. But if that actor pointer is either null, or doesn't point to an object that is actually a ABaseUpgradeClass or a child of ABaseUpgradeClass, the cast will fail and return a null pointer.
Thanks Authaer
@swift pewter Try this out.
Basically it'll find a point directly in front of the camera that is as far away from it as the gun is. Then it'll start the line trace from that point instead of directly from the camera itself.
So the line trace should still be centered, it just won't hit anything between the camera and gun.
How do you mean?
You're tracing from a point on the gun to a point that the camera is looking at. So it's like pointing to a location from the side vs pointing directly at it.
Not really. Think of it like a sphere. You have two lines going straight to the center of the sphere, but one is slightly from the side. It'll hit a different point on the sphere than the other line.
They both have the same exact destination, the center of the sphere, but because their origins are different, they'll hit a different spot. So it just comes down to whether you care about that slight inaccuracy, or if you want pinpoint crosshair accuracy.
btw authaer its now working with the intersect plane node, thank you
Personally, if I was designing a third person shooter, I'd probably go with a mix of what I did above to avoid things behind the camera, and also do some checks that it isn't too close. If it's too close, I'd probably do some traces from the weapon since you want to give the impression that it's from the weapon, so if it's too close, do it from the weapon, if it's far enough, just do it straight from the camera.
didn't help that the controlrig behaves a bit wonky in preview when playing with the control values, tho
but the values are what i would expect and ingame it also is what i would expect, so thats good
@spark steppe Victory! I had a thought also that that math doesn't quite apply with pitch up. But I was going to make the point that you could just inverse the pitch direction. do the same math and then double the Z distance up. That or make switches on wither the pitch was positive or not and switch the plane normals and such.
i do that at the end of all calculations before readding the head location which i removed before for doing all other calculations relative to it
ah, i dont even have to do that if i put the control in a space which is aligned to the head ๐ค
Is it possible to somehow reference a material by tag?
Hey guys!
I've got multiple float values from an array of actors. Is there a way to seperate these values or sort them by the highest value?
You can sort arrays in C++, not sure why there doesn't seem to be a Sort node in blueprints
One of my BPs suddenly wouldn't compile anymore on an old piece of blueprint I hadn't touched for a while saying "Error: Dependency cycle detected, preventing branch node from being schedule" (or something like that). I tried restarting the editor because I didn't know where that was coming from, and now the editor crashes on startup, on KismetCompiler...
Any idea what's gone wrong or how to fix it?
thanks @earnest tangle !
Hello, I'm new over here and also new to unreal and this a question regarding my first unreal game project!
is there any way that i can spawn/attach the particles to a socket/skeletal mesh when i run the game! (like while runtime)
//I'm using ALS for movement and stuff
@void snow Sure. Which Particle system are you using? Niagara or Cascade?
cascade
Are you wanting to attach an already spawned emitter, or create a new one and attach?
create a new one and attach
Check out SpawnEmitterAttached, should be what you're after I think.
Just input the skeletal mesh as the component, and the socket as the name.
@void snow Are you just trying to add a particle, or a second skeletal mesh as well?
only a particle onto an existing mesh (which is held in player's hand)
Kay. you don't need the cast or the add component. Or the GetSocketBoneName actually. Just plug Mesh directly into the AttachToComponent, and type the socket's name in the AttachPointName.
You'll probably want to change LocationType to SnapToTarget, and maybe turn AutoDestroy off if you want to keep the particle around longer than it's usual lifecycle.
So i have a puddle shader I applied to a material. I can control the amount of puddles through a collection parameter. I am making a rain system, and I want the puddles appear like only in the area where it's currently raining. Is it possible to like, only make the shader work in that specific area in the world of that material?
So like it's a landscape, and landscape has that material applied to it
There's probably some way to do it, like doing it based on vertex color values or something... might be a better Q for #graphics though.
could not find a single thing about this online lol... and it's honestly super beyond me
Thank you @maiden wadi it worked ๐
there is an issue with it
if i manually give the location it will not follow when the player is crouched
@void snow Does it spawn at the socket location if you leave it at 0,0,0?
no it doesn't it spawns b/w legs instead of the stick
@void snow Is the stick part of the skeleton in the mesh, or is it a separate object spawned in and attached to the character mesh?
its a separate object
Hey Fellow Blueprint Programmers :)
I need your assistance. I want to SpawnActor from Class on a specyfic streamed level. How to do it? Is there a way to plug an level to an "Owner" pin?
its an animation state in which player has a stick in his hand
@void snow Attach the particle to the stick then. You'll need a reference to it somehow. Alternatively, attach the flame to the same bone you did the stick and offset it enough to make it look like it's part of the stick.
@void snow Attach the particle to the stick then. You'll need a reference to it somehow. Alternatively, attach the flame to the same bone you did the stick and offset it enough to make it look like it's part of the stick.
@maiden wadi with the bone/socket location thing in the particles?
Nah. Your particle should be fine the way it is. Is the stick itself an actor by chance?
Plugging a Bool directly into And checks whether itโs true, right?
@rose hazel What do you mean by into and? If you mean the logical And for bool, that checks if both inputs are true, if either is false, it'll output false.
@void snow Show me the stick itself, however you've created that.
I have a branch that needs two bools to be true, so Iโm using and And node. Will plugging the bools directly into the node be fine?
@void snow Ah, okay, so that itself is a skeletal mesh. Where are you adding that to the character and it's hand?
@rose hazel That should be fine. Intended use.
@void snow I need to see inside of that function then. That is likely adding a skeletal mesh component, or setting a skeletalmeshcomponet's skeletal mesh.
HeldObjectRoot. Try getting that by right clicking in the graph and typing it. Try and attach your particle to that.
Is there a way to get the owner of a socket after GetAttachSocketName if the socket is in another blueprint?
@rose hazel What do you mean by in another blueprint?
Sockets are generally a part of a static or skeletal mesh. Which you'd already have a reference to if you're calling GetAttachSocketName on the component holding it.
Iโm working on a modular gun thatโs broken up into 5 blueprints - the stock, the receiver, the action, the barrel, and the magazine. Iโm working on the action, and it needs to check whether a value in the receiver has been changed
One of the static meshes in the action attaches to a socket in the upper receiver mesh
Hi again, different question: how would i rotate my player to look towards a vector's direction?
More like this: how would i set the player's rotation to a vector's rotation?
@rose hazel Initially I'd just make the point that a single actor with multiple components would probably be a lot better for this sort of programming. Your components could easily be modified with similar parameters and the main actor could do the attached checking from it's own components, etc. Barring that though.. Which is attached to which? Is the action attached to the receiver or vice versa?
@solid rapids For a character?
Yeah
The action is attached to a socket in the receiver
@maiden wadi It's for a character and wallrunning.
I want the character to rotate along a surface.
@rose hazel Your Action could call GetAttachParentActor I think. That should return your receiver it's attached to to get your value from it.
Thereโs GetAttachParent, but not GetAttachParentActor
Although I should be able to reference the actor from the mesh since thereโs a reference
@solid rapids This math with one of these, depending on how you're rotating your character.
Ah okay thanks a lot @maiden wadi!
I'll try that!
@rose hazel It's from actor itself, if you're trying to drag off of another pin. Try to see if you can get it straight from the graph.
@void snow Oh wait, no, I think it's in your components list. It has HeldRootObject attached to Mesh, and in that is SkeletalMesh and StaticMesh
Do actors have a โcreated game timeโ?
@maiden wadi I don't think that really does what i want, because i want to set my player's rotation to the rotation of a vector, if that makes sense.
I'm not seeing that happen with this math
I think it rotates towards the location of the vector
_ _
I just need to get the vector's direction and apply it to my player, but i don't know how.
Hello! I'm a little new to landscaping in Unreal, and it would be really nice for my project if I could use Blueprints to control the heightmap (position, z-scaling, units, sections/components, etc.). However, I haven't found any resources on this, or anywhere saying that this can't happen. Is this something implementable?
I do not wish to use plugins, if possible
Straight question: what a replicated variable means?
Was reading this -> https://docs.unrealengine.com/en-US/Gameplay/HowTo/Networking/ReplicateVariable/Blueprints/index.html but it wasn't clear enough to me.
Guide to using Replicated and RepNotify Variables in Blueprints.
Probably variables which are important for all users in a multiplayer game ie numbers of players left, leaderboard scores, etc. I could be very wrong though cause I am new to Unreal so, feel free to correct me.
Well, I wasn't specific enough. When a variable replicates, what happens?
@solid rapids That's what that math does. In shot, this is leveling the desired facing vector with the character, so that pitch doesn't apply. Then it's finding the rotator that if applied to the character would face that location. To simplify it, you could probably just do TargetLocation and CharacterLocation into LookAtRotation.
From the server's perspective, will it send it to the client automatically?
From the client's perspective, what happens?
Actually, I better ask at #multiplayer. Sorry bout that.
@night quail I'm unsure of how it works, but there is an engine plugin that does it. Check out LandMass. It's Unreal developed, so not really a third party, if I recall correctly. If you wanted you could check it out and see what it's doing.
A simple check to determine the parent of the socket and get a reference to the actor. After this, is there a way to check a variable within the actor being referenced?
@rose hazel just cast to that actor/parent
@maiden wadi I looked into that, but all I found was custom blueprint brushes - I don't want a brush, I just want to perform a one-time operation on the entire landscape (which is dependent on the imported heightmap). Ideally, I'd like to take in all the vertices of the heightmap as an array, and perform operations on it
It's a little cumbersome to figure out the math behind everything in order to properly scale an image to the desired heights, so I want to automate that - as well as control how many components and sections I have depending on the image's resolution. I can do things like that with materials and texturing, so I hoped that there's something I can do like that with the heightmap
hello, how can i tell an object to destroy itself when touching the ground?
Any changes I should make? This is the Action blueprint, which will be attached to the Receiver in a fully functioning rifle
It depends on what you're doing, I don't think he said what the goal with this is
The action will move forward if itโs attached to a Receiver actor and a bool in the receiver is true
@rose hazel Since you're dealing with an actor attached to an actor, I'm still fairly certain that this is what you're looking for. For example, I have a gun attached to a character, and if I put this in the gun's event graph and cast the attach parent actor to the character type, this works.
gotta love cast and branches on tick
Most things can be made event driven later. Testing doesn't matter. And tick only starts mattering when you start reaching hundreds of objects, or your target platform is an N64.
Try open-world survival with plenty of NPCs on a 6-year-old PC
it's habit forming though and leads to technical debt. I never encourage it but whatever, it's not my call
sounds like you shouldn't be doing stuff on tick but whatevs
To be fair, the whole weapon should be a single actor class with interchangeable components, rather than using actors as components themselves.
The thing is, there isnโt a base weapon per se
maybe there should be
Every โweaponโ in the game will be a series of parts working together
Any idea on why this would alter the color of the image? It's adding color ... A blueish tint all over
Itโs going to be completely modular to the point where individual parts are essentially junk items on their own
Any idea on why this would alter the color of the image? It's adding color ... A blueish tint all over
@neat stream probably more of a #graphics query but, have you considered that lighting could affect it? does the material have anything in that could alter it?
can't be because im just changing the same mesh material at the same place
Right. And if you make a base class, your components can still work together the same way that you're doing with actors now. For example, if you create a class inheriting from Skeletal/StaticMeshComponent, then you can make all the components you want with all the functionality you want. And they can all work together in a single actor class that is the weapon base.
As for your screenshot @maiden wadi, I didnโt see GetAttachParentActor because I was trying to drag off of a mesh
(an undo function)
@rose hazel To give a clear example. What I mean is make a single actor class. This is more of less just a container to call simple functions on like attempting to fire, reload, etc. Your components can still attach to one another and have their own functionality. For example if you call fire, you might tell your trigger parent component to call a firing function, this can be overridden in child classes for different effects like single shot, double barrel dual shotgun blasts, etc. Maybe something else decides ammo type if the weapons have variants, and your barrel might do the actual projectile spawning or effects since it has it's own location to do them from. Or your ammo type component can use the barrel for it either way. This all allows you to not only customize weapons themselves, but simplify all of your function calls. No matter what weapon type you have in hand, you'd only make one 'pull trigger' call to the main actor class, and that can chain itself through the components. Better yet, if you're making a UI for all of the attachement stuff, the only reference you'd need would be the one main actor and have some simple functions set up there to poll information from the components, like maybe durability for each component, quality, etc. You could even go so far as to make it so that all you need to do is populate a datatable with the required info per component. As in having a list of what barrels might attach to what stocks, what ammo certain parts can use, damage modifications from both type, and qualities.
Does anyone know how I would be able to grab spawn point locations without level streaming?
https://www.reddit.com/r/unrealengine/comments/5pva9j/is_there_any_way_to_edit_landscapes_at_runtime_yet/ I keep finding questions like these, but they're not recent and unreal has changed a lot in the past couple years (continuing my previous question)
@odd ember branches on tick are fine if necessary. Most of the shit we see slapped on tick isn't tho.
@rose hazel I'm running a similar type of system for vehicles
@rose hazel I'd suggest doing it like this.
You have a base Weapon bp.
The BaseWeapon can have a collision box or whatever, but otherwise is almost empty. In my game the base Vehicle is only a chassis.
You have WeaponParts(Vehicleparts). They are separate actors which can implement certain interfaces like Fire and ADS and Reload. In my game the VehicleParts implement Throttle and Brake and Steer and Activate.
When you add a WeaponPart to a Weapon, you register it so the Weapon can forward commands like Fire or ADS or AltFire to the right parts. You could also do math like updating weapon ammo type or mag size etc.
Iโve managed to work out spawning and firing so far. The player canโt hold the gun yet, but the action can respond to the Trigger bool in the receiver
You'll get more milage out of events StartFire and StopFire
I would have it set up like so.
Mouse click triggers Fire on the Character, which calls Fire on EquippedWeapon, which calls Fire on it's parts that are registered to receive Fire (WeaponPart_Receiver)
Reciever queries Magazine for ammo. If it has ammo, reciever tells Barrel to fire Projectile from Barrel's MuzzleLocation
That of course is of you intend to have wacky shit like recievers that don't need ammo or infinite ammo drums or whatever.
For realistic guns you can just make it all data driven and have one logic chain that uses data from all the parts to run.
how to change child item position inside vertical box?
@sour urchin in UMG?
yes
@sour urchin maybe use a grid instead? I know the grid slot can be read, but not sure if it can be set in code...
speaking of...
can anyone see why on earth I'd get these errors?
since I can't step through pure functions, I'm having a bit of difficulty debugging
@sour urchin โค๏ธ
holy shit, super duper facepalm, you are correct!
@faint pasture branches on tick are not really fine no. ideally tick should be disabled BP side
thank you for noticing it! eagle eye ๐
What is the name of theBP allowing to display a text or image on a actor BP which is oriented according to where the player is? Example: X button for open
@atomic prairie add a widget component to the actor.
You can have its rotation change to face the player, or set it to render in screen space, but in screen space it will be drawn over the player in case that is not wanted.
Okay thanks!!
Hi ! I'm trying to make a twin shooter game . But the template proposed by UE is not what i am looking for ..
I would like to have player rotation and movement handled by LEFT STICK (or ZQSD on keyboard) when the player is RUNNING. [Situation A]
Player movement is handled by the LEFT STICK (or ZQSD on keyboard) and the rotation by the RIGHT STICK (or mouse) when the player is AIMING (Press LT or right click on mouse). [Situation B]
For the movement i'm ok . But i don't know how to make the second part . Running with left stick and AIM/Turn the character in the direction of the mouse cursor or right stick . Anyone can help me ? ๐
@patent blade AimDirection should be a function of RightStick, MoveDirection, and bIsRunning
Could you develop please ?
Anyone that can help me? I have this "secret door" that i want the player to be able to push open, but it dosent properly have physics on it for some reason, even tho it seems like ive done the collision right
Hi can anyone help me convert this blueprint from 4.16 to be workable on unreal 4.25
The videoTexture component does not exist in unreal 4/25
4.25*
Hey guys!
I asked this question before today but I can't get my head around it so I wanted to see if anybody else has an idea.
I've got an array of actors from which I do a calculation on a specific value. When I have multiple actors I of course get multiple values. So my question is: How can I seperate/split these values back into single variables so that I can compare them to each other?
If you guys want your character jump to target location, use this blueprint.
@grave relic it'd be a lot better with the physicsConstraint component
If it moves like a door
Hey guys. I have a question for anyone that's been using nDisplay with vive trackers.
I set up using Ben Kidd's video on youtube (https://www.youtube.com/watch?v=KYgTPJ7REqY) with the nDisplay new project template and created this blueprint: https://blueprintue.com/blueprint/fgg1zcub/ by creating a blueprint subclass of DisplayClusterRootActor
In VRPN, I'm getting the following data from the controller (not using a tracker atm):
Tracker openvr/controller/LHR-F7FD3B46@192.168.0.41:3884, sensor 0:
pos (-0.08, 0.78, -0.36); quat ( 0.20, 0.07, -0.15, 0.96)
Tracker openvr/controller/LHR-F7FD3B46@192.168.0.41:3884, sensor 0:
pos (-0.08, 0.78, -0.36); quat ( 0.20, 0.07, -0.16, 0.96)
...
and that's coming through nicely in my Print String (see attached image) so I know that the data is passing through from the controller -> VRPN -> UE4 / nDisplay and it looks similar to Ben's (numbers from -2ish to 2ish)
lastly in my nDisplay cfg i have (alongside my monitor setup):
[camera] id="camera_static" loc="X=0,Y=0,Z=0" parent="eye_level" eye_swap="false" eye_dist="0.064" force_offset="0" tracker_id="ViveVRPN" tracker_ch="0"
[input] id="ViveVRPN" type="tracker" addr="openvr/controller/LHR-F7FD3B46@192.168.0.41:3884" loc="X=0,Y=0,Z=0" rot="P=0,Y=0,R=0" front="-Z" right="X" up="Y"
however the movement of the camera is really tiny. I feel like i've missed something but can't put my finger on it
An overview of the Unreal Engine nDisplay plugin, how to use it and how to setup a config file.
Links
Docs: https://docs.unrealengine.com/en-US/Engine/Rendering/nDisplay/index.html
nDisplay Vive tracker tutorial: https://youtu.be/ZuAwDnw26JI
Im useing one, but cant get it to work, and from my testing i think its the collision that is the problem, but i might be very wrong
@rough wing
does it just not move at all?
Also in the viewport do you see your fireplace and the wall inside blue/red collision boxes?
Non one can Help ?
Hi ! I'm trying to make a twin shooter game . But the template proposed by UE is not what i am looking for ..
I would like to have player rotation and movement handled by LEFT STICK (or ZQSD on keyboard) when the player is RUNNING. [Situation A]
Player movement is handled by the LEFT STICK (or ZQSD on keyboard) and the rotation by the RIGHT STICK (or mouse) when the player is AIMING (Press LT or right click on mouse). [Situation B]For the movement i'm ok . But i don't know how to make the second part . Running with left stick and AIM/Turn the character in the direction of the mouse cursor or right stick . Anyone can help me ? ๐
@patent blade
So youre not looking for a twin shooter youre looking for a third person shooter with the camera upside down?
@grave relic #legacy-physics would help
Okey will have a check over there, thx for the help!
Hey guys, is there any way to generate LOD at runtime for skeletal meshes ?
@patent blade if you are running, aim direction equals move direction. Otherwise, aim direction equal stick direction
I'm trying to use Suggest Projectile Velocity to get the velocity from point A to point B then launch it in that direction but it doesn't seem to be doing anything to the actor even though the method returns true and I get a suggested velocity.
First, why are you overriding gravity to be one.
Second, you are suggesting the velocity from 000 to your target point. That's probably not desired
Third, you are probably breaking the suggest projectile velocity because you're requesting a velocity from 000 to 000
Fourth, is spherer simulating physics?
Yes sphere is simulating physics.
I thought I had to override gravity.
And projectile from 000 to my location was just a test.
I don't understand your third point.
The actor that's being spawned is at 0,0,0 but
my actor's location is not 0,0,0
It's like 5000,0,0
You should check the velocity change checkbox on impulse.
Otherwise, mass comes into play
Still nothing, object just drops straight down.
What does the output of the suggest projectile velocity look like?
It should be a vector of length 400 in the direction toward the target.
Yes it's not printing anything I think when I check velocity change in impulse
Wait nevemrind.
It's just failing.
It wasn't earlier.
Weird.
It can fail due to gravity if the velocity isn't high enough.
ooh
But it's just failing outright
Well when I override gravity z with 1.0 instead 0.0 it doesn't fail.
And it gives the velocity 2500,0,-999
But it doesn't fire the projectile at all
I got it working, don't even know what I Was doing wrong but it works..
Anyone know about publishing games?
ah yes, the quintessential #blueprint question
Wrong section right?
yes
ahh sorry, ive got this logic for the enemy to hit the player and when it shows from the print string its giving location not player name would that still work?
@subtle pulsar uh....what.
Why would a player name even come into the question?
You want to break the out hit to get the hit object
I still want to make my NPC rotate to face the player not instantly when touched or damaged, how would I do this?
Is there any way to trigger an event when a variable is changed instead of having to rely on checking every tick?
is there a problem with this function?
it says this:
Infinite loop detected. Blueprint: BP_Door_In_interact Function: Set IsDoorClosed Call Stack: Show
When you iterate for one time you go back and telling the bp to iterate 46 more time again and which makes 47 iteration, and on 3rd iteration you do the same and it makes another 46 more
And it never stops
how do i get it to stop
@lime mason whoah wtf is that
Are you especially using for loop or just opening the door will be enough?
For Loop is not a good way to open doors ๐
@lime mason Use a timeline
yeah
or RInterpTo could work too
Unreal Engine 4 - Door Blueprint (timelines)
thanks
Does IsValidAILocation use the same navmesh as the player character? I can't get it to work, it returns true for locations within level geometry.
A timeline is like a little ticky boi you can fire off and do ticky things without sitting on tick updating the door all day when you only care to update it when it's opened.
only available for actors sadly
Still waiting for my answer on how to do AI Chars rotating to face player on touch and damage, like in Postal 2.
Not sure how it was done in Postal 2, but I do it with a bShouldRotate boolean on Tick()
Hmm, I could do that
you can do the math, right? I've got my logic in C++, but it's something like calculated delta phi between the NPC->player vector and NPC facing vector
then lerp to it or just linear add until delta phi < (whatever tolerance you want to set)
I have a custom event in my level blue print toggle building that I want to call when a button on my player widget is clicked..
but in my player screen widget I can't seem to figure out how to get the event from level blueprint
@lime mason Something like the 2nd one would work
It'll take some fiddling to figure out what yaw corrosponds to open vs closed but it should work. I usually prefer to have the timeline output just go 0-1 and have it lerp the open and closed rotators
im having trouble interacting with it
instead of booleans you can use flipflops
and for interaction look for line traces
@lime mason
i have it as a boolean because it might start open
flipflop can do that too
oh sorry now i got it
for interactions you can use event instead of InputAction and on linetrace you can get HitResult, break it, on "HitActor" cast to your door actor then call that event you created
ok
can someone explain to me why the angle is 0?
https://math.stackexchange.com/questions/2410733/angle-between-two-vector-when-one-vector-is-zero ok... so what would be a sane way to get the angle then
for interactions you can use event instead of InputAction and on linetrace you can get HitResult, break it, on "HitActor" cast to your door actor then call that event you created
@dense mica when you say event, what do you mean?
Custom Event
replace input action with a custom event
and use input action on character class to fire line trace
so the custom event would ne in the door bp right?
i have this in the player
it does a line trace then checks if its the door
then if it is does the door interact event
but
idk i
it doesnt like something
oh
its cause i didnt compile it
lol
ok well it opened but the closing is a little janky
for some reason when i click on it to close
i have to move and then it closes
any idea what thats for?
@dense mica
you can remove the "==" and branch
i have to move and then it closes
i didnt understand this
ok
what do you mean by "move"?
so
wasd is movement
i click to close
and it doesnt do anything
till i use the movement keys
could be about collision?
i have no idea why its doing it
oh
i guess mouse movement as well
i think theres a delay on it
or something
idk
oh im just dumb
i figured it out
it was set to 5
seconds
so reversing it would take a long time
ive never dealt with timelines before
and all the moment stuff was coincidental
fun
ive been bamboozled
so im new to unreal and im jumping in head first into procedural generation ive generated a dungeon kind of. in unity the way to do procedurals would be to have premade rooms and assign them numbers in an array and use if else statements along with a variable telling what side or wall is open to another room here ive taken a different approach and just generated a floor with planes tiled and walls with a cube instance how would i go about making a beginning and an end to this maze i was thinking some sort of ai with a script to destroy the cubes it touches or a raycast of sorts
thats long
this is what it looks like now
I want to know how to reset the velocity on the character
@hearty gazelle You mean like reenabling it?
So I bounce up my character
but when I hit a trigger
i want the velocity to be reset to 0 so that it stops going up
let me try
I assume itโs possible to add projectile movement into an actor using another blueprint?
I finished a .357 round that replaces its own mesh with a spent case when fired, but I donโt want the case to eject itself until the gunโs bolt is completely opened
@icy mica Don't ping everyone randomly, please. What is your jump doing wrong besides just not working?
@rose hazel You might try a simple static mesh component spawned attached to where it needs to be, and then on the bolt completely opening, set simulate physics on it and give it a velocity.
@maiden wadi so whats my problem
@icy mica You have no number in the DoN. It'll never leave zero and you're not doing anything on zero.
So the projectile movement can just sit there in the actor until the gunโs ready to use it?
@maiden wadi oh my gosh thanks so much
How does 1000 cm/s sound for case ejection btw
Not sure. It's possible. But with that you'd have to attach the actor to the other actor, leave the PMC at 0 speed, on eject detatch it from the gun, then set speed. I was offering a simpler route though. The bullet casing would just be a simple static mesh component attached to the gun with a static mesh set instead of a full actor. Then the only calls you would need to do are SimulatePhysics which automatically detaches, and then a set velocity.
The way itโs currently set up, Iโm planning on attaching the cartridge to a socket in the bolt from the moment itโs removed from the mag to ejection
Can I have a function that will return a Data Table based on a string or text variable? IE: if the input string reads "Table 5", it would return the reference to a Data Table called Table 5
I have a finished cartridge with a single bool named Fired. When itโs true, it spawns a bullet, changes the cartridge mesh to a spent case, and plays a sound
if you bother to make a TMap<FString, UDataTable*> DataTables; @modern cove
then its easy
if you want to dig through assets by name, somewhat less so
@rose hazel most games can get away with PCS doing shell ejection instead of having Actors for shells
I'm not finding any nodes that can turn a string into a Data Table
create a map variable
fill in the mapping
and then just access the datatable by string key
hrm..I haven't made a Map variable before but I see what it does
Otherwise I might just have to do a Switch on String and plot out the 8 possibilities
make string variable, turn it into a map, then select the datatable for other type
then add your 8 elements to the map
and then MapVar->Find(StringKey) returns the datatable you need
@rose hazel Are you planning on having your shell casings picked up, or interacted with past ejecting from the gun?
They can be collected and reloaded
no particle system fakery then ๐ฆ
Actor is very heavy to be using for something as common as bullet casings. You'd be better off just making a UStaticMeshComponent child class into a UShellCasingBase, and using that for any custom logic you need for picking up and ejecting.
Theyโll be physically locked in place after not moving for a few seconds, but the player will still be able to interact with them
but if you have something like 2000 RPM gun and a MP game, that approach will absolutely not work
Itโll be single player only
No way in hell Iโd be able to make a multiplayer game with how little experience I have at the moment
you can eject it as Actor and when it stops destroy the Actor and replace it with ISM
much easier on the performance
a trace would return the instance index of the shell
so would a sweep
overlap, not sure
so its possible to make the interaction
As long as the player can click or press a key over them, Iโm good
Still trying to figure out how the inventory system will work, but small stuff like this will probably just be an integer somewhere
This is the difference between spawning an empty actor with no static mesh component and spawning an empty static mesh component child class. Granted, you're likely not spawning five hundred at once, but still. And they can have the same exact functionality in the end.
Note, that's just spawning. Nothing to do with movement, or anything else.
Actor code is simpler to get working though
One thing to keep in mind is that Iโm not kidding about being new to UE4. Iโve had it installed for a while and I know some base level stuff, but thatโs about it
As in I donโt know how much I donโt know
An ambitious project like what Iโm planning may not be the best idea, but I can guarantee itโs the only thing Iโll have the patience for since itโs something I actually want to do
I'm not sure how? As far as a bullet casing goes, both have the same kind of events and usage.
Based on what I know at this moment, hereโs what Iโd do for a simple bullet casing
Spawn an actor with projectile movement, delete it after a delay of 5-10 seconds
@rose hazel This is all you'd need for a component based solution. This being the component parent class. You could either make some switches in here on spawn to set the bullet type, or make child classes with different values. Same as an actor.
Your gun actor can spawn it, leave it attached til the bolt opens, then call launch casing. Component handles it's own stuff and then 'turns itself off' more or less until someone walks by and calls an interaction event on it to pick it up.
Ideally use Zlo's advice though if you really want the best performance. Having a level actor that can hold ISM meshes would be best after they stop moving. Unless you want them to be able to be stepped on and kicked around.
Theyโd be kicked around in a perfect world, but even Iโm not sadistic enough to torture a PC like that
As for the actual bullet after itโs been fired, Iโm just going to destroy it. Cases can be reloaded, but thereโs no point in keeping the lead around since it wonโt even be usable
The movement could be a setting too, if you wanted to go that route. Branch on whether or not the user wants to allow it. Single player, so it's not like cheating matters much.
But no. The only honest drawback to the component method is that the actor spawning it needs to stay around. Of course that can easily be gotten around by making it in a level actor spawned from like GameMode and held in GameMode for easy getting to spawn more. You could use the same actor for the ISMs too if you wanted to really get optimization crazy.
I like the idea of simply replacing actors with meshes, then deleting each mesh when the player interacts with it, although one thing I was planning on is giving cases a โlifespanโ, as in how many times they could be reloaded before becoming useless
It wouldnโt be many - maybe 5-6 times at most
Steel cases wouldnโt last nearly as long as brass
Before the crazy optimization talk begins, how many shots are you considering having? Are you going to have a lot of automatic weapons? How many AI might contribute to this? etc.
There will be a few automatics, mostly SMGs and larger machine guns
Not exactly sure about NPCs, but definitely somewhere in the hundreds
Ideally, everything in the game would persist as its own thing - characters, weapons, ammo, etc.
Since Iโd prefer not to torture PCs, there are obviously exceptions Iโll have to make
So does an actor simply existing with nothing but a variable still take a toll?
Memory wise, yeah. If you disable tick, the cpu footprint is near nonexistent.
Setting aside memory usage, would the following be possible - after a spent case (actor) doesnโt move for a few seconds, it becomes a static mesh with an integer for the remaining uses it has. When the player clicks on it, the mesh is deleted and a new actor with an integer is spawned within the character, and the variable matches the one on the mesh
Thatโs assuming itโs possible to have a mesh with a variable in the first place
Otherwise, since thereโs a maximum number of times a case can be reloaded, I could simply have multiple meshes (Case0, Case1, Case2, etc.)
The actor would select one based on its remaining uses
i want to control the alpha of my IK chain by getting the alpha from the rotation difference, anyone has suggestions how to get said alpha value?
Well, the mesh and variable are easy. Simply leave it an actor and disable tick.
@spark steppe What is the rotation difference?
Perfect. I wonโt have to use any black magic or voodoo to consistently transfer the variables
for collision sphere
the main purpose is to detect whther u start to collide with something
or when end collide
currentFrame to frameTarget is the difference
right?
if you are already within the sphere radius when the game start
the "begin overlap" wont trigger right
but idk whats the best approach to get an alpha value from that difference
@rose hazel Not initially. The concern is more that if you have a few hundred of these, that'll start to add up. Que gamers being retarded, and that quickly turns into a thousand, two thousand ten thousand. Suddenly you have a playerbase whining about it. That's the biggest reason why programmers tend to be so anal about optimization. End users don't always want to use your product the way you intended it to be used.
So just using an actor for every single cartridge and case wonโt be a good long-term solution, even if actors stored in the inventory donโt have a mesh or tick is disabled for idle cases?
@spark steppe Wait, by current frame, what do you mean? Having trouble visualizing numbers. If you have like a max rotation and a current rotation that's just simple division.
i have the current rotation, and the rotation goal (as quaternion, which i could convert to a rotator)
and i want to kinda lerp to the goal, but i wonder which alpha i should use
@spark steppe Do you want to lerp, or interp? Is this something where you have the start and end value, or something where you have the current and end value and it's being called each frame?
later one
One good thing to come out of this is that I now know ticking can be enabled and disabled, meaning that I now have a better solution for a gunโs action. It currently checks a bool with each tick, so I can tell the receiver to enable ticking for the action when the gun is fired
the thing is that i only have access to interpolate methods for vector/floats
@spark steppe Where are you doing this in by the way? Your nodes looked like Niagara nodes last time you were pasting them.
@spark steppe Last question, constant movement speed, or slower as it reaches the target?
well i could live with constant for now
oh i might have found some node that does the job
@rose hazel All in all, you'll find a lot of things in game design are faked. For example, if you have a bullet casing with uses, in the inventory it likely just has an ID and a durability value and that's stored in a simple array. Even a 3d inventory would be like that and it'd just spawn a localized mesh when the player looks in the inventory based on the inventory's item IDs.
@spark steppe Do Rinterp exist in there?
ummmm i cant wall run
no, but there's accumulate lerp for quaternion
Add Iโve heard about it but I donโt remember to that
Haha. I know that feeling. I've been at this about a year now.
the only sad thing is that it only allows to set a blend value, so i guess if i set it to 0.1 it will add 10% each frame
@spark steppe Do you read C++ well enough?
anyone plz help
The thing is, I only know how inexperienced I am because I used Roblox for a while. I only knew base level stuff, and I know even less for UE
@maiden wadi can you help bro
c++ yea, but if i would understand all the math behind that stuff is the real question ๐
@spark steppe can yoou help me bro
but with that accumulate node the result looks good for me, so i'll just leave it as it is now
it doesn't "warp" the head to the location goal anymore, so thats good
@spark steppe These two are from the UKismetMathLibrary for getting a new rotation based off of the current rotation to the target with a deltatime input. Top is constant speed, bottom is slower as it reaches the target. https://pastebin.com/s31DwgSX
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
it will get slower to the end with that accumulate node if im not wrong
if it really adds 10% to the current location each time now
if anybody gets free just tell me the problem i will be here
it will actually never reach the target if i had infinite precision ๐
@icy mica your screenshot is hard to read
zoom in, resize the sidepanels so that its readable and post it again please
ok i will try to send it again
Iโm not at my PC right now, but your best bet would be -1 or -2 max
still can't read that without getting a headache
@icy mica go down to -2
Itโs annoying as hell to have to take multiple screenshots, but theyโll at least be readable
that would fit one screenshot if he resized the sidepanels for the screenshot
i personally prefer to have everything readble on one screenshot instead of multiple
@icy mica look at the top right
The zoom should be -2 at most, ideally -1 or 1:1 for smaller blueprints
Looks okay on my phone. I still have to zoom in a bit myself, but itโs readable
@spark steppe alright for you?
yea, that works for me
so whats the issue
you are not setting onWall to true
so it will never set your gravity to zero
thats perhaps one problem in that logic
spo i have to tick the box of on wall
What exactly is the wallrun goal?
you are holding space down?
because as soon as you release space it will stop the wallrun
also do yourself a favor and make either 2 customEvents or functions which you use to start/stop wallrun
that will solve a lot of that spaghetti nodes
and makes it easier for you to debug
Hi ! I'm trying to make a twin shooter game . But the template proposed by UE is not what i am looking for ..
I would like to have player rotation and movement handled by LEFT STICK (or ZQSD on keyboard) when the player is RUNNING. [Situation A]
Player movement is handled by the LEFT STICK (or ZQSD on keyboard) and the rotation by the RIGHT STICK (or mouse) when the player is AIMING (Press LT or right click on mouse). [Situation B]
For the movement i'm ok . But i don't know how to make the second part . Running with left stick and AIM/Turn the character in the direction of the mouse cursor or right stick . Anyone can help me ? ๐
@patent blade
Is there a node where you can do 2 int comparisons in BP? Such as, if int 1 == int 2 OR int 1 == int 3?
Or do I always have to double-up branch statements to do that in BP?
you could use a switch on int node maybe
or integer in range depending on what you try to archive
finished my very efficient, resident evil style puzzle Inventory prototype. I'd like to improve on the max search. It searches a few too many indices. ideas on how to get it to be more efficient ?
Ben: Thank you.
@flat raft break out of the for loop when you found a slot? but i dunno what it actually does
@austere knoll you can use the OR node with will result in 1 branch
@spark steppe it returns the index of an inventory grid. Like it will return if a 4x3 space is available.
yea then you can actually break out of the for loop, or just return the field index once you found a slot
so if it's a function return the slotIndex instead of printing it and you should be good
I don't know when to break. I mean, I don't know the condition to break.
there's is some math I'm missing for the maxSerach
why do you even continue searching if you found a slot?
do you want to get all slots?
it's one of there...
or just the first valid one
that doesn't sound efficient, except you want to visible highlight every valid slot
then it doesnt work as intended ๐
it works, just not as efficient as can be
like I could leave it like it is, and it's fine.
but I know there's just a tiny number I'm missing that can make it perfect ๐
I didnt take into account the grid height, so I guess I'm not done. ๐
Is your pic a character from that one 2d game?
I'm trying to place it lol
Cuphead
@patent blade The math for those is a little different. I assume you want it to follow the mouse if there's a mouse and just look in the direction of the right stick if it's a controller?
bool isSlotValid(int slotIndex, int itemWidth, int itemHeight){
int slotCount = inventoryWidth * inventoryHeight;
for(int currentIndex = slotIndex; currentIndex < slotCount; currentIndex++){
// return if we reached a point where no slot can be valid anymore
if(currentIndex / inventoryWidth + itemHeight > inventoryHeight || (currentIndex / inventoryWidth == (inventoryHeight - 1) && currentIndex / inventoryWidth + itemWidth > inventoryWidth))
return false;
// continue until theres enough slots at the right of the current slot (count could also be increased by the itemWidth to avoid running into this statement multiple times)
if(currentIndex % inventoryWidth + itemWidth > inventoryWidth)
continue;
// iterate over all slots and check if they are empty
bool slotValid = true;
for(int row = 0; row < itemHeight; row++){
for(int column = 0; column < itemWidth; column++){
if(!isSlotEmpty(currentIndex+(row*inventoryWidth + column)))){
continue 2;
}
}
}
if(slotValid)
return true;
}
return false;
}
@flat raft thats some pseudocode of how i would do it
Oh sweet! Thanks, I'll compare.
depends on the language you use, idk much about python, so the continue 2; statement might not work there
I'm using cpp, I just decided to prototype in py cus it's quick
ok, in cpp it works
Thanks Again, I'm out for the night
inventoryWidth and inventoryHeight might require to be a parameter if they aren't in scope of a inventory class or something
whatever, i wrote so much inventory code in my life that i should hate it actually ๐
Yeah, not a big fan of those myself.
you should tell more what doesn't work
no one knows where your node setup stops working
is the overlap event fired?
yes
are you holding space down before it fires?
what??
your setup requires that
you did copy that nodestuff from somewhere and you have no idea how its intended to work?
no i followed a tutorial
How do you know that the overlap is firing?
what is overlap
Overlap: extend over so as to cover partly. According to google.
I don't know what else to answer to that. You put the nodes there.
the event only fires once you run into the collision box of the actor that triggers the event
can you tell me on the screenshot or something because i just startes yesterday
and as your code relies on the fact that the spacebar has to be hold down, you have to hold it down before you run into said collision box
and keep it down as long as you want to wallrun
oh i will try that
either the tutorial you watched was for advanced users which means you should learn the basics, or you should watch the tutorial again, there are many ways to break that logic
You should put PrintString nodes throughout your white execution lines often when creating something. These will print in the top left when something happens, so that you know if the event is even working or not. In short, put a print string node right after EventBeginOverlap, and go run into a wall and see if it prints hello.
PrintString will teach you a lot and help you understand the flow of things, and the values of stuff at different times. Other people use the debugger tools as well, either way.
ok i have to output true only if 4 bools are false how would i do that
i was thinking logic gates
that works but how can i like wallrun without holding spacebar
@worldly edge NOR gate
nor only has 2 pins
you can add more
you can just use the nor thing and rightclick it to add more connectors
or wait... yea doesnt work on NOR
yeah im looking i dont see anything
Alternatively.
then use an OR gate for the 4 inputs, and put it in an NOT gate
ahh
Odd that they didn't do the NOr like that.
yeah
yea you can just use OR => NOT gate to inverse the result
lets hope this blueprint to check if two rectangles intersect works hahah
ill know what to check first if things dont work out
@worldly edge What data types are you using? What do you mean when you say rectangles?
isn't there something for basic AABB intersections in unreal?
i have a vector position of two rooms im trying to generate and i have to see if they intersect by comparing the point of origin x of R1 and the point of origin x + size of r2 i think if this comes back false then they arent intersections
and idk man im still getting used to blueprints
function intersect(a, b) {
return (a.minX <= b.maxX && a.maxX >= b.minX) &&
(a.minY <= b.maxY && a.maxY >= b.minY) &&
(a.minZ <= b.maxZ && a.maxZ >= b.minZ);
}
from https://developer.mozilla.org/en-US/docs/Games/Techniques/3D_collision_detection
thanks everyone for your help my wallrunning works now
@icy mica what was the issue?
That's strange. I know that FBox has a C++ function for that. I wonder why it's not exposed.
idk how id implement that code into my blueprints
im sure what i did works and if it doesnt its some dumb error
and it looks super messy
i dont know it just randomly stared working lmao
@worldly edge Just curious, what is the size you have? How are you measuring that? From the center point to the box extent, or width/Length?
i think its bottom right tcorner or thats how i did it ๐
realizing now tho origin would be in the center of a object
you shouldn't have to deal with the origin at all, only lowest corner and the highest opposite corner
what i thought
As long as those points are in world space. Most Unreal math tends to use a center point, and a box extent.
Center point in world space, and box extent towards the front upper right corner in relative space.
ok cool
are the rooms spawned or are you doing the check before you spawn them?
if they are in the level you could do a collision check within the engine
the rooms arent spawned when this check happens
for questions sake what nodes can spawn rooms or shapes without premade meshes like is there a node that can make a plane or cube just through blueprints
instead of static instantiated objects
is maybe one of the rooms spawned?
No
If you spawn anything, it has to be an actor to be in the world, or attached to an actor as a component. Otherwise you're relying on math and values.
nice thanks for all these knowledge nuggets
are you using cpp? then it would be easy with https://docs.unrealengine.com/en-US/API/Runtime/Core/Math/FBox/index.html
Lol. I just went to double check. FBox does have an overlap to check another FBox. How is that NOT in a library somewhere??
sadly they don't expose the necessary stuff to blueprints
@maiden wadi go make an addon and sell it for $100 on the marketplace :p
It's really not. Trust me.
I learned it in the last few months and my background came from blueprint and UI design LUA scripting.
yea, if you ever plan to get into cpp, something like this is good to get started
not too complex and it has some value in it if you can use it ๐
Lua? Where?
yo @maiden wadi Yesterday with your help i attached particle to my mesh, now im trying to destroy that component when the state is changed to normal from torch
@void snow can't you just disable the component?
@void snow You'll want to save that particle emitter to a local pointer and call destroy on it when your event fires to change to normal if the emitter is valid.
dude looks like dark souls
or disable
freaking great
yeah i want to destroy the particles, but i don't know how to get the reference of it
i tried promoting it to variable
didn't work
don't they have a lifetime?
no i guess they are spawning on each other when i put the torch out
or do they maybe have the option to rely on some other element to stay active?! never worked with particles in unreal, so im just throwing out ideas^^
Normally they do, but you wouldn't want it for something like a torch, you'd want to disable it so the torch doesn't just randomly die.
You can create one by right clicking the blue pin on the right side of where you're spawning it. It'll create an actor variable of the emitter type.
@void snow
Hi there, does any one know a cool way to get UDP into Unreal? working with 4.26 at the moment.
@sterile wraith Unsure. I don't know much beyond Unreal's default networking and replication that works on UDP. Might ask in the #multiplayer channel though.
ok, will do thx
Thanks for help it worked ๐ป
I have a wall i want to interact with the wall as a parts i want to divide the wall for example 6 parts and interact seperatly with these parts
Each part i can draw outline or paint it change the texture seperatly
Like House Flipper game they can interact with small parts from the walls and each face side seperatly
You're probably just wanting to make separate components in the same actor and make the wall an actor if you're trying to make it like that game.
Yes but do i need to divide the mesh and group them into one actor
Or can i make it with one solid mesh
just make a actor blueprint with a cube as mesh and some collision box and call it a day?!
then spawn multiple of them next to each other
Its not a cube for all
ok, idk the game, so maybe im missing deep knowledge
Construction Script runs only once when game started, right?
@dense mica runs on Editor once actor initiliazed
@spark steppe yes i have houses i want to interact with walls as squares so i can paint each square seperatly
Understood. I am having a weird problem, my arrays changing their value in runtime I get suspicios of construction script.
I only have one "set" for that array and not using it in any other place, only using gets
If you have any idea
I am hovering over the pins to show current values on breakpoint stop
SpearHead_C becomes AxeUpgradeC* with no reason
@dense mica Where is the array populated?
(sending CacheAttachments function in a sec)
Its the most messy blueprint I've ever worked so its also confusing. But trying to solve this for 6 hours and double-checked every little blueprint code to ensure I am not using that array anywhere else.
In short, the construction script gets ran once for every time an actor is spawned, this includes becoming irrelevant and then being respawned in when it is relevant. Also for every time it's moved or placed in the editor.
Understood. I am using another arrays there to update the avaiableUpgrades in editor time, but its not relevant as I understand
What does GetCurrentAttachment return?
I have local variables of these two in CacheAttachments, only reason I am doing this is ChildActorComponent is not caching stored values
And I am caching my valus in an array on BeginPlay
And when doing ForLoop for creating widgets, I am just using this arrays, because when I set new child actor class old values removing
On a side note, the Get node in your one function isn't necessary. You can use the array element from the foreach loop the same way. Still looking through the rest.
@dense mica Curious. Can you put a print after the...
AddNewObjectToScrollBox. Put a print after that and put the breakpoint on it instead of the AddNewObjectToScrollBox function?
See what the array of classes points to when it breaks on the print node instead.
Disclaimer: When I dont add elements to array its null
Not returning AxeUpgrade
When I add new one its being converted to AxeUpgrade(?)
Even with the multiple elements its returning a single element
But struct is returning correct values
Which is making me suspicious of this is being used somewhere else but I used "find" on every blueprint class and searched for AvaiableUpgradesx, its not being used as "set"
Disclaimer: When I dont add elements to array its null
oh wait, even when i dont add elements its returning AxeUpgrade now..
How do I apply image to text only?
@exotic geyser https://www.youtube.com/watch?v=La41irt3oYo
Just wondering.. Does blueprints ever do something wrong? For example compiler is broken, cached wrong values or processing wrong values..?
AxeUpgrade2_C also not being used on anywhere
@maiden wadi Ah ty forgot about this lol
@dense mica Never ran into that issue myself. Although I'm not a fan of the blueprint debugger. I hate it. I've tried using it a few times and it just feels cumbersome for testing. I have never once been led wrong with printstrings at the correct execution time.
Understood. Well, I am going to recode everything from stracth then. But one more question, do you have any alternatives for ChildActorComponent? I am storing multiple arrays and structs in my upgradements, that was why I used them but got disappointed with them really bad ๐
What problems did you have with that? I've heard it's a bit of a kludge but at least I haven't had any major issues
You can manually spawn actors and attach but that comes with its own pitfalls (such as the attached actor won't auto-destroy if the parent destroys)
Well I have multiple for loops and a tons of conditions checks to set upgradements for preview only, when I dont confirm I am reverting to the last confirmed class for upgradement etc. etc.
And when I switch between classes its not storing values
I need to cache values and set them back
Which is causing trouble at the moment (you can watch video on the upside)
System is working very good but carrying data from a class to another class and resetting conditions etc. was pain in the ass and now just because of they are not keeping editor values I am having issues ๐
Ah
I have a system kinda like that in my game where I spawn some accessories for NPC's
I have a struct for holding data on it - basically it contains info on what accessories should be spawned and a few other things that are adjusted on the NPC
these are pretty easy to copy around and modify
the NPC class then just looks at the data and spawns the right things
I am also doing the same but for preview-confirmed states I needed to use something dynamic
The problem is when it comes to ChildActorComponent my structs stays but the values I put in editor wont
Anyway I already solved that with caching values in beginplay and setting lastconfirmed class on widget, but today something weird happened thats ruined everything, prorably its something I cant see or an engine bug