123 Commits over 92 Days - 0.06cph!
Modify recast/detour deacceleration logic to prevent overshooting of agent target position
Add documentation for Acceleration property.
Bump default acceleration.
Bump nav agent ground trace distance
Improve default nav agent ground trace logic
Should improve ground detection behavior when passing under low height overhangs.
Should also fix issues with clipping, when the navmesh geometry diverges too much from the actual physics geometry.
Closes sbox-issues/issues/7432
Reduce JSON usage in GameObject.Clone (2) (#1787)
We no longer converts the complete GameObject to and from JSON for cloning.
JSON is only used as a last resort for complex properties we cannot clone directly.
GameObject clones are up to 4 times faster
Prefab clones are up to 2 times faster
Almost the same as #1781 but includes fixes for a few edge cases:
- Match old clone behavior and sort properties when cloning, turns out games can rely on that lol
- Match old clone behavior and enable gameobjects before clone process is completed, games could rely on that
- Fix edge case where the prefab lookup of clones of prefab instances would not point to the original prefab
- Fix edge case when cloning prefabs that contain a nested prefab instance which has a variable that references the outer prefabs root
Make agents follow gameobject position while in editor
Improve previous fix for NavAgent position glitching
Fix an issue where manually setting a NavMeshAgents position would result in race conditions at high framerates
For example, this manifested when using CreateBoneObjects on a SkinnedModelRenderer owned by the agent's GameObject.
Add test for cloning prefabs that contain a nested prefab instance which has a variable that references the outer prefabs root
Add clone tests to master
Revert "Catch null typedescriptor when cloning"
This reverts commit 04c9f070c908428fd86eea9cbe8355e15aa069c5.
Revert "Reduce JSON usage in GameObject.Clone (#1781)"
This reverts commit 3975bc70bb23755766f1767725aab376864a5260.
Catch null typedescriptor when cloning
Reduce JSON usage in GameObject.Clone (#1781)
We no longer converts the complete GameObject to and from JSON for cloning.
JSON is only used as a last resort for complex properties we cannot clone directly.
Should result in 1.5 to 3 times faster clones (depends on object size).
Expose Parallel.For by wrapping it in Sandbox.Utility
Explicitly serialize & deserialize null values (#1759)
Fix CI menu build for PRs
Analogue to 80a508a419578851e644fce2fa43da3debd48d9c
Add undo for changing parent or siblings via scene tree
Fixes sbox-issues/issues/7320
Add missing conversion formy-up to z-up for navmesh
Added to GetClosestPoint & GetRandomPoint
Forgot to make some enums internal whoops
Move navigation from C++ to C# (#1752)
Replace C++ version of detour & detour crowd with a C# version.
Managed version should behave exactly the same as the native version.
If not, please yell at me.
Achieved by using dotrecast as base
- Refactored the shit out of it
- Optimised it, so the managed performance comes close to the native version.
Navmesh generation (recast) is still in C++.
Add missing vectorization for some functions in Vector3 and Vector2
It was missing for Clamp, Min/Max, Lerp & Abs
Mark Rotation operator + and - as obsolete, they cause confusion and lead to invalid rotations
Closes sbox-issues/issues/7262
Fix behavior when deserializing fields with code defined initializer
Partially reverts: 3ce2d74fbd9effd2d280d1a59c9029f4b0a5c387
Added a bunch of tests
Fix undo for envmap probe bounds
Fixes sbox-issues/issues/7181
Use Span instead for Memory to pass Transforms to CommandList.DrawModelInstanced
Fix undo for convert to prefab (#1730)
We need to explicitly unset PrefabSource by calling BreakFromPrefab if __Prefab is not specified.
Explicitly set fields/props to null when deserializing (#1728)
Improve handling of RenderAttribute overrides/additions in Draw APIs (#1732)
* Improve handling of RenderAttribute overrides/additions in Draw APIs
Attributes passed to CommandList.DrawX and Graphics.DrawX now correctly merge with the "global" (CommandList.Attributes / Graphics.Attributes) attribute set.
Replaced existing usages of Attributes.MergeTo, the existing usage could lead to defaults overriding more specific values.
e.g. `Scene.RenderAttributes.MergeTo( camera.Attributes )` would potentially overwrite attributes in camera.Attributes with attributes from Scene.RenderAttribute we want it the other way around though.
Fixed DrawModelInstanced using blacklisted Memory type as parameter.
* Remove leftover comment
Fix Convert to/Break from prefab not updating Inspector (#1731)
Fixes sbox-issues/issues/6596
Revert "Fix undo for convert to prefab"
This reverts commit da0efcc866f95b30fb02a988989ca165da263779.
Fix LINQ Exception when different typed objects are selected for inspection
Fixes sbox-issues/issues/7106
Fix undo for convert to prefab
Fixes sbox-issues/issues/7009
This only converts the prefab back to an independent GO.
It does not undo the creation of the prefab asset and that's good, I don't think we should ever delete files via undo.
Fix undo when dropping a Material on to an object
Fix NRE in PrefabDropObject
Restore SceneTree expanded objects after hotreload
Fixes sbox-issues/issues/7146
Fix undo when dragging assets into the scene
Fixes sbox-issues/issues/6479
Pull latest changes from FP recastnavigation fork
Among upstream recast changes this also includes a change to:
Bump RC_SPAN_HEIGHT_BITS from 13 to 16
Increasing the bits used, will yield more accurate height information in the generated navmesh voxels & polys.
This does not change the size of rcSpan on x64 platforms. (See https://godbolt.org/z/4eKq45daK)
Therefore, this is free accuracy improvement without perf or memory impact.
Fix CameraEditorTool LookAt
Now keeps scene focus after look at button is clicked
also keeps the camera component selected after the look at target has been picked.
Avoid div by zero in Gizmo.Draw.LineCylinder
Disable Navmesh Warning "Could not build compact data" for now
Improve handling of empty navmesh tiles
Also improve editor auto update when world bounds change.
Navmesh only run heightfield generator cleanup in task
Navmesh generator cleanup is sub 10 microseconds, so not worth it to dispatch a task, since task dispatch overhead would be higher than actual compute.
Fix potential infinite loop in navmesh generation
Fix navmesh geometry collection physicsworld NRE
Fix NavmeshGeneration performance regression caused by 51c5e14
Navmesh generator cleanup now runs in parallel
Heightfield span pools are no longer freed after a completed generator run, instead they are returned to the freelist and reused.
Disposing of the generators now waits for all active generator tasks to terminate.
Fix physics triangulation occasionally overwriting the vertex buffer
Spheres & Capsules were always written at the beginning of the buffer
Fix NRE when scene was unloaded while navmesh generation was running
Fix hull navmesh area bounds using z up instead of y up.
Dynamic NavMesh Obstacles (#1706)
Allows to block of certain areas of the navmesh both in editor and at runtime.
For this we introduce and expose the concept of **navmesh areas**. Areas can affect navmesh generation and agent behavior/pathing.
### Details
- Accomplished by implementing a tile cache that stores an intermediate representation of the navmesh
- The intermediate representation can be used to modify & remove areas of the navmesh.
- Modifying the intermediate state is magnitudes cheaper than rebuilding the navmesh from scratch.
- Static areas are basically free.
- Moving areas are a bit more expensive, but you should be able to have at least a couple of dozens of them
- The area's shape is defined by a (trigger) collider that can be linked to a nav area component
https://files.facepunch.com/lolleko/1b2911b1/sbox-dev_JTOOu8AAeA.png
https://files.facepunch.com/lolleko/1b2911b1/sbox-dev_3XdDSxj7Ly.mp4
https://files.facepunch.com/lolleko/1b2511b1/sbox-dev_XBNEUDAPfh.mp4
https://files.facepunch.com/lolleko/1b2111b1/sbox-dev_CQAKEpUbQk.mp4
### Summary
Allows to create a navmesh area, link it to a (trigger) collider & set it to blocking to create an obstacle. In the future we can expand on area functionality: custom tags, local navmesh generation parameters...
Revert "Add recast/detour tile cache"
This reverts commit 0b2e398df82b304b23f7ddd2485b943ba1fe20ab.
We will use a custom caching solution instead.
Fix NRE in NavMesh Dispose