How to Set a static mesh actor variable to blueprint generated static mesh

I have to set mine to world or it throws it off to a wierd position.

Could it be my array ?
Heres a pic.

I seem to think its something to do with the Event graph that im not getting right. as the construction script works fine in the viewport and when running if the event graph dosnt run

,

A couple of points here. As you have the Add SM Comp, set to manual attachment, the transform doesn’t matter. When you do a manual attachment (and note, I’m not against manual attachment at all, I do it all over the place in ). You will need to set a “location” (either via transform or a set location node) yourself, as well as you should also be attaching it. Perhaps you are already doing this in other code, that is not in the image. But that is the place to check, for what would be a “weird” location.

So long as the “local” location is equal to the “world” location, it really shouldn’t matter. I would suggest using local locations (as the Spline is going to use Local locations basically internally, that is the code’s preference), as it just cuts down overhead. It’s also a handy way of getting rid of extra thought processes, i.e. you will then have one world location, that of the root actor, everything else is going to be local, end of story.

I really can’t tell much from the pic, except for what I have noted.

.

The blueprint is actually displaying them all, it’s just that they are all being generated at the same location and being moved, the same “delta” distance, etc. i.e. they are all in synch

As I stated above in my last post, when you have the manual attachment checked in the Add Static Mesh node, the node is totally ignoring your Transform, it’s expecting you, to do the attach, and to set the location as well.

I would imagine, that if you disconnect, the event tick processing just as a test, and let the blueprint, generate the Static Meshs, they will all be in the same location. Unless you are setting them to be staggered, in some code, that is not shown.

I’m not talking about the Set World Location in the event graph. Because the way that is coded, so long as they are all starting at the same initial location, they will all be moved, each tick, the same distance.

.

Hay everyone, so i have found two methods that work, but they both seem to be compining them all into one mesh.

The first is the Itween plugin and the second is an example project that you can find [here][1].

The issue with it is that its taking all my generated steps and only displaying one and moving it, its not looping like it dose in the video and i copie and pasted the Blupprint code and still nothing.

Heres an image of what i have. for the Construction script
Top Half

Bottom Half

And heres the Event graph.

The last but to the end of the event.

I have no idea how to do it, but my lack of knowledge is not alowing me to get far at all.
Any assistance please.

,

Conceptually, you would want to set the location for each static mesh, there where you are creating them, as this is in the construction script, it’s done one time, and forgotten.

Shouldn’t the “tween” be moving them for you? Again, have never looked at it, it’s just that, if you are the one doing the moving, why bother with “tween”?

So long as you get them spaced the way you wish, during the construction, and your array holds all the static mesh components, then I can see no reason that you wouldn’t see all of them moving.

In terms of using tween or not, well, hmmmm, I wouldn’t, but that’s just me, because I know that the “tween” is invoking more code than needed, when all your wanting to do, is a simple “move” of the object on a Tick basis. It’s not like your “morphing” them ,etc.

Hope this makes sense.

.

Hey ,

Alright, so if i remove the tick event, and play then all is well and they display along the spline like they should. as you can see in the image below.

With regards to the Manual attachment checkbox, Should i be doing the set location at the start of the event ?

This is the only blueprint i have, so what you see is what i got lol.
Im still very torn between what to use so i am not sure what to use.
I like the Itween as its very compact and simple.

I tried this in the event begin play but with no luck, it still generates them all at the same place.

Hi there, Yes, its makes perfect sense.
I feel like im Just not getting it and i dont want to wast your time, but for that i am so grateful for you help and support.

Yes all i want to do is get the steps in their position which my construction script dose very well, then from there just move them along the spline continuously in a loop.
This should be a simle thing to do but i just cannot get it to work and i really do need this to work.

Any other suggestions ?
What is this lwSpline you speak of ? is it purchasable ?

yes is a product, and I am doing the final touches to it (particle systems, and moving crowds), before putting it up for sale, which will probably be in 5 to 7 days.

Ok, so the steps are in place, which is the first thing to get done, and it is. So, now to move the stairs, (One caveat, it’s been a long time, since I messed around with this in a blueprint, the reason is, has it’s own function library of blueprint nodes that I use, so I"m kind of digging up things from the past here, in terms of blueprints! Just working with you on this, has reminded me numerous times, of why I wrote the library! lol)

So what we really want, is to have a speed (float var), that we wish to move each step, a certain distance (in all 3 axis, as you have the Z, and the X will vary, Y will be locked, it’s really the Z your after, i.e. Vector = X, Y, Z axis). During each tick, so we shall say, the speed is J units per second. So we wish to take that delta time, from the event tick, and multiply the speed by the delta time. This tells us how much we should move, on this tick. In order to attain that speed.

Now that we know, the amount to move, we need to get the forward vector (which in truth is really going to be constant, as your spline, seems to really only have 1 slope that is visible.), if you have more then 1, that is visible, you want the look at rotation between the two spline points that you are moving the stair between… When we have this amount to move, scaled to the direction (i.e. rotation/vector, you can think of it either way, makes no difference. Internally rotations in UE4 are Quaternons, no biggie, it’s just X,Y, Z, and W). Then you just wish to apply, this distance, to the static mesh in question, which means, you want to use the Add Relative Location (in either world or local positioning), so that we are just adding that delta speed,and UE4 will then just adjust the actual location by what we add.

to be continued…

Continued…

Now, where does that leave us? more than likely with a lot of stairs, clumping up at the top, but that is actually fine, Why? because your creating more static meshes than you need too. In a real level (not your testing for the blueprint), no one is going to want to see the stairs, coming down the “backside”, which probably is not visable at all.

So, what do we want now…

  1. To create all the stairs that are visible, plus one.

The plus one, is so we have a stair, that we are using to cover a “hole” at the bottom of the escalator, when we start to shift. Hence, when a stair reaches the top, of the spline, we will change it’s location to be back to the bottom of the spline, and we rinse and repeat.

While this is a lot of verbiage, it’s honestly not all that bad. It’s one of those things, where, a picture is worth a 1000 words!

Hope this makes sense,

.

Ok, you have the speed,

Now you need to be processing each “stair” that you have, so your wanting to get the “direction” vector that your going to use, for each stair, where as you have it, taht your essentially getting it, one time, as the “speed” is never going to change,and your plugging that into the “distance” for getting the direction node.

You would be better off, just getting the direction one time as the slope is not changing along the spline (also your distance is hardly going to vary much, because more than likely the value your feeding is, is always less than 5, if you will), (it will/can if you put in more spline points, or start moving the spline points themselves). Then you could just multiply, the direction by the speed you have, and then plug in that value into the add relative location ( I would also change it from world to Local).

You really don’t have to regenerate anything, you just have to know, when a “stair” hits the top (i.e. the final control point) and is ready to be moved back to the bottom, you could yank it out of the end of the array, and insert at the start of the array. Hence there is no regeneration going on, keeping the number of objects being created/destroyed at zero, which is what you want.

.

Wow, Alrightys so this makes some sense to me.
So… Right.

That is a lot to take in.

So just create the spline to go to the top and then regenerate the steps at the bottom and vise versa for a down escalator.

Im not quite sure what you mean by the vectors. I know they will have to plug into the Delta location for the addRelativeLocation Node.

The Part about sending meshes back to the bottom ill have a look at shortly, i would like to get the movment correct first.

Heres an image of what i have so far. I know that the get Direction is wrong as it is taxing per tick, but i wanted to show you my thought process, as im not quite sure where to go from here.

Image.

Just an update, you probably can see this from my script, but the entire bluprint is moving with this one, and the stairs are staying in their fixed positions.

Im note quite following what you Mean here.
Are you saying that im getting it one time instead of per step ?
Appologies for the miss understanding.

I should leave the getDirection node it the construction script, so how do i do the same or similer here ? Maby i should use GetQuaternion at distance along spline Node ?

the slope of the spline, between point 0 and point 1, is not changing, hence the direction is not changing, you only need it once, and you can get it in the construction script. You won’t need a Quat, if you want a rotation, just get a rotation.

but you do need, to know when a stair, is at the top point (i.e. control point 1). So that you can start to remove it, and set to the start of the array (you could also keep an index into the array, but let’s not go there for now), which will keep cyclying the starts for you, so you don’t need to regenerate, etc.

.

if the spline/blueprint is what is moving, then check to see that only the Static meshes are in the array. This should be true, because of the “typing” that is going on.

You would take the speed, and then multiple, the directional vector by it (vector * float), then plug that into the add relative location.

So in essence it boils down to…

  1. entering the Event graph for the tick
  2. Calculating the speed
  3. multiply the directional vector by the speed
  4. using the for each loop to extract the Steps (SM components), and plug that into the add relative location, and plug the directional vector into the add relative location as well,

So your doing all the calculations outside of the loop, and just adding the new amount to move to each of the “steps”

.

The direcdtional vector is what we were talking about getting in the construction script.

Take the spline, drag off the pin, then hook that up to “Get forward Vector”
or you can do a Get Direction at Spline Point, and the point of interest would be Zero. Then set the output of course to a vector variable.

this variable, would then be multiplied by the "speed’, not literally by your speed variable, but by Speed x Delta time. Then set this output, to another variable, so that we are not altering the direction vector itself, then take that direction vector, adjusted by the speed for this frame, and plug that into the set Relative location.

That should do it.

.

P.S. The link to can be found, by just clicking on above.

I see what you mean.
Alright, i cannot get the steps to move indavidualy, all the steps are staying at their fixed position along the spline and only the spline its self seems to be moving forward.
Any ideas ?

So once i have the sped calculated what do i do with it, should i convert it some how so i can plug it into the delta location ForeachLoop Step ?
You can refer to the images above.

What do you mean by the directional vector ?
Because the (Vector * Float) has vaues, should i just punch a value in for the z ?

Also how do i make sure its the step, as the bluprint hasnt changed since we last chated about th earray section ?

Just to check that im correct here, here is a screen shot ?

If its right, then theres something wrong with my array, as the whole spline just flys off without the steps moving, they still staying at their fixed position.