diff options
author | brynnchernosky <56202540+brynnchernosky@users.noreply.github.com> | 2023-05-04 00:24:43 -0400 |
---|---|---|
committer | brynnchernosky <56202540+brynnchernosky@users.noreply.github.com> | 2023-05-04 00:24:43 -0400 |
commit | d46f6bd5e4d0c3ad7d483de85538f86965f635b7 (patch) | |
tree | fc1b1ee9e27cbbd8f1275cc35dce763acbccfc28 /src | |
parent | b904681b9b417220e5e350f935b70a98f15ba41c (diff) |
start debugging pulley
Diffstat (limited to 'src')
-rw-r--r-- | src/client/views/nodes/PhysicsBox/PhysicsSimulationInputField.tsx | 6 | ||||
-rw-r--r-- | src/client/views/nodes/PhysicsBox/PhysicsSimulationWeight.tsx | 15 |
2 files changed, 10 insertions, 11 deletions
diff --git a/src/client/views/nodes/PhysicsBox/PhysicsSimulationInputField.tsx b/src/client/views/nodes/PhysicsBox/PhysicsSimulationInputField.tsx index cd55453ea..85c20760e 100644 --- a/src/client/views/nodes/PhysicsBox/PhysicsSimulationInputField.tsx +++ b/src/client/views/nodes/PhysicsBox/PhysicsSimulationInputField.tsx @@ -41,15 +41,13 @@ export default class InputField extends React.Component<IInputProps, IState> { } } - epsilon: number = 0; - componentDidMount() { - this.epsilon = 0.01; - } + epsilon: number = 0.01; componentDidUpdate(prevProps: Readonly<IInputProps>, prevState: Readonly<IState>, snapshot?: any): void { if (prevProps.value != this.props.value) { if (this.props.mode == "Freeform") { if (Math.abs(this.state.tempValue - Number(this.props.value)) > 1) { + console.log('update temp value') this.setState({tempValue: Number(this.props.value)}) } } diff --git a/src/client/views/nodes/PhysicsBox/PhysicsSimulationWeight.tsx b/src/client/views/nodes/PhysicsBox/PhysicsSimulationWeight.tsx index 7407d6fa6..785e40057 100644 --- a/src/client/views/nodes/PhysicsBox/PhysicsSimulationWeight.tsx +++ b/src/client/views/nodes/PhysicsBox/PhysicsSimulationWeight.tsx @@ -95,12 +95,12 @@ export default class Weight extends React.Component<IWeightProps, IState> { kineticFriction: false, maxPosYConservation: 0, timer: 0, - updatedStartPosX: this.props.dataDoc['startPosX'] ?? 0, - updatedStartPosY: this.props.dataDoc['startPosY'] ?? 0, + updatedStartPosX: this.props.startPosX ?? 0, + updatedStartPosY: this.props.startPosY ?? 0, walls: [], - xPosition: this.props.dataDoc['startPosX'] ?? 0, + xPosition: this.props.startPosX ?? 0, xVelocity: this.props.startVelX ? this.props.startVelX: 0, - yPosition: this.props.dataDoc['startPosY'] ?? 0, + yPosition: this.props.startPosY ?? 0, yVelocity: this.props.startVelY ? this.props.startVelY: 0, xAccel: 0, yAccel: 0, @@ -175,10 +175,10 @@ export default class Weight extends React.Component<IWeightProps, IState> { this.setYVelDisplay(yVel); this.setXVelDisplay(xVel); this.props.dataDoc['accelerationYDisplay'] = - (-1 * Math.round(this.getNewAccelerationY(this.props.dataDoc['updatedForces']) * 100)) / 100 + (-1 * Math.round(this.getNewAccelerationY(this.props.updatedForces) * 100)) / 100 ; this.props.dataDoc['accelerationXDisplay'] = - Math.round(this.getNewAccelerationX(this.props.dataDoc['updatedForces']) * 100) / 100 + Math.round(this.getNewAccelerationX(this.props.dataDoc.updatedForces) * 100) / 100 ; }; @@ -468,6 +468,7 @@ export default class Weight extends React.Component<IWeightProps, IState> { this.setState({yVelocity: this.props.startVelY ?? 0}) this.props.dataDoc['pendulumAngle'] = this.props.dataDoc['startPendulumAngle'] this.props.dataDoc['updatedForces'] = (this.props.dataDoc['startForces']) + this.props.dataDoc['updatedForces2'] = (this.props.dataDoc['startForces2']) this.props.dataDoc['accelerationXDisplay'] = 0 this.props.dataDoc['accelerationYDisplay'] = 0 this.props.dataDoc['positionXDisplay'] = this.state.updatedStartPosX @@ -722,7 +723,7 @@ export default class Weight extends React.Component<IWeightProps, IState> { const newYVel = currentYVel + deltaYVel * dt; const newDeltaXPos = newXVel; const newDeltaYPos = newYVel; - let forces = this.props.dataDoc['updatedForces']; + let forces = this.props.updatedForces; if (this.props.dataDoc['simulationType'] == "Pendulum") { forces = this.getNewPendulumForces(newXPos, newYPos, newXVel, newYVel); } else if (this.props.dataDoc['simulationType'] == "Spring") { |