Page MenuHome

BGE: Fix for bug T41943 (zeroing out angular velocity is not posible)
ClosedPublic

Authored by Sybren A. Stüvel (sybren) on Dec 22 2014, 7:26 PM.

Details

Summary

I uploaded this little patch to differential for better reviewing.

The issue fixed by this patch was: Angular velocity magnitude can't be
set to zero.
I use the same solution that was also used to allow zeroing the linear
velocities.

Diff Detail

Repository
rB Blender

Event Timeline

Jorge Bernal (lordloki) retitled this revision from to BGE: Fix for bug T41943 (zeroing out angular velocity is not posible).
Jorge Bernal (lordloki) updated this object.

This looks like it could break some people's setups. I think, overall, it's worthwhile to be able to zero out angular velocity, but it would be good to get input from Dalai and/or Campbell.

Dalai/Campbell, any advice?

This was introduced way back (2006) in rB904a0792 by @Erwin Coumans (erwin) (Erwin, any chance you are still around?). I'm under the impression that we would run into instability issues with your patch, no?

I'm under the impression that we would run into instability issues with your patch, no?

I've reviewing other codes on the net using setAngularVelocity and I didn't find problems by setting the velocity to zero. Additionally in my tests I haven't seen instability or vibration issues when I stop the object.

Proposal:
to commit this change now (at BCon 1) and to check during all 2.75 development phase if it causes instability issues. If there is instability issues we can always revert it before 2.75 release

Do we have regression tests that cover this? I remember this pumpkin file that had issues before with angular velocity that I think was from the Game Kit book.

Sybren A. Stüvel (sybren) updated this revision to Diff 5107.

I commandeered this diff to upload my own patch for the issue; feel free to commandeer back.

My patch zeroes out tiny tiny velocities, and unifies the angular and linear velocity setters so that they use the same approach.
@Jorge Bernal (lordloki) can you do your tests with this version?

The patch looks good to me, with no danger of instability.
Of course old scripts can behave differently, as setting to zero would now work.
Any news from the tests and the pumpkin?

Jorge Bernal (lordloki) edited edge metadata.

This is the blend that I used to test

. I can not test now as I have no access to my computer until next week

I looked at pumpkim files but I didn't see any related to this.

This solution I think is better. LGTM

This revision is now accepted and ready to land.Oct 3 2015, 2:43 PM

@Jorge Bernal (lordloki) That test file doesn't apply to this patch. The motion actuator doesn't use the physics engine, and simply performs instantaneous translations. It never calls setLinearVelocity() on the physics object, and thus this patch still doesn't make the balls hang still in the air. That's a different problem than this patch tries to solve, so that's for another patch.

@Jorge Bernal (lordloki) That test file doesn't apply to this patch. The motion actuator doesn't use the physics engine, and simply performs instantaneous translations. It never calls setLinearVelocity() on the physics object, and thus this patch still doesn't make the balls hang still in the air. That's a different problem than this patch tries to solve, so that's for another patch.

I think it applies as I'm using "linear velocity" parameter. You are describing the behaviour of using "loc" parameter.

Ah yes, m_dloc is apparently "delta location" and not "derived location".

In the actuator, parent->setLinearVelocity() is never called for zero velocities, due to m_bitLocalFlag.ZeroLinearVelocity = true. I wrote a small hack for that to investigate the actuator's behaviour; I would recommend we keep this patch closed and move to that one: D1545