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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is a red flag that the API needs to be revisited.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Mugen87 Is the current API acceptable to you?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at how the method is used, the current implementation does make sense.
I suspect you want that
SkinnedMesh.boneTransform()
initializes the target vector by itself based on the given vertex index. The problem is that just reading the position buffer attribute isn't enough. A vertex might already be transformed like inMesh.getVertexPosition()
. So the bone transformation is something that happens on top.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The transform can be applied to any vector. Right?
I'd feel better if the method was named
SkinnedMesh.applyBoneTransform( index, vector )
.Then it is obvious that the
vector
to be transformed must be initialized.Previously, we have used
target
to refer to an uninitialized parameter.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The method makes the assumption that
index
andtarget
are coupled. Sotarget
must represent a vertex of the geometry since the same vertex index is used to extract the respective skin indices and weights.The issue is that the vertex might already be transformed by morphed target or another vertex displacement technique.
I'm find with that. We probably want to use
vertex
instead ofvector
, see my previous comment.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not think that is true. Any point can be transformed. (The point doesn't even have to be near the respective vertex, although it typically is.)
In fact, that is what we allow.
I'll file a PR that changes the API to
SkinnedMesh.applyBoneTransform( index, vector );
-- if you agree.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good to me!