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

请教Games103 hw1的一处代码 #1

Closed
cmusjtuliuyuan opened this issue Feb 6, 2022 · 3 comments
Closed

请教Games103 hw1的一处代码 #1

cmusjtuliuyuan opened this issue Feb 6, 2022 · 3 comments

Comments

@cmusjtuliuyuan
Copy link

https://github.com/Zydiii/Games103/blob/master/HW1/Assets/Rigid_Bunny.cs#L186
关于角速度的计算,我翻了github上其他人的计算方式,都是使用了w *= angular_decay的这种方式,并且在碰撞中不更新角动量L的值。这种方式看起来,角速度变成了一个守恒量。

我个人的理解是角动量是一个守恒量,而角速度不是。
每次应该使用w = I_inverse * L, 这样来求得新的w,再使用L *= angular_decay的方式更新,并且在碰撞中需要计算新的L。

@Zydiii
Copy link
Owner

Zydiii commented Feb 14, 2022

你好,使用 w *= angular_decay 其实主要是按照 lab 文档里说的公式直接进行了更新,因为除了重力没有其他外力,所以外力产生的力矩为 0。
按照老师给的算法角速度每个时间步长的更新值为 0,所以就省去了关于更新力矩和角速度的计算,角速度可以看作恒定,直接添加衰减系数模拟阻力效果。

@cmusjtuliuyuan
Copy link
Author

cmusjtuliuyuan commented Feb 15, 2022 via email

@Zydiii
Copy link
Owner

Zydiii commented Feb 15, 2022

我觉得主要是这个算法的原因吧,它没有用到角动量,更新角速度是用的 合外力矩 / 转动惯量 * dt 作为每个时间步长角速度的变化量,所以在这个场景下角速度的变化量为 0。

@Zydiii Zydiii closed this as completed Mar 26, 2022
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

No branches or pull requests

2 participants