Hi. Very new ti UE4 and especially BPs. I’m not new to coding but having trouble getting my head around simple things in BP form.
In this BP, I simply want to move a cube 10 times using a FOR LOOP. Each time it moves (99 is the size of one cube) I want it to place another BLANK FLOOR actor at it’s current position and rotation.
It works fine if I go in a straight line. However, I’ve tried to add some rotation to the floor object to make it turn and move in another direction, but it doesn’t work. The floor object IS rotated, I can see that at the end, in that it’s at a 45 degree angle to the floor objects it’s placed, however I was hoping it would move along that 45 degree angle once I’d set it.
What am I doing wrong, why is it just turning the floor object, but then not getting it’s new forward vector and moving along that?
Any help appreciated.
Here’s the BP.
Here’s the current outcome, the turned block is the block I was hoping to move in another direction.
Thanks for any help in advance.
I will come back later to try and give you proprer answer, but I don’t have the time now, sorry. So as I understand you want the next spawned floor to base its rotation on the last one? It is probably not happening because you are taking the ForwardVector of the orginal floor not the last spawned. The SpawnActorFromClass node returns a reference to the spawned Actor, use that in the loop when getting the rotation, location, not the original Actor reference (self).
I hope this helps you a bit, I will be able to provide screenshots later today if you want as I have projct that uses something similar.
No, it’s not that. I want the floor cube that’s moving along it’s forward vector to simply TURN 45 degrees and move in that direction. As you can see from the image, the cube is off by 45 degrees to the ones it places (I’m not really interested in the other placed blocks yet, just working on the main one). So simply, I have a cube that moves along it’s forward axis. When I turn it 45 degrees I want it to move along that axis, but it’s not, it’s simply just turning to face 45 and carries on moving in it’s original direction and NOT at 45 degrees off to where I originally placed it.
Hope this makes sense.
Thanks for helping.
I’ve tried it a different way, creating a TRANSFORM instead. This does exactly the same thing. Moves the FLOOR CUBE along the X forward axis 99 units and places a block at each position. However, it STILL won’t turn it’s actual direction. It will turn on it’s axis, meaning it’s facing 45 degrees off but still continues to move straight.
Just to clarify the problem, as it sounds more complicated than it is. In this image you can see the FLOOR CUBE (RED) it moves along it’s X axis as shown by the BLACK arrow. This is what it’s doing now. I get it to turn 45 degrees, but it continues along the BLACK arrow path. I want it to move along the RED arrow path once I turn it. It’s really easy to do in C#, but I can’t grasp it in BPs.
Here’s the new BP. Different method, same outcome,.
Upping this, as I’m having the very same issue…
Can anyone help?
Ii think you are working in world space and that what you want has to be done in local space. You are moving the red cube along the x-axis of the world and not of the cube.
Try working with “relative location”