Hi,
Every time SphereCast() gets a hit, the returned distance (and HitFraction) is zero. RaycastSingle() does return the correct distance, so the problem just seems to be with SphereCast().
This is on UrhoSharp so, unless I’ve made some sort of error, the problem is in UrhoSharp or Urho3D or Bullet. My bet is Urho3D or Bullet, I cannot believe UrhoSharp forgets to fill a var it gets from Urho3D.
Regardless the correct distance can be calculated from the sphereRes.Position, but wondered if anyone can confirm it is working in Urho3D?
Thanks.
PhysicsRaycastResult sphereRes = new PhysicsRaycastResult();
float sphereRadius = 2;
float sphereMaxDist = 7;
Ray sphereSend = new Ray(ReverseForWPosOffset, -ammoVelNorm);
physicsComp.SphereCast(ref sphereRes, sphereSend, sphereRadius, sphereMaxDist, collisionMask);
if (sphereRes.Body != null)
{
initialRayDist = sphereRes.Distance;//always zero
initialRayPos = sphereRes.Position;
float distance = Vector3.Subtract(raySend.Origin,sphereRes.Position).Length; //works
}