Page MenuHome

BGE Fix T45207: Camera actuator shakes with low height
ClosedPublic

Authored by Sybren A. Stüvel (sybren) on Jul 2 2015, 4:58 PM.

Details

Summary

The camera-aiming code was using a near-zero-length cross product, which
caused oscillations. Thresholding on the cross product length seems to
fix this.

Diff Detail

Repository
rB Blender

Event Timeline

Sybren A. Stüvel (sybren) retitled this revision from to BGE Fix T45207: Camera actuator shakes with low height.
Sybren A. Stüvel (sybren) updated this object.

The general method here looks good for me.

Problem is, I don't really like to use artificial values like 0.01 as threshold... Couldn't we test for fuzzy 0 instead?

We can use Mt_fuzzyzero although I didn't check yet if MT_EPSILON is enough to reach stability (or we need a bigger number)

source/gameengine/Ketsji/KX_CameraActuator.cpp
297

As @Quentin Wenger (Matpi) says we can use:

if (cross > 0.0f && !MT_fuzzyzero(cross))
301

and here:

if (cross < 0.0f && !MT_fuzzyzero(cross))
Jorge Bernal (lordloki) edited edge metadata.

I check it using fuzzyzero but it seems to work much better using 0.01f. So LGTM for me.

This revision is now accepted and ready to land.Jul 5 2015, 1:38 PM

Thanks for checking. I would have liked to use such a constant (and checked FLT_EPSILON, but that also doesn't work), but this indeed works better. Thanks for accepting the patch, I'll commit soon.

This revision was automatically updated to reflect the committed changes.