This repository has been archived by the owner on Oct 4, 2022. It is now read-only.
Bug fix for extra movement of vegetation instances #521
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue #, if available:
Description of changes:
This fixes a bug where moving a vegetation instance with the movement gizmo while in Vegetation Tool moves the instance much more than the gizmo moves, i.e. the gizmo position and the instance position do not correspond.
The cause is as follows:
AxisGizmo
is callingCEditTool::OnManipulatorDrag
with a change in position relative to the manipulator position when the manipulator was first started dragging, e.g.:(AxisGizmo.cpp:417) The actual method of computing this drag value differs based on the edit mode settings, but
vDragValue
is always relative to the position of the manipulator at drag start.Then
CVegetationTool::MoveSelected
takes that offset exactly as is and applies it to the current position of the vegetation instance:The result of this logic is, for example:
CVegetationTool::MoveSelected moves the instance to (500, 501, 32) (it’s current position) + (0, 2, 0) = (500, 503, 32) (NOT the position of the gizmo!)
Generally this results in moving the instance way too far compared to the gizmo position (indeed, the difference between actual and intended end positions is exponential).
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.