Skip to content

Physics plugin execution scheme documentation does not match code #5783

Open
@brettle

Description

@brettle

The execution scheme document says that dSpaceCollide is called before webots_physics_step():

S3 --> S4["dSpaceCollide(space)</br>is invoked which eventually causes multiple callbacks to</br>webots_physics_collide()"]
S4 --> S5["webots_physics_step()</br>is called to allow the user to setup additional forces, etc."]

However in the code, it looks like webots_physics_step() is called before collisions. See:

if (mPhysicsPlugin)
mPhysicsPlugin->step();
WbRadio::runPlugin(timeStep);
if (log) {
log->stopMeasure(WbPerformanceLog::PRE_PHYSICS_STEP);
log->startMeasure(WbPerformanceLog::PHYSICS_STEP);
}
mCluster->step();

webots_physics_step() is called as a result of line 242 and collisions are done during the execution of line 249 (in particular, mCluster->step() calls dWorldStepAndSpaceCollide().

I've marked this as a documentation bug for now, but it's not clear if the current order in the code is intentional/desirable. In particular, the current order precludes a physics plugin from influencing the physics after all of the contact joints have been created.

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprove or fix the documentation (MD files only, no software development)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions