Skip to content

Commit 83158c0

Browse files
committed
Default on Z orientation for box shapes.
1 parent e6479e1 commit 83158c0

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

Extensions/Physics3DBehavior/Physics3DRuntimeBehavior.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,8 @@ namespace gdjs {
397397
this.bullet = behaviorData.bullet;
398398
this.fixedRotation = behaviorData.fixedRotation;
399399
this.shape = behaviorData.shape;
400-
this.shapeOrientation = behaviorData.shapeOrientation;
400+
this.shapeOrientation =
401+
behaviorData.shape === 'Box' ? 'Z' : behaviorData.shapeOrientation;
401402
this.shapeDimensionA = behaviorData.shapeDimensionA;
402403
this.shapeDimensionB = behaviorData.shapeDimensionB;
403404
this.shapeDimensionC = behaviorData.shapeDimensionC;

newIDE/app/src/BehaviorsEditor/Editors/Physics3DEditor/index.js

+10-5
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,10 @@ const Physics3DEditor = (props: Props) => {
8686

8787
const isStatic = properties.get('bodyType').getValue() === 'Static';
8888

89+
const canShapeBeOriented =
90+
properties.get('shape').getValue() !== 'Sphere' &&
91+
properties.get('shape').getValue() !== 'Box';
92+
8993
return (
9094
<Column
9195
expand
@@ -171,14 +175,15 @@ const Physics3DEditor = (props: Props) => {
171175
id="physics3d-parameter-shape-orientation"
172176
fullWidth
173177
floatingLabelText={properties.get('shapeOrientation').getLabel()}
174-
value={properties.get('shapeOrientation').getValue()}
178+
value={
179+
canShapeBeOriented
180+
? properties.get('shapeOrientation').getValue()
181+
: 'Z'
182+
}
175183
onChange={(e, i, newValue: string) =>
176184
updateBehaviorProperty('shapeOrientation', newValue)
177185
}
178-
disabled={
179-
properties.get('shape').getValue() === 'Sphere' ||
180-
properties.get('shape').getValue() === 'Box'
181-
}
186+
disabled={!canShapeBeOriented}
182187
>
183188
<SelectOption key={'shape-orientation-z'} value={'Z'} label={t`Z`} />
184189
<SelectOption key={'shape-orientation-y'} value={'Y'} label={t`Y`} />

0 commit comments

Comments
 (0)