react-postprocessing icon indicating copy to clipboard operation
react-postprocessing copied to clipboard

Add Shockwave effect

Open talentlessguy opened this issue 3 years ago • 2 comments

docs reference: https://vanruesc.github.io/postprocessing/public/docs/class/src/effects/ShockWaveEffect.js~ShockWaveEffect.html

talentlessguy avatar Aug 08 '20 20:08 talentlessguy

it breaks at the moment due to this:

Uncaught TypeError: camera.getWorldDirection is not a function
    update postprocessing.esm.js:4786
    render postprocessing.esm.js:2378
    render postprocessing.esm.js:2796
    _c EffectComposer.tsx:65
    render$1 react-three-fiber.esm.js:862
    loop react-three-fiber.esm.js:884
    loop react-three-fiber.esm.js:881
    loop react-three-fiber.esm.js:889
    loop react-three-fiber.esm.js:889
    loop react-three-fiber.esm.js:889
    loop react-three-fiber.esm.js:889
    loop react-three-fiber.esm.js:889
    loop react-three-fiber.esm.js:889
    loop react-three-fiber.esm.js:889
    loop react-three-fiber.esm.js:889
    loop react-three-fiber.esm.js:889
    loop

even when you pass camera thru useThree it still says that, despite having the missing method

dk what's the issue

talentlessguy avatar Apr 01 '21 20:04 talentlessguy

Same here tried to manually explode it but it throws the above error. Any ideas?

netgfx avatar Mar 26 '22 09:03 netgfx

Noticed this from a question. Effect passes usually require a camera as the first constructor argument, then a list of parameters:

  • https://github.com/pmndrs/postprocessing/blob/main/src/effects/ShockWaveEffect.js#L18
import { forwardRef } from 'react'
import { extend, useThree } from '@react-three/fiber'
import { ShockWaveEffect } from 'postprocessing'

extend({ ShockWaveEffect })

const ShockWave = forwardRef(function ShockWave({ args = [], ...props }, ref) {
  const camera = useThree((state) => state.camera)
  return <shockWaveEffect {...props} ref={ref} args={[camera, ...args]} />
})

CodyJasonBennett avatar Feb 25 '23 20:02 CodyJasonBennett