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

knot場景的球滾起來卡卡的,像在玩彈珠台 #37

Open
xwc2021 opened this issue Feb 19, 2022 · 9 comments
Open

knot場景的球滾起來卡卡的,像在玩彈珠台 #37

xwc2021 opened this issue Feb 19, 2022 · 9 comments

Comments

@xwc2021
Copy link
Owner

xwc2021 commented Feb 19, 2022

原因是只取最近頂點的法向量(紫色)當作gravityDir
往邊邊移動時像撞到東西
其實是因為球如同在上坡
如同上坡

甜甜圈場景則是
先找出球Transform.podition到甜甜圈的最近點P,再用(P-Transform.podition)算出gravityDir(橘色)
滾起來相對流暢絲滑
donuts

@xwc2021
Copy link
Owner Author

xwc2021 commented Feb 19, 2022

可以用很多空心義大利麵來組成knot嗎?
因為空心義大利麵其實就是
只取某段區間的甜甜圈

@xwc2021
Copy link
Owner Author

xwc2021 commented Feb 20, 2022

@xwc2021
Copy link
Owner Author

xwc2021 commented Feb 20, 2022

取最近頂點的法向量會卡
那用碰撞的contactNormal呢?

物理引擎給的contactNormal
看起來不是三角形3頂點插值出來的結果

那就自行用contactPosition,求出三角形的重心座標,再用重心座標來插值Normal怎樣?
https://www.geogebra.org/m/wuwrqrxz

@xwc2021 xwc2021 changed the title knot場景的球滾的不順 knot場景的球滾起來卡卡的,像在玩彈珠台 Feb 20, 2022
@xwc2021
Copy link
Owner Author

xwc2021 commented Feb 21, 2022

可就算contactNormal不是插值的結果
也不至於會出現上坡的情況阿?

總覺得是在頂點處撞到什麼東西呢 🤔
檢查一下Physics設定
layer_setting

取消「BorderNoAvoid」和「GravitySensor」(上圖位在knot頂點處的灰色小球)的碰撞後
不管是「取最近頂點法向量」還是「contactNormal」當gravityDir都沒問題了
前面的推理煞有其事是怎樣... 歸剛欸😝

@xwc2021 xwc2021 closed this as completed Feb 21, 2022
@xwc2021
Copy link
Owner Author

xwc2021 commented Feb 21, 2022

但是用重心座標來插值Normal當gravityDir
應該可以讓Camera的跟隨在knot上更加順暢

@xwc2021
Copy link
Owner Author

xwc2021 commented Feb 21, 2022

最近頂點(紫色)周圍的鄰接三角形
頂點的鄰接三角形資訊

@xwc2021
Copy link
Owner Author

xwc2021 commented Feb 22, 2022

交界處可能有多個GravitySensor
所以要進行合體的動作
交界處

xwc2021 pushed a commit that referenced this issue Feb 22, 2022
@xwc2021
Copy link
Owner Author

xwc2021 commented Feb 22, 2022

差異是不是很大?
影片

@xwc2021
Copy link
Owner Author

xwc2021 commented Feb 22, 2022

地本身不平怎辦?
影片

移動時不要把trasform.up和地面法向量對齊
會有明顯的改善

當從一塊四邊形移動到另一塊時
因為contactNormal和Gravity的方向沒對齊
還是會產生加速的感覺(沿著斜坡很下滑)

@xwc2021 xwc2021 reopened this Feb 23, 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

1 participant