I am having some trouble getting the correct 0 and 1 values in a vector. As an example, say I have a vector of 0,600,0 at the blue circle. At the red circle, it should give me 0,1,0. However, it is instead giving me the opposite 1,0,1. Does anyone have any insight as to why this is happening?
I am doing all of this extra zero checking and adding because if I dont, I always get 0,0,0 and assumed it was a divide by zero issue. Basically all I am really trying to do is find which vector changes between 2 location values to use as a multiplier for a location transform.
Just an extra note, I realize that there are necessary exec connections that are missing. This section has been bypassed so the rest will run correctly while I sort this out.
To the left of the blue circle, there is a Make Vector. That is where I am re-combining the values. X, Y, and Z are the break vector values and have been promoted to local variables. From there, it is connected to the divide where the red circle is. That is how it should be done, right?
I am expecting that the divide should give me (for the example I previously gave) 0/1,600/600,0/1 which should give 0,1,0 but instead I get 1,0,1.
Its also worth noting that if the 600 is in a different value in the vector, say 600,0,0, the 0 it gives me also moves, 0,1,1. It seems to be sort-of working, it’s just backwards from what I am expecting. A 1 should follow the 600’s place in the vector and the others should be 0.
I am dividing the vector by a modification of itself, that is intentional. 2 values of the vector will always be 0, the other value will always be non-zero. The goal is to turn the non-zero vector value into a 1 and leave the other 2 values as 0. This section is meant to determine which value in a different vector (not shown) should change.
As I stated in the original post, I am aware that the exec lines are not connected in that screenshot. This is also intentional at the moment. Those will be connected correctly when running and were connected when testing. At the moment (in the screenshot), they are disconnected in order to bypass this section while I find out why it is behaving the opposite of expected.
That would, thank you. However, I will need to address negative numbers. In my solution, I had made a change that the original vector will get divided by the absolute value of the modified vector to achieve this.
Seeing your solution, it seems that a better approach may be to create a completely different vector rather than trying to re-calculate the existing one. I will attempt this and see if I can get it to work.
Meanwhile, I would still like to know what has happened with the originally posted approach and why it is giving the opposite of what it should be. This way, I can avoid that obstacle in the future.
Its not Vector / Processed Vector, its just Processed Vector / Processed Vector. If you see what I mean. That’s why its difficult to debug without ordering
I still don’t fully understand why the original approach didn’t work. It seems like you are telling me that manipulating a vector with itself is the cause. My takeaway is that I should just avoid doing that in general.
In any case, your solution put me right on track to get what I needed. This is what I settled on and it works perfectly:
Manipulating vectors is definitely ok, and needed. Although I’m not quite sure where you’re going with this, and think there maybe an easier or more standard way of doing it. That was all.
I am making an in-game building system, loosely following a tutorial. That tutorial assumes that the components are more or less the same size. I needed to modify it so that the pieces could be any size (as long as they fit the “grid” of the build system). This section that I was having trouble with was to determine which direction the part was being snapped in, so that if the part was bigger than 1x1x1, in regard to the build grid, it would be moved the correct direction to accommodate the larger size.