Fix some general issues with Buoyant Objects (GerstnerWavesJobs.Registry Editor, physics-related)#11
Open
Zallist wants to merge 5 commits intoUnity-Technologies:mainfrom
Open
Fix some general issues with Buoyant Objects (GerstnerWavesJobs.Registry Editor, physics-related)#11Zallist wants to merge 5 commits intoUnity-Technologies:mainfrom
Zallist wants to merge 5 commits intoUnity-Technologies:mainfrom
Conversation
…ing the work. Also fixed up the Buoyant editor so it uses consistent foldouts and doesn't show unnecessary stuff in Editor.
Fixes an issue where the array sizes don't match after a hot reload.
… worked as expected if resolutions changed. Changed BuoyantObject to use a LateFixedUpdate to setup its next Gerstner jobs, since they're only needed for Physics based interactions. Also updated to explicitly reference IsPhysicsBased and IsVoxelBased for code sanity.
ccfoo242
reviewed
Jan 5, 2023
| public class BuoyantObjectEditor : Editor | ||
| { | ||
| private BuoyantObject obj; | ||
| private BuoyantObject Obj => serializedObject.targetObject as BuoyantObject; |
There was a problem hiding this comment.
Does performance matter in this script? There's some overhead added by using a property getter, plus I'm pretty sure it will do the cast each time this is accessed.
ccfoo242
reviewed
Jan 5, 2023
| var vec = t.position; | ||
| vec.y = Heights[0].y + waterLevelOffset; | ||
| t.position = vec; | ||
| var up = t.up; |
There was a problem hiding this comment.
I know you didn't write the original, but the assignment to up isn't needed. t.up will be evaluated first in the next line before overwriting it. t.up = Vector3.Slerp(t.up, _normals[0], dt)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes GerstnerWavesJobs.Registry to clear itself on CleanUp so changing Buoyant Object voxel resolution or buoyancy type doesn't require an Editor restart.
Fixed the following issues in the BuoyantObjectEditor:
Fixed the following issues in BuoyantObject:
Updateif doing a NonPhysical type of interactionFixedUpdateif doing a Physical type of interaction, which makes the buoyant objects significantly less choppy when the frame rate is different to the fixed time step.LateUpdatecall to a Coroutine-basedLateFixedUpdatewhich runs AFTER the physics cycle has ran, whereasFixedUpdateruns before the physics.Physics.SyncTransforms()while slicing into voxels since we're explicitly changing transforms to reset to 0, but need them synced to actually query moved colliders.