convexSweepTest returns wrong hitpoint

Post Reply
ktfh
Posts: 44
Joined: Thu Apr 14, 2016 3:44 pm

convexSweepTest returns wrong hitpoint

Post by ktfh »

I have run into a weird behaviour where performing a convexSweepTest with a btSphereShape and ClosestConvexResultCallback seems to randomly report a hit point far outside the volume of the convexSweepTest. For example sweeping from 0,0,0 to 0,-1,0 with a sphere shape with radius 0.5 , I would expect a hit point to be at most 1.5 from the origin of the sweep but i occasionally get hit points more than 40 units away. The behaviour seems to only manifest when the btBoxShape being cast against is rotated on multiple axis and an active rigidbody is near the convexSweepCast.

Iv written 150 line program that reliably reproduces the behaviour for me and pasted it here:
https://gist.github.com/ktfh/dc9c4d26ed ... ff9a98f1cd

example out put of program:
FRAME 864
EXPECTED MAX DISTANCE OF 2.450000 HITDIST 40.919411
FROM -55.299984,-12.355896,-22.308666
TO -55.299984,-14.355896,-22.308666
RADIUS 0.450000
HITPOS -18.377710,-9.365052,-39.692535
HITNORM -0.130778,0.990269,-0.047598

heres an image to visualize and video https://www.youtube.com/watch?v=tqga2pD-3pE
Image

I also asked on github but I don't think issues get looked at often.
https://github.com/bulletphysics/bullet3/issues/596
Evan407
Posts: 22
Joined: Sun Jan 17, 2016 2:37 am

Re: convexSweepTest returns wrong hitpoint

Post by Evan407 »

I was having a little trouble deciphering your code. Are you doing the ray cast from inside the sphere? Hitting the back side of a surface will not be detected it detects hitting the front facing side of a surface.
ktfh
Posts: 44
Joined: Thu Apr 14, 2016 3:44 pm

Re: convexSweepTest returns wrong hitpoint

Post by ktfh »

I am not ray casting and there is actually no sphere rigid body in the physics world, the wheel meshes are just visual. What I am doing is performing a convexSweepTest using a btSphereShape and adding an upward force to the vehicles rigid body when the convexSweepTest hits the ground which is a btCollisionObject with a btBoxShape. The bug is that convexSweepTest reports it has a hit but the hit point's world position is randomly placed far outside the swept volume. Maybe I can make the example program more succinct. Did you try compiling and running it? I am curious if the behavior varies across machines.
Post Reply