Skip to content

Commit

Permalink
fix: default physic transform options
Browse files Browse the repository at this point in the history
  • Loading branch information
Gugustinette committed Oct 22, 2024
1 parent d1dd24b commit 0b8983e
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions packages/2d/src/core/FCollider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ export class FCollider {
position: { x: 0, y: 0 },
rotation: 0,
scale: { x: 1, y: 1 },
rotationOffset: 0,
shape: FShapes.RECTANGLE,
sensor: false,
}
Expand Down
1 change: 1 addition & 0 deletions packages/2d/src/core/FRigidBody.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ export class FRigidBody {
position: { x: 0, y: 0 },
rotation: 0,
scale: { x: 1, y: 1 },
rotationOffset: 0,
shape: FShapes.RECTANGLE,
rigidBodyType: FRigidBodyType.DYNAMIC,
sensor: false,
Expand Down
1 change: 1 addition & 0 deletions packages/3d/src/core/FCollider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ export class FCollider {
scale: { x: 1, y: 1, z: 1 },
rotation: { x: 0, y: 0, z: 0 },
shape: FShapes.CUBOID,
rotationOffset: { x: 0, y: 0, z: 0 },
sensor: false,
}
options = { ...DEFAULT_OPTIONS, ...options }
Expand Down
4 changes: 2 additions & 2 deletions packages/3d/src/core/FRigidBody.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,9 @@ export class FRigidBody {
// Apply default options
const DEFAULT_OPTIONS = {
position: { x: 0, y: 0, z: 0 },
scale: { x: 1, y: 1, z: 1 },
rotation: { x: 0, y: 0, z: 0 },
rotationDegree: undefined,
scale: { x: 1, y: 1, z: 1 },
rotationOffset: { x: 0, y: 0, z: 0 },
shape: FShapes.CUBOID,
rigidBodyType: FRigidBodyType.DYNAMIC,
sensor: false,
Expand Down
4 changes: 3 additions & 1 deletion packages/3d/src/core/FTransform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,10 @@ export class FTransform {
}
options = { ...DEFAULT_OPTIONS, ...options }
// Validate options
if (!options.position || (!options.rotation && !options.rotationDegree) || !options.scale)
if (!options.position || (!options.rotation && !options.rotationDegree) || !options.scale) {
console.log(options)
throw new Error('FibboError: options missing for FTransform')
}

// Set the transform values
this.__POSITION__ = options.position
Expand Down

0 comments on commit 0b8983e

Please sign in to comment.