Gamebop / physics

Physics components for PlayCanvas
https://gamebop.github.io/docs/
3 stars 1 forks source link

Do not rely on entity._dirtyWorld #41

Closed LeXXik closed 5 months ago

LeXXik commented 5 months ago

_dirtyWorld flag can be cleared before we have time to report the transforms of a kinematic body. For example, this will not update the body, but only the visual mesh:

        this.entity.addComponent('body', {
            shape: SHAPE_BOX,
            motionType: MOTION_TYPE_KINEMATIC,
            objectLayer: OBJ_LAYER_NON_MOVNG,
            debugDraw: true
        });

        this.entity.setLocalPosition(0, 5, 0);
        this.entity.getRotation();

getRotation requires an up to date world transform, which clears the dirty flag once read. Need to find a more reliable approach.