-
EOM |
Beta Was this translation helpful? Give feedback.
Answered by
wiledal
Aug 2, 2023
Replies: 1 comment
-
Yes! See: https://github.com/pmndrs/react-three-rapier#moving-things-around-and-applying-forces RigidBodies are returned as RefObject containing a Rapier RigidBody, so you can use all the functions available here: You access it by getting it in a import { RapierRigidBody } from "@react-three/rapier";
const Object = () => {
const rigidBody = useRef<RapierRigidBody>(null);
useEffect(() => {
if (rigidBody.current) {
const position = rigidBody.current.translation()
const rotation = rigidBody.current.rotation()
}
}, []);
return (
<RigidBody ref={rigidBody}>
<mesh>
<boxBufferGeometry />
<meshStandardMaterial />
</mesh>
</RigidBody>
);
}; |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
arkk200
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Yes!
See: https://github.com/pmndrs/react-three-rapier#moving-things-around-and-applying-forces
RigidBodies are returned as RefObject containing a Rapier RigidBody, so you can use all the functions available here:
https://rapier.rs/javascript3d/classes/RigidBody.html
You access it by getting it in a
ref
.