Skip to content

Commit

Permalink
Update air pressure needle rotation - see #7
Browse files Browse the repository at this point in the history
  • Loading branch information
matthew-blackman committed Mar 1, 2024
1 parent d9ed4ef commit 648c36b
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions js/common-vsm/view/CustomLauncherNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,11 @@ export default class CustomLauncherNode extends LauncherNode {

const isLauncherCustomProperty = DerivedProperty.valueEqualsConstant( mysteryOrCustomProperty, 'custom' );

const pressureNeedleIcon = new Image( pressureNeedle_png, { x: -13.5, y: -40 } );
const pressureNeedleNode = new Node( { children: [ pressureNeedleIcon ] } );
const pressureNeedleNode = new Node( {
children: [
new Image( pressureNeedle_png, { x: -13.5, y: -40 } )
], rotation: -Math.PI / 2
} );

const launcherTypeIconContainer = new Node( {
x: -0.7 * BARREL_LENGTH_BEFORE_ORIGIN,
Expand Down Expand Up @@ -158,8 +161,8 @@ export default class CustomLauncherNode extends LauncherNode {
pressureNeedleNode.visible = launcherType === PRESSURE;
} );

latestLaunchSpeedProperty.link( launchSpeed => {
const maxAngle = 80;
latestLaunchSpeedProperty.lazyLink( launchSpeed => {
const maxAngle = 120;
const meanSpeed = launcherMechanismProperty.value.speedMeanProperty.value;
const maxSpeed = 30;
const needleDeltaRotation = maxAngle * ( launchSpeed - meanSpeed ) / ( maxSpeed - meanSpeed );
Expand Down

0 comments on commit 648c36b

Please sign in to comment.