Physics2D.OverlapCircleAll is not working well
Hi everyone im working on mobile platformer game and i want to add an AoE (area) attack so for that i use the gizmos. I draw a gizmos clearly and i can use it in my script but i've got a problem. While...
View ArticleA way to check for gameobjects within a radius like Physics.OverlapSphere...
I'm trying to find a way to check if certain gameobjects (with tag) are within a radius but they don't have a collider so using overlapsphere isn't the way. Also I know that I could check the distances...
View ArticleHow to check for the nearest gameObject in OverLapCircleAll?
Hi, I am making a top down 2d roguelike game. I have made pickup gameObjects for weapons. They spawn weapons as the children of the player. This function is doing stuff. public void SpawnWeapon() {...
View ArticleWant to spawn a box on other box but don't want those boxes to have same tag...
So I have 2 bad Box and 2 Nice box [There are 2 tags assigned to each box] Box Dead1 (tag = Box1) Box Dead2 (tag = Box2) Box Nice1 (tag = Box1) Box Nice2 (tag = Box2) I want if **Box Dead 1[Red]** is...
View ArticleVery confused... Physics.OverlapSphere working, but not NonAlloc version?
Suddenly, all my NonAlloc versions of Physics.Overlap just stopped returning any colliders. Thought I was going crazy, until I put the identical regular versions above them. The regular versions are...
View ArticleFaster way to check if object has component?
Good evening. I'm making a game where explosions are a thing. In this game there are a lot of different types of objects that can be damaged. Glass, characters, vehicles, and all of them receive...
View ArticleSetParent() on object from Physics.OverlapSphere sets wrong position
When I use SetParent on a transform that I get from Physics.OverlapSphere, the position is not set correctly. The new child gets offset by the same numerical offset as the Parent world position it...
View ArticleCollision detection with overlap sphere
I want to create overlap sphere bullets due to it's lower cost in performance(I don't want rigidbodies and colliders). It's done for mobile. The problem is that most of the time projectile detects the...
View ArticleDetect collider collision ,identify and access colliding colliders
Hey, I'm making an explosion in a game and for the heat wave, I made a sphere with a collider that grows progressively. Now I want to access all the colliders that are colliding with the collider of...
View ArticleWhy does Physics.OverlapSphere not always return the same number of colliders?
I have been working on a detection system for characters. I have adopted the reccomended method of using Physics.OverlapSphere to gather an array of colliders that are asigned to a specific layer mask....
View ArticlePhysics.OverlapSphere not detecting collision! Collision help.
## Explanation ## Hey. I've seen other countless articles about this same question but nobody seems to have an answer and it really is getting frustrating for me. I have a Bullet prefab that is shot...
View Articlemultiple overlapspheres on a single array
I'm trying to add 2 different overlap spheres (one on the right and on on the left) to one array. I've been using colliders = Physics.OverlapSphere(transform.position + new Vector3(0, 0, 1), 0.1f); but...
View ArticleReplacing OverlapSphere with colliders (Detecting weapon collision with...
So i basically have this really basic combat system that i made off Brackeys' tutorials...but now i want it to be more complex and involve colliders instead of Physics.OverlapSphere(). So i just need...
View ArticleHow to make a Shmup Graze mechanic
I'm making a bullet hell and I really wanna add a graze mechanic, however I can't figure out how to make the script only graze bullets once per bullet. I'm using Physics.OverlapSphere to get a list of...
View ArticleEfficient way to scan surrounding with large number of objects
Hello, I am working on a personal ant colony simulation project and I am struggling with performance. I have a bunch of agents (ants) in the scene and I need each of them individually to scan their...
View ArticleOverlapSphere missing colliders
I'm trying to create a batch of trees which I create by finding a random position inside the area and then checking with Physics.OverlapSphere that two tree are not too close to each other. Vector3 pos...
View ArticleOverlapCircleAll, layerMask ( Problem)
Hi, this is my code, if(targetFood == null) { Collider2D[] allFood = Physics2D.OverlapCircleAll(antPosition, viewRadius, 7); if(allFood.Length > 0) { Debug.Log("Find Food"); //Select one food...
View ArticleWhy do Physics2D NonAlloc functions get deprecated?
Hello Community, - at the moment, I am refactoring a 2D project. When I wanted to change the function `Physics2D.OverlapCircleAll` to `Physics2D.OverlapCircleAllNonAlloc` I noticed, that all static 2D...
View ArticlePhysics.OverLapSphere is not working Please help me to fix it or replace it
if (Physics.OverLapSphere(groundCheckTransform.position, 0.1f).length == 0) { RotateByDegrees(); }
View ArticlePhysics.OverLapSphere is not working Please help me to fix it or replace it
if( Physics.OverLapSphere(groundCheckTransform.position,0.1f,playerMask).length==0 ) { RotateByDegrees(); }
View Articlewhat is my mistake HELP!
Hi great codder firstly sory for my bad english. So ı wrote this cod for my player enable to jump only his child emty object touch the ground layer mask public void isGrounded() { Collider[] collider =...
View ArticlePhysics.OverlapSphere not returning colliders.
All my objects have boxColliders, and the proper script, yet the OverlapSphere isn't returning any colliders or objects AT ALL. Why? I've been searching for an answer for 2 days.
View Article2D Area of Effect Script - OverlapCircle not working
I meant to loop through all the colliders inside the range of this overlapCircle and do something (EnemyDeath) if the colliding objects meet some specific requirements (have a script attached). However...
View ArticleOverlapSphere Detecting Colliders Outside of Range (Pooled Objects)
I have a pool of 10 enemy objects that get spawned from one of 3 random locations around a central point. I have towers which target the incoming enemies using OverlapSphere. I'm not using a layer mask...
View ArticleDetect object outside overlapSphere
Hey guys, I'm asking me how I can detect, if the Enemy is outside the overlapSphere range to do some stuff. How can I do that? objectinzone = Physics.OverlapSphere(this.transform.position, 100f);...
View ArticleHow do I get the layer of an object
Im trying to find the layer of a gameobject through a collision with Physics.OverlapSphere, how would I do that?
View ArticleOverlapsphere not working multiple times
Hi there, a little new to this but I've been having an issue with the overlapsphere code I'm trying to use to pick up objects in my game. using System.Collections; using System.Collections.Generic;...
View ArticleHow to calculate normal when using OverlapSphereNonAlloc for collision...
Hello everybody, I use [OverlapSphereNonAlloc][1] to detect collision of my player with wall/s in the scene. Once the collision detected I want to calculate the normal, similarly to...
View ArticleDisable component on collider object when leaving overlapsphere
So, I have a non allocated overlapsphere in front of my character. I use it to find interactable objects in the scene. I also enable an outline component on the colliding object to show which object is...
View ArticleDisable component on collider object when leaving overlapsphere
So, I have a non allocated overlapsphere in front of my character. I use it to find interactable objects in the scene. I also enable an outline component on the colliding object to show which object is...
View Article