I’m in the process of creating a puzzle demo in Unreal Engine 4.27. The puzzle involves lining up cubes so that they carry an electric energy from one point to another. Right now, metal cubes that touch a starting cube change gold when powered. But, when they are pushed away and are no longer touching that starting cube, they stay powered (as indicated by the material assigned as the “powered material”). So, how do I basically remove the “powered” and “found power” conditions, considering those two and “conducts” are Boolean variables? Here is a sample of part of the UE Blueprint.
I think your problem may be that once they have power, they’re on and that’s it?
Even if you move them away, they still have power.
What about only making the original cubes powered, and the others take power from there, but never become powered themselves. Then, when you move them away, they will power off.
BTW, doing this on tick is not a good idea. You only need to update each cube’s status when one of them is moved, not every frame!
That is a good question. The visible cubes are actually children to the Cube_BP’s parent. So, from a friend’s advice, I made child entities from the base settings. I did, however, think of throwing something more specific in after the parent function is carried out for the metal cubes that are supposed to conduct when touching a starting cube and lose power when not touching.
Regarding the tick, should I remove the nodes after that on the base BP? And yes, the cubes stay powered after touching. (Sorry, I forgot to add that part when I first answered.)
I thought I could use either BP or C++, though I’m not exactly a C++ expert. But doesn’t UE also use Python?
Actually, I have three types of cubes that appear in the level: a starting cube that is always powered and conducts and has energy; metal cubes which conduct but start with no energy; and rubber cubes, which block out energy entirely.
I guess I should remove everything after the tick in the source Cube_BP, then. I would like some elaboration with some examples, please, since I learn by example and by doing.
You see I have the cube, and the collision volume, and two variables. Power = this is a power cube, Rubber = this is a rubber cube.
You can drop them in the level, and check those variable accordingly.
The rubber cube and power cube don’t need any code, because they don’t care about anything else. In the ones that are intended to be metal ( power = no, rubber = no ), I have this:
I kind of get the idea. But, in my code, I currently have three Boolean variables: 1) Is Powered? which determines if a cube is carrying energy; 2) Conducts? which determines if a cube can carry energy when touching a powered cube; and 3) Found Power? which determines if a cube has found energy by touching a powered cube. Given this, would I have to add the Power and Rubber variables, or replace them with the Power and Rubber ones, especially considering that metal and starting cubes need to conduct energy?
If it can conduct defines if its metal or rubber (can conduct or not). Is power defines the state of the cube; true if is charged, false if its depleted. bIsPowered can only be true if bCanConduct is true.