Detect collision normal when touching spheres

Hi everyone!

Basically I’ve got a lance GameObject (that’s just a scaled primitive cube) that i’m pushing towards a sphere, if I touch it with the tip of the lance then I want to execute some code.

But here’s the trick, the lance GameObject slowly scales up in length when I charge, hence I can’t really just attach an empty collider as a children to detect the collision, otherwise it just scales with the parent etc…

So my guess was the detect if im touching the tip of the lance with the normal, but I can’t check if the normal is a standard Vector3.up or something since the other object is a sphere and the contact’s normal is always irregular (e.g. (0.4f, 09f, 0f)).

How can I detect the sphere has been touched with the tip?
alt text
Many thanks!

In order to do some testing with it, I used this code:

void OnDrawGizmos()
        Gizmos.color =;
        float dist = GetComponent<Collider>().bounds.extents.x;

        Gizmos.DrawCube(transform.position + new Vector3(dist, 0, 0), new Vector3(1,1,1));

attach it to a cube to see if that’s what you want. It should get the far left point of the object. I’m using gizmos to indicate it for testing purposes. If that’s what you want, simply fire a ray from transform.position + new Vector3(dist, 0, 0) and have it travel as much as the velocity it’s about to move, and check if it hits.

Great thank you!

Using the raycast is so much more precise in this case, and with your nifty .bounds.extents I could position it correctly even with the scaling up !