Handling set and then use variables?
I'm setting a variable on initiation (based on a switch case), but for some reason that doesn't seem to be registered first, and looks like when something doesn't go right, the instance either spawns at 0,0,0 position and doesn't move, or crashes the engine if it's really bad logic of sorts. And yes, I have the initiation done and THEN do the switch case, as needed, it's a Switch on String slot. I have it set up like this:
This obviously doesn't work, but I cannot have the two SET vectors both attached so that only one works depending on the switch condition I created earlier. But how should I then set this up here instead?
asked Dec 28 '18 at 09:48 PM in Blueprint Scripting
Actor will spawn wherever you gonna spawn it, if you didn't define it during the spawn it will be 0,0,0. BeginPlay runs always first before the Tick, so actor on first frame is in it's initial position that it's being placed before the Tick.
As Tuerer mention your tick also just gonna set same position over and over again and don't move, his circuit is right but only missing thing is multiplying Delta X by Delta seconds, without that moment will be frame dependent not time dependent.
Also actor it self dont have any positional data, it's location is defined by location of root component (in your case DefaultSceneRoot), so if root component is not movable it the entire actor wont be movable.
You can actually skip all that and just use Projectile Movement Component, component that will move actor for you depending on it's parameters, it a lot more performance friendly then ticking in blueprint as it will be done on C++ side and you dont need to mess blueprint with movement code
Also one node, instead of using String, you could use enum, also more optimal choose as it only one CPU instruction to check enum (which is integer in memory) state then process entire String.
Follow this question
Once you sign in you will be able to subscribe for any updates here