Fix #109108: Animated body collision geometry have unapplied scale for the first frame #115730
No reviewers
Labels
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
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#115730
Loading…
Reference in New Issue
No description provided.
Delete Branch "himisa/blender:fix_rigid_first_frame_bug"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem: See #109108
If an rigid body object has a scale that's not 1 , when physics simulation begins, the collision on the first frame will be calculated as if the object (collision geometry) is scaled back to 1, but subsequent frames will have correct scale.
Cause:
When simulation begins (or user is moving a rigid body by hand), the
physics_object
of the rigid body (i.e.btRigidBody
) will be removed and recreated by the functionrigidbody_validate_sim_object()
, which resets the scale of thephysics_object
to uniform. After that, another functionrigidbody_update_sim_ob()
will only update scale for all non kinematic (i.e. dynamic/active) objects. So all the kinematic (i.e. static/passive) rigid bodies will still have wrong uniform scale in the following simulation.The reason why the scale is correct from the second frame:
The scale of kinematic rigid bodies is updated by another function
rigidbody_create_substep_data()
called byBKE_rigidbody_do_simulation()
. However, this function is called before therigidbody_validate_sim_object()
call, so therigidbody_validate_sim_object()
will overwrite the scale set byrigidbody_create_substep_data()
in the first frame and cause bug. In the second frame,rigidbody_create_substep_data()
is called again and scales of kinematic rigid bodies is set correctly again. But this time the functionrigidbody_validate_sim_object()
will not be called. So the correct scale persists from the second frame and further on.Solution:
Every time the function
rigidbody_validate_sim_object()
is called andphysics_object
of the rigid body is removed and recreated, a flagrescale
is set to true. The functionrigidbody_update_sim_ob()
will take this flag and update the scale of rigid body to correct value no matter the rigid body is kinematic or not.Update:
When the rigid body is controlled by moving its parent,
rigidbody_validate_sim_object()
is not called. In this case, the scale of rigid body is reset to 1 byrigidbody_validate_sim_shape()
, andrescale
should also be set totrue
.Fix #109108: Animated body collision geometry have unapplied scale for the first frameto WIP: Fix #109108: Animated body collision geometry have unapplied scale for the first frameWIP: Fix #109108: Animated body collision geometry have unapplied scale for the first frameto Fix #109108: Animated body collision geometry have unapplied scale for the first frameCheckout
From your project repository, check out a new branch and test the changes.