Zeroing out angular velocity not possible #41943

Closed
opened 2014-09-24 16:54:13 +02:00 by Raf Colson · 20 comments

System Information
Windows 7 64 bit, Nvidia GeForce GT540M Cuda

Blender Version
I suppose the bug's there from the beginning. (tested with 2.57 up to 2.71)

Short description of error
Angular velocity magnitude can't be set to zero.

Exact steps for others to reproduce the error
Zeroing out angular velocity of Dynamic object with angular velocity magnitude > 0 has no effect.

Angular_velocity_zero_bug.blend

**System Information** Windows 7 64 bit, Nvidia GeForce GT540M Cuda **Blender Version** I suppose the bug's there from the beginning. (tested with 2.57 up to 2.71) **Short description of error** Angular velocity magnitude can't be set to zero. **Exact steps for others to reproduce the error** Zeroing out angular velocity of Dynamic object with angular velocity magnitude > 0 has no effect. [Angular_velocity_zero_bug.blend](https://archive.blender.org/developer/F112067/Angular_velocity_zero_bug.blend)
Author

Changed status to: 'Open'

Changed status to: 'Open'
Author

Added subscriber: @raco

Added subscriber: @raco
Member

Added subscriber: @JorgeBernalMartinez

Added subscriber: @JorgeBernalMartinez
Member

Added subscriber: @Moguri

Added subscriber: @Moguri
Member

I confirm the bug.

I have just checked the code and it seems that any value under a certain threshold (SIMD_EPSILON*SIMD_EPSILON) is totally ignored.

I attach a fix using the same solution that it was used for SetLinearVelocity (That is to comment the check for angular velocity min threshold).

setAngularVelocity_fix.patch

I confirm the bug. I have just checked the code and it seems that any value under a certain threshold (SIMD_EPSILON*SIMD_EPSILON) is totally ignored. I attach a fix using the same solution that it was used for SetLinearVelocity (That is to comment the check for angular velocity min threshold). [setAngularVelocity_fix.patch](https://archive.blender.org/developer/F113261/setAngularVelocity_fix.patch)

Added subscriber: @andreymal

Added subscriber: @andreymal

Added subscriber: @NIV

Added subscriber: @NIV
Jorge Bernal self-assigned this 2015-02-17 09:31:03 +01:00

Added subscriber: @Anasastu

Added subscriber: @Anasastu

Added subscriber: @Lee

Added subscriber: @Lee

In #41943#259105, @JorgeBernalMartinez wrote:
I confirm the bug.

I have just checked the code and it seems that any value under a certain threshold (SIMD_EPSILON*SIMD_EPSILON) is totally ignored.

I attach a fix using the same solution that it was used for SetLinearVelocity (That is to comment the check for angular velocity min threshold).

I think the check exists to restrict the user from applying values that would be grossly impractical, like 1e-20. That said, if we want to keep the check, we could ask if the applied sum is zero;
float angvelsum = angvel.length2()
if (m_object && ( angvelsum == 0 || angvelsum > (SIMD_EPSILON*SIMD_EPSILON)))

I've got no idea how to submit patches, though.

> In #41943#259105, @JorgeBernalMartinez wrote: > I confirm the bug. > > I have just checked the code and it seems that any value under a certain threshold (SIMD_EPSILON*SIMD_EPSILON) is totally ignored. > > I attach a fix using the same solution that it was used for SetLinearVelocity (That is to comment the check for angular velocity min threshold). I think the check exists to restrict the user from applying values that would be grossly impractical, like 1e-20. That said, if we want to keep the check, we could ask if the applied sum is zero; float angvelsum = angvel.length2() if (m_object && ( angvelsum == 0 || angvelsum > (SIMD_EPSILON*SIMD_EPSILON))) I've got no idea how to submit patches, though.
Member

It could be a good solution. When i come back from my easter holidays i will make a test blend to check it.

It could be a good solution. When i come back from my easter holidays i will make a test blend to check it.

In #41943#298783, @Anasastu wrote:
I think the check exists to restrict the user from applying values that would be grossly impractical, like 1e-20. That said, if we want to keep the check, we could ask if the applied sum is zero;
float angvelsum = angvel.length2()
if (m_object && ( angvelsum == 0 || angvelsum > (SIMD_EPSILON*SIMD_EPSILON)))

I've got no idea how to submit patches, though.

Actually, I think it would be much more appropriate to print a message to console if the value is too low. If we assume that printf() can be used here and that I still understand C++:

float angvelsum = angvel.length2()
if (m_object && ( angvelsum == 0 || angvelsum > (SIMD_EPSILON*SIMD_EPSILON)))
  // go ahead and apply the change
else
  printf("Ignoring setAngularVelocity() command. Input value is too small in magnitude.");

This way, the user immediately knows what's up. If printf() can't be used, then we'd use whatever command prints out "Game Engine Started" and "Game Engine Finished".

> In #41943#298783, @Anasastu wrote: > I think the check exists to restrict the user from applying values that would be grossly impractical, like 1e-20. That said, if we want to keep the check, we could ask if the applied sum is zero; > float angvelsum = angvel.length2() > if (m_object && ( angvelsum == 0 || angvelsum > (SIMD_EPSILON*SIMD_EPSILON))) > > I've got no idea how to submit patches, though. Actually, I think it would be much more appropriate to print a message to console if the value is too low. If we assume that printf() can be used here and that I still understand C++: ``` float angvelsum = angvel.length2() if (m_object && ( angvelsum == 0 || angvelsum > (SIMD_EPSILON*SIMD_EPSILON))) // go ahead and apply the change else printf("Ignoring setAngularVelocity() command. Input value is too small in magnitude."); ``` This way, the user immediately knows what's up. If printf() can't be used, then we'd use whatever command prints out "Game Engine Started" and "Game Engine Finished".

Added subscriber: @qubodup

Added subscriber: @qubodup

Added subscriber: @dr.sybren

Added subscriber: @dr.sybren

Why would we care about someone using 1e-20? If someone wants to, let them go ahead. Unless someone can prove that it actually causes a problem, I would suggest simply removing the check on magnitude.

Why would we care about someone using 1e-20? If someone wants to, let them go ahead. Unless someone can prove that it actually causes a problem, I would suggest simply removing the check on magnitude.
Member

Hi Sybren,

I was proposing the same in D952. I'm doing a complex demo to check if magnitude check removal affects to instability. Maybe, next week I can finish it.

Hi Sybren, I was proposing the same in [D952](https://archive.blender.org/developer/D952). I'm doing a complex demo to check if magnitude check removal affects to instability. Maybe, next week I can finish it.
Member

Added subscriber: @brita

Added subscriber: @brita
Member

I had a chat about this in IRC, it seems to me that we do want it to be possible to set angular and linear velocity (and more things) to zero.
Simply removing the check could, has mentioned, bring up performance and stability problems.
As for stability, I would suggest add a check if the value that the magnitude is being set to is within epsilon, if so, set to 0 instead epsilon.
For performance, I can't tell just by looking at it :)
What kind of tests are you preparing @JorgeBernalMartinez ? Are they ready and could you share them in the test suite files?

I see this is already the solution in D952 .
As a side note, it is really good to see suggestions from new people and an active community around this.

I had a chat about this in IRC, it seems to me that we do want it to be possible to set angular and linear velocity (and more things) to zero. Simply removing the check could, has mentioned, bring up performance and stability problems. As for stability, I would suggest add a check if the value that the magnitude is being set to is within epsilon, if so, set to 0 instead epsilon. For performance, I can't tell just by looking at it :) What kind of tests are you preparing @JorgeBernalMartinez ? Are they ready and could you share them in the test suite files? I see this is already the solution in [D952](https://archive.blender.org/developer/D952) . As a side note, it is really good to see suggestions from new people and an active community around this.

This issue was referenced by 46ad220305

This issue was referenced by 46ad2203057fbe4418120ab6dc1cb830e3d53958

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
10 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#41943
No description provided.