Skip to content

Conversation

@OregonJunco
Copy link

This PR changes ClampLocationToNavigableWorld so that vector components with values greater than the max world edges are clamped to just below the max values. For instance, the vector (150, 0, 0) is clamped to (99.9999, 0, 0) instead of (100, 0, 0) in a 100 centimeter world.

This was made in response to an engine crash I experienced after using ClampLocationToNavigableWorld to clean a location value before sending it into DoN. The engine crashed because VolumeAtId uses a float-to-int comparison in order to obtain a voxel address from a floating-point location, and the clamped value rounded to invalid index "100" in a 100-voxel world, whereas the valid indices ran from 0-99.

With this in mind it seems that locations exactly along the maximum edges of a DoN world are not safe, and thus it makes sense to me that ClampLocationToNavigableWorld should clamp away from them.

Thank you for all your hard work on this plugin!

OregonJunco and others added 2 commits January 14, 2019 17:39
…ixing a crash where locations that get clamped to a maximum world dimension would then round to an invalid index in VolumeIdAt (e.g. clamping 150 to 100, which then rounds to invalid index 100 instead of 99 in a 100-voxel world)
…w, as the rounding bug doesn't apply to that case. Fixed a capitalization error. Better comment.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant