-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Console errors when dragging Custom block to bottom with alt input #403
Comments
When the block is at the minimum density but not at minimum volume (ex. 3.5 or 4.5), the block will continuously sputter when dragged to the bottom of the pool with alt input. minDensity2.mp4 |
Also, when using the pointer, I can drag the block through the scale when it has the minimum density and volume values. blockThroughScale.mp4 |
Following the steps in #403 (comment) in Studio shows this: |
Maybe related to other work we were doing with the pivot/constraint logic in #367, but I thought we reverted that. |
This problem is easy to reproduce. Dragging the low density, small block to the bottom of the pool triggers this code which was added in #377 // If the mass is under the pool (likely because user forced it there), interrupt dragging and move it back up.
if ( !( mass instanceof Scale ) && mass.matrix.m12() < this.poolBounds.minY ) {
mass.teleportUp();
} which interrupts the dragging and removes the pointer constraint. So we have options like:
|
This is incredibly buggy, but only for a very low density, low volume block. Try dragging the block with the mouse, it can go through the ground easily. Likely p2 is having trouble. |
These numbers address the bugs for a variety of mass + volume combinations in buoyancy:basics explore: Subject: [PATCH] Node from the vbox needs to be set to invisible, https://github.com/phetsims/density-buoyancy-common/issues/415
---
Index: js/common/model/PhysicsEngine.ts
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/js/common/model/PhysicsEngine.ts b/js/common/model/PhysicsEngine.ts
--- a/js/common/model/PhysicsEngine.ts (revision c22a525940eb520b74ef717f986c16ae83ab1183)
+++ b/js/common/model/PhysicsEngine.ts (date 1727965539272)
@@ -379,10 +379,12 @@
body.wakeUp();
+ const maxForce = DensityBuoyancyCommonQueryParameters.p2PointerMassForce * body.mass + DensityBuoyancyCommonQueryParameters.p2PointerBaseForce;
+ console.log( DensityBuoyancyCommonQueryParameters.p2PointerMassForce, body.mass, DensityBuoyancyCommonQueryParameters.p2PointerBaseForce, maxForce );
const pointerConstraint = new p2.RevoluteConstraint( nullBody, body, {
localPivotA: globalPoint,
localPivotB: localPoint,
- maxForce: DensityBuoyancyCommonQueryParameters.p2PointerMassForce * body.mass + DensityBuoyancyCommonQueryParameters.p2PointerBaseForce
+ maxForce: maxForce
} );
this.pointerConstraintMap[ body.id ] = pointerConstraint;
this.world.addConstraint( pointerConstraint );
Index: js/common/DensityBuoyancyCommonQueryParameters.ts
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/js/common/DensityBuoyancyCommonQueryParameters.ts b/js/common/DensityBuoyancyCommonQueryParameters.ts
--- a/js/common/DensityBuoyancyCommonQueryParameters.ts (revision c22a525940eb520b74ef717f986c16ae83ab1183)
+++ b/js/common/DensityBuoyancyCommonQueryParameters.ts (date 1727965619016)
@@ -110,14 +110,14 @@
// An amount of force applied to all pointer-mass interactions (e.g. when you grab it with the mouse)
p2PointerBaseForce: {
type: 'number',
- defaultValue: 2500
+ defaultValue: 10
},
// Adds to the amount of force applied to all pointer-mass interactions (e.g. when you grab it with the mouse), but
// is this value TIMES the mass's mass value.
p2PointerMassForce: {
type: 'number',
- defaultValue: 0
+ defaultValue: 250
},
// Stiffness:
How can we ensure that we don't disrupt previously working functionality with a force change like this? |
Does the solution in #404 completely solve this bug? |
Taking a look |
I tested after fixing #404 by increasing the minimum density allowed for the custom block in B:B:Explore and can no longer reproduce. @Nancy-Salpepi let me know if you can though (in next RC). |
This is mostly fixed in rc.2. |
Sorry--I was only looking at the PhET brand sim earlier. |
@zepumph and I reproduced the sputtering in a few cases. We feel it is part of p2, and we are glad there is no TypeError on the console to go along with it. Since @Nancy-Salpepi did not report the TypeError, this issue seems safe to close. |
Test device
MacBook Air M1 chip
Operating System
14.6.1
Browser
Chrome
Problem description
For phetsims/qa#1141, in Buoyancy Basics on the Explore Screen, dragging a block at min density and min volume to the bottom of the pool causes an error which makes the block temporarily unmovable with alt input. Tabbing away and then back again fixes the problem.
Steps to reproduce
Visuals
minDensity.mp4
The text was updated successfully, but these errors were encountered: