pmndrs / react-three-rapier

🤺 Rapier physics in React
https://react-three-rapier.pmnd.rs
MIT License
1.09k stars 62 forks source link

RigidBody's Physcial dimensions not updating with respect to 3D model with animation #655

Closed AshhadDevLab closed 7 months ago

AshhadDevLab commented 7 months ago

Description:

I have a 3D model which has an array of animations, the issue I am facing is that the model's animation starts in such a way that the model is flipped closed and after that, it flips open. The model's Physical dimensions are not updating when the model flip opens it stays the way it was before making it go under the collision surface.

Video:

https://github.com/pmndrs/react-three-rapier/assets/58696726/36b8e030-57fa-4fb7-b6d8-5a0b33c6410d

Tried Solutions:

I have tried to update the physics by decreasing the timestamp of it getting updated but no results there too.

Source Code:

import { createRoot } from "react-dom/client";
import { Canvas } from "@react-three/fiber";
import { OrbitControls, Center, ContactShadows, Box } from "@react-three/drei";
import { Physics, RigidBody, CuboidCollider } from "@react-three/rapier";
import { Model } from "./models/rover";

export default function App() {
  return (
    <Canvas>
      <OrbitControls />
      <ambientLight intensity={5} />
      <ContactShadows
        scale={20}
        blur={0.4}
        opacity={0.2}
        position={[-0, -1.5, 0]}
      />
      <Physics debug colliders="hull">
        <RigidBody>
          <Center>
            <Model />
          </Center>
        </RigidBody>
        <CuboidCollider position={[0, -2, 0]} args={[20, 1, 20]} />
        <Box args={[40, 2, 40]} position={[0, -2, 0]} />
      </Physics>
    </Canvas>
  );
}