Hi I am currently doing a Unity course on Udemy and I have copied the lecturer’s code but the gizmo is not showing.
Here is my code:
private void OnDrawGizmos(){
if(_damageCasterCollider == null){
_damageCasterCollider = GetComponent<Collider>();
RaycastHit hit;
Vector3 originalPos = transform.position + (-_damageCasterCollider.bounds.extents.z) * transform.forward;
bool hasHit = Physics.BoxCast(originalPos, _damageCasterCollider.bounds.extents / 2, transform.forward, out hit, transform.rotation, _damageCasterCollider.bounds.extents.z, 1 << 6);
if(hasHit){
Gizmos.color = Color.yellow;
Gizmos.DrawWireSphere(hit.point, 0.4f);
}
}
}
I wonder if anything is wrong with it. I think it could be to do with the position shown of my player:
As you can see the transform is set from the lights rather than the player, however I’m not sure how to change this without moving the entire mesh etc. I just want to move the origin of transforn elsehwere.