Add offset from world origin rebasing to world-aligned materials?

Hello, in my game I periodically rebase the world origin, using this code:
image.png

I store the offset value by comparing the players location (which has become location of the new origin) to another actor that never moves.

Problem is that when origin shifts, any world-aligned materials also shift. So things like dynamic snow trails, and slope-based displacement shifts in a noticeable way.

I think that I need to get that offset value into the landscape material, and somehow add it into the Absolute World Position node here:
image.png

Can anybody say if I am understanding the problem correctly? And if so, how can I:

  • get data from a blueprint into a landscape material

  • add a 2d vector to the Absolute World Position, such that we negate the origin shift difference?

So?
Just add an MPC with the X/Y of the distance value to add to WPO.

You have all the elements you need to store that value.
Well, Ok you need to do some basic math to tally it up periodically, but surely that’s not a challenge?

I agree with MH that a Material Parameter Collection being updated every time you shift would work out. Assuming there’s no translation between values needed, simple negation should work just making sure you keep up with the changes.

In theory, there shouldnt be.
Wpo and the thuple for location should both use Unreal Units.

In practice, if at first it doesn’t work, start to devide by 10, then 100 and so forth before storing as MPC v3.
When you find the value that works, consider changing the division to a multiplication - though, this is on the CPU, I doubt it would make a lick of difference.

1 Like

Thanks guys - MPC looks like what I was searching for.