fixed AABBs calculated from the graph system being wrong because for whatever reason i was transforming the bounds to world space, and this never mattered when using RP3D because it was always fed local extents......

This commit is contained in:
ecker 2025-09-05 21:25:59 -05:00
parent cb36936411
commit 36612f9ce9
4 changed files with 9 additions and 8 deletions

View File

@ -6,6 +6,7 @@
"metadata": { "metadata": {
"holdable": true, "holdable": true,
"physics": { "physics": {
"mass": 0,
"type": "bounding box" "type": "bounding box"
} }
} }

View File

@ -1,9 +1,9 @@
{ {
// "import": "./rp_downtown_v2.json" // "import": "./rp_downtown_v2.json"
"import": "./ss2_medsci1.json" // "import": "./ss2_medsci1.json"
// "import": "./test_grid.json" // "import": "./test_grid.json"
// "import": "./sh2_mcdonalds.json" // "import": "./sh2_mcdonalds.json"
// "import": "./animal_crossing.json" // "import": "./animal_crossing.json"
// "import": "./mds_mcdonalds.json" "import": "./mds_mcdonalds.json"
// "import": "./gm_construct.json" // "import": "./gm_construct.json"
} }

View File

@ -1333,7 +1333,7 @@ void uf::graph::process( pod::Graph& graph, int32_t index, uf::Object& parent )
auto& mesh = storage.meshes.map[graph.meshes[node.mesh]]; auto& mesh = storage.meshes.map[graph.meshes[node.mesh]];
auto& primitives = storage.primitives.map[graph.primitives[node.mesh]]; auto& primitives = storage.primitives.map[graph.primitives[node.mesh]];
pod::Instance::Bounds bounds; pod::Instance::Bounds bounds = {};
// setup instances // setup instances
for ( auto i = 0; i < primitives.size(); ++i ) { for ( auto i = 0; i < primitives.size(); ++i ) {
auto& primitive = primitives[i]; auto& primitive = primitives[i];
@ -1373,8 +1373,8 @@ void uf::graph::process( pod::Graph& graph, int32_t index, uf::Object& parent )
uf::stl::string type = phyziks["type"].as<uf::stl::string>(); uf::stl::string type = phyziks["type"].as<uf::stl::string>();
if ( type != "mesh" ) { if ( type != "mesh" ) {
auto min = uf::matrix::multiply<float>( model, bounds.min, 1.0f ); auto min = bounds.min; // uf::matrix::multiply<float>( model, bounds.min, 1.0f );
auto max = uf::matrix::multiply<float>( model, bounds.max, 1.0f ); auto max = bounds.max; // uf::matrix::multiply<float>( model, bounds.max, 1.0f );
pod::Vector3f center = (max + min) * 0.5f; pod::Vector3f center = (max + min) * 0.5f;
pod::Vector3f corner = uf::vector::abs(max - min) * 0.5f; pod::Vector3f corner = uf::vector::abs(max - min) * 0.5f;
@ -1614,7 +1614,7 @@ void uf::graph::reload( pod::Graph& graph, pod::Node& node ) {
ext::json::Value tag = ext::json::find( node.name, graphMetadataJson["tags"] ); ext::json::Value tag = ext::json::find( node.name, graphMetadataJson["tags"] );
pod::Vector3f controllerPosition; pod::Vector3f controllerPosition = {};
auto& controller = scene.getController(); auto& controller = scene.getController();
if ( controller.getName() != "Scene" ) { if ( controller.getName() != "Scene" ) {
auto& controllerTransform = controller.getComponent<pod::Transform<>>(); auto& controllerTransform = controller.getComponent<pod::Transform<>>();

View File

@ -39,7 +39,7 @@ namespace {
.displacementThreshold = 0.25f, .displacementThreshold = 0.25f,
.overlapThreshold = 2.0f, .overlapThreshold = 2.0f,
.dirtyRatioThreshold = 0.3f, .dirtyRatioThreshold = 0.3f,
.maxFramesBeforeRebuild = 600, .maxFramesBeforeRebuild = 60,
}; };
} }
@ -113,7 +113,7 @@ void uf::physics::impl::terminate( pod::World& world ) {
// Implementation // Implementation
void uf::physics::impl::substep( pod::World& world, float dt, int32_t substeps ) { void uf::physics::impl::substep( pod::World& world, float dt, int32_t substeps ) {
float h = dt / substeps; float h = dt / substeps;
for ( auto i=0; i < substeps; ++i) { for ( auto i = 0; i < substeps; ++i ) {
uf::physics::impl::step( world, h ); uf::physics::impl::step( world, h );
} }
} }