Skip to content

Rotate kinematic body based on current rotation #114

Answered by codynova
AdamRamberg asked this question in General
Discussion options

You must be logged in to vote

Hey @AdamRamberg, it looks like you probably want to subscribe to the current rotation of the physics body, right?

const rotation = useRef([ 0, 0, 0 ])
useEffect(() => api.rotation.subscribe((r) => (rotation.current = r)), [])
useFrame() => {
  //...
  rotation.current[1] += 0.01
  api.rotation.set(...rotation)
})

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@codynova
Comment options

@AdamRamberg
Comment options

Answer selected by AdamRamberg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #114 on September 22, 2020 22:29.