Skip to content

Adapt BVH related code from RSX #213

Description

@snake-biscuits

Asked Amos in Northstar Discord about how they get physics models for generating R5R navmeshes

They pointed me to these sections of RSX:

src/game/rtech/assets/model.cpp:1933-1991

template <typename mstudiocollmodel_t, typename mstudiocollheader_t>
static bool ExportPhysicsModelBVH(const ModelAsset* const modelAsset, std::filesystem::path& exportPath)
{

src/game/rtech/assets/model.cpp:2144

case eModelExportSetting::MODEL_STL_RESPAWN_PHYSICS:
{
    // [amos]: the high detail bvh4 mesh seems encased in a mesh that is
    // more or less identical to the vphysics one. The polygon winding
    // order of the vphysics replica is however always inverted.
    if (modelAsset->version >= eMDLVersion::VERSION_12_1)
        return ExportPhysicsModelBVH<r5::mstudiocollmodel_v8_t, r5::mstudiocollheader_v12_t>(modelAsset, exportPath);
    else
        return ExportPhysicsModelBVH<r5::mstudiocollmodel_v8_t, r5::mstudiocollheader_v8_t>(modelAsset, exportPath);
}

they also gave me some notes on which lumps to pull vertex data
as well as positions being relative to MODELS origins
*coll trigger brush collision also came up

.rmdl uses the same BVH system as .bsps in r5
initially we thought this was how r2 physics work
since a respawn GDC talk on physics attributed the tech to r2

looks like some BVH node types are .bsp exclusive

better understanding of BVH would be massively beneficial to MRVN-Radiant

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions