Debugging this Spherecast scenario

by g_b   Last Updated September 11, 2019 13:13 PM

I currently have a problem in my custom character controller. I have code that moves a Gameobject's transform.postion.y to simulate gravity and ground is detected using SphereCast. SphereCast is thrown from the middle of the body towards the bottom. And then I have a big cube as my ground.

When I position the character very high above the cube and then press the Play button, the character drops and SphereCast detects a hit (scenario 1). But when I position it still high above the cube but not as high as the first example, the SphereCast doesn't detect a hit (scenario 2). So it only detects a hit when I start it really high. And this only happens on initial run, because I have a jump function and when I do the first scenario (hits ground) and then do a jump, the landing after the jump is detected by SphereCast even though the jump is same height as scenario 2.

So my next step is, adding a breakpoint in SphereCast hit while playing scenario 2 frame by frame. The thing is, when frame by frame, scenario 2 is detected by SphereCast, so I'm at a lost on how to debug this.


  • SphereCast hits ground when character is placed really high above ground then hitting Play button (scenario 1)
  • SphereCast doesn't hit ground when character is placed moderately high above ground then hitting Play button (scenario 2)
  • If scenario 2 is done frame-by-frame, SphereCast hits
  • Need ideas on how to debug
Tags : unity

Related Questions

Unfortunately game has stopped

Updated July 02, 2019 11:13 AM

Unity Shader-Graph randomly tiled sprite

Updated May 24, 2020 02:13 AM

How to animate objects in Unity 3D

Updated July 12, 2015 13:05 PM