Fixed cylinder shape by considering shape config list to be empty.
The crash came from clearing shape config list when cylinder height is zero, but when the height is restored to zero it was expecting an element in the list.
The code to set the shape configuration was the same for many shape types, so it has been refactored to a helper function.
Fixes#4999
* Addressed feedback from PR 4874.
* Removed second copy of HeightfieldProviderBus.h from cmake file
* Changed CookedMeshShapeConfiguration and HeightfieldShapeConfiguration to have less messy implementations, instead opting for the slightly less messy const_cast inside of Utils.cpp and DebugDraw.cpp.
* Changed InitHeightfieldShapeConfiguraiton to CreateHeightfieldShapeConfiguration with a better API signature.
Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com>
* Fixed indentation
Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com>
* Terrain API fixups
Moved SurfaceData definitions in AzFramework out of terrain into separate files.
Added some missing API calls: Get*FromVector2, GetSurfacePoint*
Changed OrderedSurfaceTagWeightSet to SurfaceTagWeightList
Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com>
* PR feedback - remove IsClose check.
Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com>
* Fixed PhysX test compile failures by redcoding a bunch of "dummy terrain" implementation that's unused.
It was originally added for the PhysX Terrain component, but that component is long gone and has been superceded by the more generic PhysX Heightfield Collider.
Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com>
* Fixed up failing terrain unit tests.
Added API changes, and changed the assumption on where the surface weight sort is taking place. The component is no longer expected to provide the sorted list, it only needs to be sorted at the end coming out of the terrain system, so the unit tests have been modified to reflect that.
Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com>
* New Heightfield Components
Signed-off-by: John Jones-Steele <jjjoness@amazon.com>
* Misc PR fixes
* Fixed linux build failure from bad #include
* Renamed "Terrain Physics Collider" to "Terrain Physics Heightfield Collider" per physics team feedback
* Fixed 1/5 -> 1/4 typo in a comment
* Added missing member copies in HeightfieldShapeConfiguration
Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com>
* Addressed PR feedback
Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com>
* Changes from review
Signed-off-by: John Jones-Steele <jjjoness@amazon.com>
* Remove tabs accidently added
Signed-off-by: John Jones-Steele <jjjoness@amazon.com>
* Fixed overly complicated scaling math.
Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com>
* Added comments to make it more obvious what's happening on CreateEnd / DestroyBegin.
Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com>
* Moved Heightfield CreatePxGeometryFromConfig into its own function
Signed-off-by: John Jones-Steele <jjjoness@amazon.com>
Co-authored-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com>
Using triangle mesh with a kinematic rigid body is allowed, but the options "Compute COM", "Compute Mass" and "Compute Inertia" are not supported by PhysX and an error in logged that default values for COM, Mass and Inertia will be used. Now this situation is captured and an explanatory warning is used instead.
- Improved RigidBody::UpdateMassProperties function to apply the same logic in the treatment of shapes for all three parameters: COM, Mass and Inertia.
- Improved UpdateMassProperties function by using references for the override parameters instead of pointers.
- Improved function that computes the Center of Mass UpdateCenterOfMass (renamed from UpdateComputedCenterOfMass), to include the same shapes that the compute mass and inertia functions in physx updateMassAndInertia, which is to include all shapes if includeAllShapesInMassCalculation is true, else include only the shapes with eSIMULATION_SHAPE flag.
- Removed unused private function RigidBody::ComputeInertia.
- Added unit test to check when the warnings are fired correctly when COM, Mass or Inertia are asked to be computed on a rigid body with triangle mesh shapes.
- Improved MassComputeFixture tests by not only using Box shape, but also sphere and capture, plus improved the PossibleMassComputeFlags parameters to include all possible variations of the MassComputeFlags flags.
Fixes#3322Fixes#3979
Signed-off-by: moraaar <moraaar@amazon.com>
- Avoid saving blast global configuration unnecessarily every time the editor is opened.
- Fixed how to obtain the default physics material library. The relative path needs to be from the project folder, not the asset folder inside the project. It was also missing saving the physx configuration after a the default library is assigned to it.
- Fixed asset id for physics material asset 'assets/physics/surfacetypemateriallibrary.physmaterial'
Signed-off-by: moraaar moraaar@amazon.com
The benchmark code is still built, as it is part of the PhysX.Tests project.
Currently jenkins has a 1500sec(25min) timeout, the benchmarks can sometimes take over 1500sec and cause a build failure for timeout.
Jenkins currently doesn't upload the results of the benchmarks, so this is ok.
Signed-off-by: amzn-sean <75276488+amzn-sean@users.noreply.github.com>
* Fixed physx asset when exported as convex or primitives. Before it was limited to 1 material for the entire object, now it correctly uses multiple materials by looking at the first material per node.
Signed-off-by: moraaar <moraaar@amazon.com>
* Fix issues with seedlist for AutomatedTesting
Fixes error reporting so it will show the file hint in the tool.
Removes any missing assets from the .seed file.
Remove an unnecessary dependency from AutomatedTesting dependencies
file.
Signed-off-by: amzn-phist <52085794+amzn-phist@users.noreply.github.com>
* Make ArchiveComponent use AZ::IO::IArchive
Initial changes that will get the sychronous calls in ArchiveComponent
to use IArchive interface rather than external zip/7z tools.
Some of the asynchronous api are still in place, anything that wasn't
being used has been removed for now. This may change later if we move
towards all the api being asynchronous. Until then, we can't remove the
reliance upon the external archive tools completely.
Signed-off-by: amzn-phist <52085794+amzn-phist@users.noreply.github.com>
* Updates AZStd::thread constructors
Adds a variadic constructor which forwards args to the functor.
Because of our thread_desc extension, there was confusion on the
arugments, so the args were reordered to take the thread_desc first,
before the functor and args.
Also the thread_desc is taken as reference rather than by pointer.
Update callsites to account for this change.
Signed-off-by: amzn-phist <52085794+amzn-phist@users.noreply.github.com>
* Async operation of ArchiveComponent api
This sets up the ArchiveComponent to operate asynchronously. It uses
promise/future to transfer results to caller.
This is still broken, there's a few things that need to get fixed up,
but this is a good checkpoint for the work as it solidifies the api,
cleans up a bunch of unused code, and compiles.
Signed-off-by: amzn-phist <52085794+amzn-phist@users.noreply.github.com>
* Removes the platform-specific ArchiveComponen
These are no longer needed, as they control the direct interaction with
host OS tools like 7za.exe or /bin/zip.
Signed-off-by: amzn-phist <52085794+amzn-phist@users.noreply.github.com>
* Removes the platform-specific files from cmake
Signed-off-by: amzn-phist <52085794+amzn-phist@users.noreply.github.com>
* Removes the 7za.exe (and legal notice)
This tool is no longer needed in the repo.
Signed-off-by: amzn-phist <52085794+amzn-phist@users.noreply.github.com>
* Fixes usage of IArchive::GetFullPath()
This changed to return a PathView, updated to reflect that.
Signed-off-by: amzn-phist <52085794+amzn-phist@users.noreply.github.com>
* Fix promises and threads
Make sure promises are only set exactly once. This meant reworking some
of the initial error checking.
Detach threads when created. Adds [[nodiscard]] to the functions that
return a future. Since threads are detached, the future is the main way
to get communication from the thread.
Clean up interface, add comments.
Signed-off-by: amzn-phist <52085794+amzn-phist@users.noreply.github.com>
* More edits to thread creation
Changes to thread construction to account for parameter change.
Signed-off-by: amzn-phist <52085794+amzn-phist@users.noreply.github.com>
* Fix some remaining issues with ArchiveComponent
Put created threads inside a container, then join them at Deactivate.
Fix asset bundler case when injecting a file with no working directory.
Fix thread constructor that applies args to a function.
Fix lambdas to take string args by value rather than reference.
Signed-off-by: amzn-phist <52085794+amzn-phist@users.noreply.github.com>
* Fixes some remaining bugs in ArchiveComponent
Open archive as read-only during extract & list operations.
Fixes paths issues.
Signed-off-by: amzn-phist <52085794+amzn-phist@users.noreply.github.com>
* Fix initialize of opaque thread handle in thread_UnixLike.h
Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>
* Removed unused variable in AssetBundleComponent.cpp to fix compiler warning
Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>
* Fix some issues with archives
File paths in the CDR and the local headers need to match, but there
were issues with path separators and case that made it possible to get
invalid headers errors in some archives.
Signed-off-by: amzn-phist <52085794+amzn-phist@users.noreply.github.com>
* Adds some new ArchiveComponent unit tests
Adds new tests for extraction of archive and adding files from a file
list to an archive.
Signed-off-by: amzn-phist <52085794+amzn-phist@users.noreply.github.com>
* Fix file data offset issues when opening archives
When opening an INestedArchive it would run through the CDR headers to
create file entries in the zip cache. The offsets to the compressed
data were being calculated incorrectly because they were using the CDR
headers rather than jumping to the local file headers and getting
offsets from those sizes.
Removed and refactored some archive validation flow and zip cache
factory init methods to either init default or init w/ additional
validation checks.
Signed-off-by: amzn-phist <52085794+amzn-phist@users.noreply.github.com>
* Addresses PR feedback
Signed-off-by: amzn-phist <52085794+amzn-phist@users.noreply.github.com>
* Address more points of feedback in PR
Signed-off-by: amzn-phist <52085794+amzn-phist@users.noreply.github.com>
* Address additional PR feedback
Fixes up some error checks and uses of strings vs paths.
Enable archive component tests on Linux so we can see if they will
pass.
Signed-off-by: amzn-phist <52085794+amzn-phist@users.noreply.github.com>
* Address PR feedback
Change the INestedArchive interface to list files as AZ::IO::Path.
Signed-off-by: amzn-phist <52085794+amzn-phist@users.noreply.github.com>
* Disabling the ArchiveComponent tests on Linux
They failed so we will revisit them to attempt a fix.
Signed-off-by: amzn-phist <52085794+amzn-phist@users.noreply.github.com>
* Rename a member variable to be more accurate
Signed-off-by: amzn-phist <52085794+amzn-phist@users.noreply.github.com>
* Address feedback on PR
Bump version of Archive Components for serialize context.
Improve error messages during archive open and validation.
Signed-off-by: amzn-phist <52085794+amzn-phist@users.noreply.github.com>
* Revert recent changes
Signed-off-by: amzn-phist <52085794+amzn-phist@users.noreply.github.com>
Co-authored-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>
These are immediate dependencies, and include many circular dependencies, largely amongst the Atom gems, as indicated by cmake
Signed-off-by: AMZN-alexpete <26804013+AMZN-alexpete@users.noreply.github.com>
* Restores the branch to the old status from old branch
Signed-off-by: aaguilea <aaguilea@amazon.com>
* Changes that didnt make it from merge manually fixed
Signed-off-by: aaguilea <aaguilea@amazon.com>
* forgot one
Signed-off-by: aaguilea <aaguilea@amazon.com>
* Added Ebus in order to remove rigidbody's dependencies
Signed-off-by: aaguilea <aaguilea@amazon.com>
* answering some of the comments in the PR
Signed-off-by: aaguilea <aaguilea@amazon.com>
* Small typo changed
Signed-off-by: aaguilea <aaguilea@amazon.com>
* Remove the "TEST_SUPPORTED" traits.
Terrain unit tests should be usable on all platforms, so they shouldn't need a platform-specific trait to enable/disable.
Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com>
* Fix a few misc terrain bugs.
* Change Activate/Deactivate to happen immediately instead of deferring. There were too many order-of-operation bugs caused by trying to defer this.
* Added implementation for calculating normals.
* Fixed bug where GetHeightSynchronous wasn't stopping at the highest-priority layer.
* Added locks for SurfaceData bus to help ensure we lock our mutexes in the correct order and avoid deadlocks.
Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com>
* Add trivial TerrainSystem tests.
Tests construction, Activate(), Deactivate(), and destruction.
Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com>
* Unified Terrain system calls on single bus.
Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com>
* Added mock for TerrainDataNotificationBus listener.
Also added unit tests to verify the listener, and added in missing notification events.
Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com>
* Removed extra Sampler class.
Fixed up APIs to correctly pass Sampler and terrainExistsPtr around.
Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com>
* Switched MockTerrainSystem to be proper gmock.
This makes it for flexible to use and easier to reuse from other test environments.
Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com>
* Fix settings bug caused by bad order of operations that occurred when the methods moved to a different bus.
Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com>
* Eliminate extra EBus by simplifying area initialization.
Previously, there was a back-and-forth ebus signal used for the terrain system to find any terrain spawners that were created prior to the terrain system activation. Now it uses the more simple technique of just grabbing all the spawners that are currently hooked up to the spawner ebus.
Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com>
* Switch to NiceMock so that "uninteresting" mock calls get ignored.
Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com>
* Addressed PR feedback.
Filled in terrainExistsPtr at the end, and added it to GetNormal as well.
Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com>
* Fixed shader height calculation.
It was off by half a pixel, and it was interpolating, both of which were wrong.
Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com>
* remove redundant API calls from EditorViewportWidget and use new WorldToScreen call
Signed-off-by: hultonha <hultonha@amazon.co.uk>
* remove additional pre/post widget render calls that are no longer required
Signed-off-by: hultonha <hultonha@amazon.co.uk>
* Miscellaneous fixes and PAL changes required for restricted platforms.
Signed-off-by: bosnichd <bosnichd@amazon.com>
* Rename O3DE::ProjectManager::ProjectUtils::ReplaceFile -> ReplaceProjectFile to prevent conflict with Windows ReplaceFile #define
Signed-off-by: bosnichd <bosnichd@amazon.com>
* Legacy cleanup - part 3
Not much is left that can be easily removed,
so I think this will be last cleanup before the legacy functionality is replaced.
Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com>
* fix windows build, remove a few more things, re-add one file
Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com>
* Remove legacy RenderBus + more cleanups
Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com>
* Remove MaterialOwnerBus.h
Clean-up in Cry_Matrix34/33
Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com>
* Release build fix for Windows
* Release build fix for Android
* Release build fix for Windows
* Release build fix for Android
* Release build fix for Linux
* Release build fix for Mac
* Release build fix for iOS
Signed-off-by: Steve Pham <spham@amazon.com>
NOTE: The memory driller is still intact for now to avoid needing to
modify allocators, but the frame/cpu portions of driller and the
standalone executable are now gone.
Signed-off-by: Jeremy Ong <jcong@amazon.com>