Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make VRMSpringBone.reset() work properly #169

Merged
merged 2 commits into from
Oct 1, 2019
Merged

Make VRMSpringBone.reset() work properly #169

merged 2 commits into from
Oct 1, 2019

Conversation

0b5vr
Copy link
Contributor

@0b5vr 0b5vr commented Sep 25, 2019

  • VRMSpringBone.reset() が正常に動作していなかったのを修正しました。

@0b5vr 0b5vr added the bug Something isn't working label Sep 25, 2019
@0b5vr 0b5vr self-assigned this Sep 25, 2019
@@ -179,16 +179,17 @@ export class VRMSpringBone {
* You might want to call [[VRMSpringBoneManager.reset]] instead.
*/
public reset(): void {
this.bone.matrix.copy(this._initialLocalMatrix);
this.bone.quaternion.copy(this._initialLocalRotation);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ソースコードによると、 matrixquaternionpositionscale から自動更新されるものなので、
あまり自前で操作することは想定されていないらしい。
applyMatrix() は存在するが、肝心の setMatrix() が存在しない……
我々が制御しているのが quaternion だけなので、ここは matrix の代わりに quaternion をセットし、
updateMatrix() を叩くこととしました。

https://github.com/mrdoob/three.js/blob/7e0a78beb9317e580d7fa4da9b5b12be051c6feb/src/core/Object3D.js#L553-L559

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

なるほど、背景わかりました。よさそうです!

@0b5vr 0b5vr requested a review from yomotsu September 25, 2019 09:20
Copy link
Contributor

@yomotsu yomotsu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@0b5vr 0b5vr merged commit 5eba07d into dev Oct 1, 2019
@0b5vr 0b5vr deleted the fix-springbone-reset branch October 1, 2019 04:58
@0b5vr 0b5vr added this to the v0.3.0 milestone Dec 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants