Why doesnt this work?

Why doesn’t this work? I get to switch one time then it just gets stuck in one position

Maybe the value is not reseting, did u tried debugging the values you are getting from the enhanced input callback?

it could be because your using a replicated (server) value but setting the location locally.

but its irrelevant i wouldnt use this system. a simple bool could work, or an Enum would be better

You comparing relative location to world location. Unless actor that holds component is at [0,0,0] relative will almost always be different that world location.

Google for visual logger it has amazing tools to log and visualize vectors in actual 3d viewport. I wonder why nobody uses vis logger.

1 Like

probably because we never heard of it :sweat_smile: thanks

1 Like

Im comparing realtive location to raw numbers though? It didn’t get fixed when i broke the vector and compared them individually

Relative Location, means it is relative location inside blueprint.
World location means it is relative location against [0,0,0]

If you mix both of those and your blueprint actor is not at [0,0,0] whole comparing does not make any sense.

It is like you would ask: what is location of my friend on earth?
And then checked it against of your location inside house.
Are you both at x= 1 meter, y = 1 meter and z = 0 height? :smiley:

image


It says that its not at -1000, 0, 1000 even though it is and sends the script through the false branch

But getting the relative location and getting a value as a number and then checking it towards another number has nothing to do with world location?


Redid the system like this and now it works

1 Like

For future reference, to check iif two locations are same, do one location MINUS another, then calculate result as vector length, and if its smaller than some value you accept it as two locations are equal.

And for two vectors pointing in same direction: normalize them both and calculate dot product , which is cosine of angle between them. so dot product >= 0.95 is when they almost point in same direction.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.