uikit icon indicating copy to clipboard operation
uikit copied to clipboard

expose control over the three.js side property to render the back side of elements

Open bbohlender opened this issue 9 months ago • 3 comments

bbohlender avatar May 09 '24 19:05 bbohlender

Any update on this?

Deamoner avatar Jun 04 '24 20:06 Deamoner

We need this capability as well and would like to know it's priority among other needs is if possible

fakalit avatar Aug 26 '24 18:08 fakalit

In our workaround we simply add another container to the root and use the transformRotation property to flip it by 180 degrees :) (just putting it out there to unblock folks)

wrangelvid avatar Aug 26 '24 22:08 wrangelvid

I'm using @wrangelvid's idea to duplicate the root like this:

function DoubleSided({ children }) {
    return <>
        {children}
        <children.type {...children.props} transformRotateY={180} transformScaleX={"-100%"} />
    </>
}

then in Canvas:

<DoubleSided>
    <Root><Text>Hello</Text></Root>
</DoubleSided>

AB498 avatar Jan 27 '25 17:01 AB498

Would be interested on this too

cyango avatar Jan 27 '25 19:01 cyango

+1 to this

igpdev-428 avatar Feb 18 '25 14:02 igpdev-428

I'm using @wrangelvid's idea to duplicate the root like this:

function DoubleSided({ children }) { return <> {children} <children.type {...children.props} transformRotateY={180} transformScaleX={"-100%"} /> </> } then in Canvas:

Hello

I had some issues (typescript and such) also my ui has some buttons and they were not detecting raycast from the back side so I did this

type FooProps = {
  name: string
}

const DoubleSided: React.FC<PropsWithChildren<FooProps>> = (props: PropsWithChildren<FooProps>) => {
  if (!React.isValidElement(props.children)) return <></> 

  return (
    <>
      {props.children}
      <props.children.type
        {...props.children.props}
        transformRotation={[0, 180, 0]}
        transformScaleX={'-100%'}
        transformScaleZ={'-100%'}
      />
    </>
  )
}

EDIT: also I forgot to mention, so that the duplicate doesn't order itself according to the original copy, I added a <Container positionType={'absolute'}> under the <DoubleSided> tag, wrapping all items to duplicate.

So in the end because wrapping the root didn't work in my case I did:

      <Root
        positionLeft={0}
        positionTop={0}
        positionType="absolute"
        anchorX="left"
        anchorY="top"
        flexDirection="column">
        <DoubleSided name={'foo'}>
          <Container positionType={'absolute'}>
                {elements}
          </Container>
       </DoubleSided>
    </Root>

igpdev-428 avatar Feb 18 '25 15:02 igpdev-428