More Sceneform AR physics experiment

Jul 19, 2020

I added a new experiment scenario to my AR Physics app: I call it the collision box. I outlined this as a plan in my previous AR Physics blog post. So right now the start screen of the app presents a choice between the plank tower scenario vs this new collision box scenario.

So in the collision box example I evenly set up wooden planks standing up in a matrix pattern in a rectangular 1 meter by 1 meter box and place the red cylinder the user can yank around at the center. Right now this scenario still experiences an explosion effect, so the planks will fall and jitter. But after or during the transition to an equilibrium phase the user can drag the cylinder around which stirs the planks which are confined within the invisible collision box walls.

I got it right that the cylinder needed to be a “Kinematic object” so the physics engine would not be able to move it, but it’d still interact with the planks. Unfortunately the jittering effect (along the unwanted initial jumping) is visible in this scenario as well, more so than the plank tower actually. There’s another error: the physics engine keeps resetting the cylinder position back to the center and when that happens the visual position differs from the simulated position creating a hollow cylinder at the center of the collision box. To get the scenario to work to this extent still required a lot of trials. I used Sceneform’s TransformableNodes to let the user move the cylinder around: the user needs to tap on the cylinder and drag it. I needed to limit the cylinder’s movement to the ground plane to avoid vertical displacements.

I fixed a limitation of the simulation preventing the planks from any rotation: I have to explicitly call calculateLocalInertia. I still need to integrate Sceneform-Bullet and JMonkey physics engine selection choices. I need to form API layers between my app’s internal physics logic and the AR logic to make it extensible. I also want to prevent the jitterbug.

Comments loading...