I'm preparing a future post which is growing by the minute. I'll probably have to break it down a bit to keep it clear. Here's a bit I'll refer to in the (near) future.
I mentioned the World Position minus Object World position to make things local before, but I didn't explain it properly.
The WorldPosition gives you the world position value per pixel, whereas the ObjectWorldPosition gives you the world position of your object, just the value at which its center is.
When
you subtract the ObjectWorldPosition to the WorldPosition it means that
every pixel will have a fixed value wherever you place it in the map.
The value becomes relative to the center.
Imagine that this quad is in the world. We check the value of the same pixel at different arbitrary locations. WorldPosition - ObjectWorldPosition always returns the same value.
(Remember, if you're thinking of a formula don't just keep it abstract. Give it some numbers to verify that the result makes sense.)
This set up is useful if you want to be able to move your object around and you want
the material to stick to it, it is also good for you to ‘tame’ your
value.
Sometimes you can be testing a feature in your test map, but as you implement it in the game, some things will go crazy.
Depending on where you are in a map, the output of the WorldPosition could range from 1 to tens of thousands. Would you be to use the WorldPosition as,
say a multiplier, you can see where the troubles start.
No comments:
Post a Comment