aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/PhysicsBox/PhysicsSimulationWeight.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/views/nodes/PhysicsBox/PhysicsSimulationWeight.tsx')
-rw-r--r--src/client/views/nodes/PhysicsBox/PhysicsSimulationWeight.tsx15
1 files changed, 8 insertions, 7 deletions
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") {