Skip to content

Commit

Permalink
feat: use type imports for jolt-physics imports
Browse files Browse the repository at this point in the history
  • Loading branch information
isaac-mason committed Apr 14, 2024
1 parent d889d92 commit dc6f8a1
Show file tree
Hide file tree
Showing 19 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion packages/react-three-jolt/src/components/Physics.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// This is the core component that manages and stores the simulation
import * as THREE from 'three';
import Jolt from 'jolt-physics';
import type Jolt from 'jolt-physics';
//import InitJolt from 'jolt-physics/wasm-compat'
import { suspend } from 'suspend-react';
import { Raw, initJolt } from '../raw';
Expand Down
2 changes: 1 addition & 1 deletion packages/react-three-jolt/src/context.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Jolt from 'jolt-physics';
import type Jolt from 'jolt-physics';
import { createContext } from 'react';
import type { BodySystem } from './systems/body-system';
import type { PhysicsSystem } from './systems/physics-system';
Expand Down
2 changes: 1 addition & 1 deletion packages/react-three-jolt/src/systems/body-state.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// This class holds the bodies and the management of them
import Jolt from 'jolt-physics';
import type Jolt from 'jolt-physics';
import {
//MathUtils,
Matrix4,
Expand Down
2 changes: 1 addition & 1 deletion packages/react-three-jolt/src/systems/body-system.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// This class holds the bodies and the management of them
import Jolt from 'jolt-physics';
import type Jolt from 'jolt-physics';
import {
//MathUtils,
// Matrix4,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// main items of the camera rigs
import { Raw } from '../raw';
import Jolt from 'jolt-physics';
import type Jolt from 'jolt-physics';
import * as THREE from 'three';
// mostly for the types
import { PhysicsSystem } from './physics-system';
Expand Down
2 changes: 1 addition & 1 deletion packages/react-three-jolt/src/systems/camera-rig-system.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// main items of the camera rigs
import { Raw } from '../raw';
import Jolt from 'jolt-physics';
import type Jolt from 'jolt-physics';
import * as THREE from 'three';
// mostly for the types
import { PhysicsSystem } from './physics-system';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ so much and can be reused for things like NPC's */

import * as THREE from 'three';
import { MathUtils } from 'three';
import Jolt from 'jolt-physics';
import type Jolt from 'jolt-physics';
import { Raw } from '../raw';
import { Layer } from '../constants';
import { PhysicsSystem } from './physics-system';
Expand Down
2 changes: 1 addition & 1 deletion packages/react-three-jolt/src/systems/constraint-system.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// class to control and manage constraints
// designed to be used from the body system although it can be accessed directly

import Jolt from 'jolt-physics';
import type Jolt from 'jolt-physics';
import { Raw } from '../raw';
// @ts-ignore
import { vec3, quat } from '../utils';
Expand Down
2 changes: 1 addition & 1 deletion packages/react-three-jolt/src/systems/physics-system.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ we'll expose various parts of the system through the physics component and conte
import { invalidate } from '@react-three/fiber';
import * as THREE from 'three';

import Jolt from 'jolt-physics';
import type Jolt from 'jolt-physics';
import { Raw } from '../raw';
import { BodySystem } from './body-system';
import { BodyState } from './body-state';
Expand Down
2 changes: 1 addition & 1 deletion packages/react-three-jolt/src/systems/raycasters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { PhysicsSystem } from './physics-system';
import { Layer } from '../constants';
import * as THREE from 'three';

import Jolt from 'jolt-physics';
import type Jolt from 'jolt-physics';
import { Raw } from '../raw';
import { anyVec3, vec3 } from '../utils';

Expand Down
2 changes: 1 addition & 1 deletion packages/react-three-jolt/src/systems/shape-system.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// Inital code ffrom Isaac's Jolt Sketch:
//https://github.com/isaac-mason/sketches/blob/main/src/sketches/jolt-physics/jolt-react-api/three-to-jolt.ts

import Jolt from 'jolt-physics';
import type Jolt from 'jolt-physics';
import * as THREE from 'three';
import { BufferGeometry, Mesh, Object3D, Vector3 } from 'three';
import { SphereGeometry, BoxGeometry, CapsuleGeometry, CylinderGeometry } from 'three';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as THREE from 'three';
import Jolt from 'jolt-physics';
import type Jolt from 'jolt-physics';
import { Raw } from '../../raw';
import { vec3, quat } from '../../utils';
import { PhysicsSystem } from '../physics-system';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
import * as THREE from 'three';
import Jolt from 'jolt-physics';
import type Jolt from 'jolt-physics';
import { Raw } from '../../raw';
import { vec3, quat } from '../../utils';
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as THREE from 'three';
import Jolt from 'jolt-physics';
import type Jolt from 'jolt-physics';
import { Raw } from '../../raw';
import { vec3, quat } from '../../utils';
import { PhysicsSystem } from '../physics-system';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as THREE from 'three';
/*
import Jolt from 'jolt-physics';
import type Jolt from 'jolt-physics';
import { Raw } from '../../raw';
import { vec3, quat } from '../../utils';
*/
Expand Down
2 changes: 1 addition & 1 deletion packages/react-three-jolt/src/systems/vehicles/wheels.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as THREE from 'three';
//import Jolt from 'jolt-physics';
//import type Jolt from 'jolt-physics';
import { Raw } from '../../raw';
import { vec3, quat, joltPropName } from '../../utils';

Expand Down
2 changes: 1 addition & 1 deletion packages/react-three-jolt/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Jolt from 'jolt-physics';
import type Jolt from 'jolt-physics';

export type Vector3Tuple = [number, number, number];
export type Vector4Tuple = [number, number, number, number] | number[];
Expand Down
2 changes: 1 addition & 1 deletion packages/react-three-jolt/src/utils/general.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Jolt from 'jolt-physics';
import type Jolt from 'jolt-physics';
import * as THREE from 'three';
import { Raw } from '../raw';
import { Vector3Tuple, Vector4Tuple } from '../types';
Expand Down
2 changes: 1 addition & 1 deletion packages/react-three-jolt/src/utils/meshTools.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//various Jolt/Three tools for meshes
// I HATE we need to import this raw module
import { Raw } from '../raw';
import Jolt from 'jolt-physics';
import type Jolt from 'jolt-physics';
import * as THREE from 'three';

// create a heightfeild type floor
Expand Down

0 comments on commit dc6f8a1

Please sign in to comment.