webaverse / app

Web metaverse client
https://app.webaverse.com
MIT License
338 stars 211 forks source link

Tilde grabbing: bug fixes #3714

Closed patriboz closed 1 year ago

patriboz commented 1 year ago

This PR fixes the following issues when editing scenes:

- Grabbed object transform out of sync object.updateMatrixWorld was called before the transform, which caused jitters.

- Collisions Querying only forward collision resulted in the object going into the ground when the distance from localPlayer to collision point was bigger than the grab offset. I added downCollision to prevent that. By raycasting from object perpendicularly down returns the collision point with the ground. object.position.y will then be clamped to be >= point.y.

- Pivot point Before, the grabbed object was moved around camera.position as pivot point. When 3rd person mode was entered, the object would move backwards with the camera. To prevent that I set the pivot point at localPlayer.position.

Videos Before: https://user-images.githubusercontent.com/49231818/190644219-ac9d3d79-9afb-4f5a-8b63-4cdb7ca29c0a.mp4

After: https://user-images.githubusercontent.com/49231818/190644313-43e0136b-d9ec-4176-ab56-8b49381b403e.mp4

lalalune commented 1 year ago

@patriboz please review https://github.com/webaverse/app/pull/3717