Options
All
  • Public
  • Public/Protected
  • All
Menu

use-ammojs

Index

Type aliases

EulerTuple: [number, number, number, string]
RotationTypes: Euler | Vector3Tuple | EulerTuple | SerializedQuaternion | Quaternion
SerializedQuaternion: { _w: number; _x: number; _y: number; _z: number }

Type declaration

  • _w: number
  • _x: number
  • _y: number
  • _z: number
SerializedVector3: Pick<Vector3, "x" | "y" | "z">
SingleBodyConstraintConfig: ({ frameInA: Transform; type: CONE_TWIST } & ConeTwistConstraintDynamicConfig) | ({ frameInB: Transform; type: GENERIC_6_DOF; useLinearReferenceFrameA: boolean } & Generic6DOFDynamicConfig) | ({ frameInB: Transform; type: GENERIC_6_DOF_SPRING; useLinearReferenceFrameB: boolean } & Generic6DOFSpringDynamicConfig) | ({ frameInA: Transform; type: HINGE; useReferenceFrameA: boolean } & HingeDynamicConfig) | ({ pivot: Vector3; type: POINT_TO_POINT } & PointToPointDynamicConfig) | ({ frameInB: Transform; type: SLIDER; useLinearReferenceFrameA: boolean } & SliderDynamicConfig)
SingleBodyConstraintRefs: { bodyARef: MutableRefObject<Object3D | undefined>; bodyBRef?: undefined }

Type declaration

  • bodyARef: MutableRefObject<Object3D | undefined>
  • Optional bodyBRef?: undefined
Triplet: Vector3Tuple
TwoBodyConstraintConfig: ({ frameInA: Transform; frameInB: Transform; type: CONE_TWIST } & ConeTwistConstraintDynamicConfig) | ({ frameInA: Transform; frameInB: Transform; type: GENERIC_6_DOF; useLinearReferenceFrameA: boolean } & Generic6DOFDynamicConfig) | ({ frameInA: Transform; frameInB: Transform; type: FIXED } & FixedDynamicConfig) | ({ frameInA: Transform; frameInB: Transform; type: GENERIC_6_DOF_SPRING; useLinearReferenceFrameA: boolean } & Generic6DOFSpringDynamicConfig) | ({ axis: Vector3; pivot: Vector3; targetAxis: Vector3; targetPivot: Vector3; type: HINGE; useReferenceFrameA: boolean } & HingeDynamicConfig) | ({ pivot: Vector3; targetPivot: Vector3; type: POINT_TO_POINT } & PointToPointDynamicConfig) | ({ frameInA: Transform; frameInB: Transform; type: SLIDER; useLinearReferenceFrameA: boolean } & SliderDynamicConfig)
TwoBodyConstraintRefs: { bodyARef: MutableRefObject<Object3D | undefined>; bodyBRef: MutableRefObject<Object3D | undefined> }

Type declaration

  • bodyARef: MutableRefObject<Object3D | undefined>
  • bodyBRef: MutableRefObject<Object3D | undefined>
UpdateBodyOptions: Pick<BodyConfig, "type" | "disableCollision" | "activationState" | "collisionFilterGroup" | "collisionFilterMask" | "friction" | "linearDamping" | "angularDamping" | "gravity" | "linearSleepingThreshold" | "angularSleepingThreshold" | "angularFactor">
UseConstraintReturn: [MutableRefObject<Object3D | undefined> | undefined, MutableRefObject<Object3D | undefined> | undefined, ConstraintApi]
UseRigidBodyOptions: Omit<BodyConfig<Vector3Types>, "type"> & { bodyType?: BodyType; mesh?: Object3D; position?: Vector3Types; rotation?: RotationTypes; shapeConfig?: Omit<ShapeConfig<Vector3Types>, "type">; shapeType: ShapeType }
Vector3Tuple: [x: number, y: number, z: number]
Vector3Types: Vector3 | SerializedVector3 | Vector3Tuple

Properties

AmmoDebugConstants: any

Variables

AmmoPhysicsContext: Context<null | AmmoPhysicsContext>

Functions

  • Physics(__namedParameters: PropsWithChildren<AmmoPhysicsProps>): null | Element
  • Parameters

    • __namedParameters: PropsWithChildren<AmmoPhysicsProps>

    Returns null | Element

  • PhysicsStats(__namedParameters: PhysicsStatsProps): null
  • Parameters

    • __namedParameters: PhysicsStatsProps

    Returns null

  • createRigidBodyApi(physicsContext: AmmoPhysicsContext, bodyUUID: string): { applyForce: any; applyImpulse: any; getPosition: any; getRotation: any; setLinearVelocity: any; setMotionState: any; setPosition: any; setRotation: any; setShapesOffset: any; updateBodyOptions: any }
  • Parameters

    Returns { applyForce: any; applyImpulse: any; getPosition: any; getRotation: any; setLinearVelocity: any; setMotionState: any; setPosition: any; setRotation: any; setShapesOffset: any; updateBodyOptions: any }

    • applyForce:function
      • applyForce(force: Vector3, relativeOffset?: Vector3): void
      • Parameters

        • force: Vector3
        • Optional relativeOffset: Vector3

        Returns void

    • applyImpulse:function
      • applyImpulse(impulse: Vector3, relativeOffset?: Vector3): void
      • Parameters

        • impulse: Vector3
        • Optional relativeOffset: Vector3

        Returns void

    • getPosition:function
      • getPosition(): Vector3
      • Returns Vector3

    • getRotation:function
      • getRotation(): Quaternion
      • Returns Quaternion

    • setLinearVelocity:function
      • setLinearVelocity(velocity: Vector3): void
      • Parameters

        • velocity: Vector3

        Returns void

    • setMotionState:function
      • setMotionState(position: Vector3, rotation: Quaternion): void
      • Parameters

        • position: Vector3
        • rotation: Quaternion

        Returns void

    • setPosition:function
      • setPosition(position: Vector3): void
      • Parameters

        • position: Vector3

        Returns void

    • setRotation:function
      • setRotation(rotation: Quaternion): void
      • Parameters

        • rotation: Quaternion

        Returns void

    • setShapesOffset:function
      • setShapesOffset(offset: Vector3): void
      • Parameters

        • offset: Vector3

        Returns void

    • updateBodyOptions:function
      • Parameters

        Returns void

  • Parameters

    Returns {}

    • useAmmo(): { rayTest: (options: RaycastOptions) => Promise<RaycastHit[]> }
    • Returns { rayTest: (options: RaycastOptions) => Promise<RaycastHit[]> }

      • rayTest: (options: RaycastOptions) => Promise<RaycastHit[]>
          • Parameters

            • options: RaycastOptions

            Returns Promise<RaycastHit[]>

    • Parameters

      Returns [MutableRefObject<Object3D | null>, RigidbodyApi]

    • useSoftBody(options: UseSoftBodyOptions | (() => UseSoftBodyOptions), fwdRefOrMesh?: Mesh<BufferGeometry, Material | Material[]> | Ref<Mesh<BufferGeometry, Material | Material[]>>, deps?: DependencyList): [MutableRefObject<Mesh | null>, SoftbodyApi]
    • Parameters

      • options: UseSoftBodyOptions | (() => UseSoftBodyOptions)
      • Optional fwdRefOrMesh: Mesh<BufferGeometry, Material | Material[]> | Ref<Mesh<BufferGeometry, Material | Material[]>>
      • deps: DependencyList = []

      Returns [MutableRefObject<Mesh | null>, SoftbodyApi]

    Generated using TypeDoc