The Stack Overflow podcast is back! Listen to an interview with our new CEO.

Questions tagged [collider]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
3
votes
3answers
12k views

Unity: How is a Mesh Collider “performance expensive”?

Do Mesh Colliders slow down performance simply by existing or only when they are colliding? Do they directly impact FPS or do they slow down the in-game physics?
3
votes
1answer
1k views

Merging box colliders for optimization

Look at the picture. The figure on the left shows the individual box colliders in green. The yellow boxes on the right are the results of the optimization of the original box colliders. What is the ...
3
votes
0answers
51 views

Zooming in a lot without having 3D objects disappear in the Unity Editor

I'm editing the 2D colliders on some objects of my game, and I need them to be very accurate, so I'm zooming in a lot. Problem is, since my objects are 3D graphically, when I zoom in a lot they ...
3
votes
0answers
95 views

Line Renderer 2d Follow the edge

I am using mouse position to draw a line using line renderer 2d. What i want is when the line hits a collider it should start to draw on the edge of the collider rather than over the collider. ...
3
votes
0answers
59 views

Unity: Messages in Compound Colliders

Lets say I have a 2D character with two colliders: a circle collider that represents the feet, and a box collider that represents the body. Lets say that the character is currently standing on the ...
1
vote
1answer
347 views

Unity - An unwanted Collider , far too big , being added to meshes without reason and I cannot remove it

so I have a game in progress that is very similar to Asteroids. I was using spheres as primitive game objects and it all works perfectly in this case, but I need to be able to rotate the ship's model, ...
1
vote
1answer
142 views

What is a raycast?

I use this script to build buildings on my terrain, and it works with the collider somehow. But I don't understand what it is that the raycast does to find the right place to put my building. ...
1
vote
2answers
174 views

Mesh made in Blender is correct in Unity3D as a rendered mesh, but “empty” as a collider?

I created a simple stair "block" in Blender, and it's rendered correctly, but when I tick "Generate Colliders" and try to use it in a Mesh Collider, there is nothing. (Ps.: I need the real mesh as a ...
1
vote
3answers
436 views

Is it possible to have two trigger zones around the same GameObject in unity?

I have created a trigger zone to make sure that only only gameobject passes through it at a time. The moment the gameobject1 entered the trigger zone, it is given a particular tag but I am not how to ...
1
vote
1answer
539 views

Unity tilemap collider not colliding with rigidbody

In the wireframe you can see the tilemap collider for this hill. The red circle falls right through however. The circle has a 2D rigidbody attached. Everything is on the Default sorting layer and on ...
1
vote
1answer
40 views

Teleport Not Working in Unity 2D

So I'm basically trying to get my character to "use" a set of stairs by teleporting from one stairway door to another. Each stairway door will be paired with one other stairway door. Here's the code, ...
1
vote
1answer
213 views

Changing CharacterController's height causes jittering issue in Unity

As title said changing height of Character Controller causes jittering issue. For example when I reduced the height of CharacterController, it seems CharacterController was floating at each frame and ...
1
vote
2answers
242 views

It lags when it collides. Help? :(

I am trying (and believing) to make a game of pong. I have got a slightly decent working game. I haven't implemented the scoreboard or AI yet because I want the physics to work first. I am trying to ...
1
vote
1answer
188 views

Is Trigger Colliders not ignored

I am working on a 2D Plattformer with melee attacks. The player is using a Kinematic Rigid Body and a Capsule Collider. Movement (even in slopes), jumping and and collission are working fine. My ...
1
vote
1answer
71 views

Every Item is colliding but 1

In my game I have a BULLET, MOONS, STARS, and A SHIP. I shoot bullets from the ship and hit stars or moons and collisions occur. Yet when a moon runs into my ship there is no detection even though I ...
1
vote
1answer
58 views

Optimizing Hitboxes

Way over 90% of the performance cost seems to be coming from colliders parented to animated bones. If I disable Motion & Animation I can spawn 20 soldiers with around 1ms cost on my mid-low end ...
1
vote
1answer
97 views

ContactFilter2D does not detect a trigger even with “use triggers” enabled

I'm Using Unity 2018.3.11f1 and I'm going crazy trying to understand why the "use triggers" variable of the ContactFilter2D is not having any effect and I'm always detecting only the non-trigger ...
1
vote
1answer
82 views

Why do my NPC's fall through the world when I select them as triggers?

I'm making a game in Unity where when the player comes into contact with an NPC it will switch scenes. I have the code for it and made sure all NPC's have rigidbody as well as using gravity and convex....
1
vote
1answer
292 views

How to ignore collisions of triggers after first collision of trigger until OnTriggerExit of first collision of trigger?

There is are white and red two teams of tank which are auto spawning in certain time interval. both red and white type of tanks have triggers so when red and white tank come close enough, ...
1
vote
1answer
102 views

Collider does not call callback functions

I have a script that will create new GameObjects and will place it where the mouse is placed on the terrain. Now I need to have a check for collision on other already placed GameObjects on the field. ...
1
vote
0answers
21 views

2D Rigidbody with Touchscript movement in Unity won't stay in boundaries

I'm trying to make a pong game where the player has to move both paddles. They are currently set as dynamic 2D Rigidbodies (collision detection continuous) and have a box collider (is NOT trigger) ...
1
vote
1answer
31 views

Dragging a Rigidbody2d without moving other Rigidbodies

There are obstacles and other objects that are draggable. Colliders and dynamic rigidbodies are on the draggable object and there are colliders on the obstacles. The problem is that with the ...
1
vote
1answer
26 views

Unity Collider2D is causing the game object to disappear upon collision

I have gone through just about everything to try and isolate this bug. I have isolated it down to the enemy collider, but have not solved the issue. When my player collides with my enemy, the enemy ...
1
vote
0answers
130 views

Unity2D TileMap Collider Update Optimization

I'm currently working on a 2D tile-based side-scroller (similar to Terraria). I am using Unity's TileMap feature to draw tiles onto the screen and have my player collide with them as if they were ...
1
vote
0answers
37 views

Box collider has different behavior in 2 clients

I'm new to Unity. I am making my first Game and faced with problem. I have a plane and 4 gameobject that has box collider surrounded this plane. there are a few spheres as players inside of the plane....
1
vote
0answers
17 views

Capsule collider triggered unexpectedly

I have an object with a capsule collider on its root, with IsTrigger=true (triggered by the player). The trigger works fine, but is also triggered unexpectedly some ...
1
vote
2answers
643 views

Instantiated object not tracking collision

I have an issue, and I'm not sure why it's happening. I have a prefab that I've built in a colour-changing game. It has the following: Four 2D objects that if they collide with the player (2D ...
1
vote
1answer
979 views

My collider is not following my humanoid animation: how to do ?

I've a "Zombie" charachter and the following hirearchy: I put a Capsule collider on parent Zombie_01. When I kill the zombie, my "Zombie dead" animation is played, Zombie fall to ground, but the ...
1
vote
1answer
93 views

undetected colission

I'm doing a simple grid based game, where the player should only be able to move on the grey cells. It works quite ok, but in this simple scenario, the player is able to walk through Wall(1), although ...
1
vote
1answer
30 views

Fixing collider for existing scene

I'm trying to add collider to the 3D scene. I have added mesh collider to the floor but I see the character is still floating up when I play. How can I edit this collider. I don't see any edit ...
1
vote
0answers
121 views

Detect when any part of a collider leaves a trigger zone on Unity 3D

I've searched all over for a simple solution on this, and found posts as old as 2011, with a bunch of hackish ways to badly work this out. I want to detect when ANY part of a collider leaves a ...
1
vote
1answer
101 views

Unity3d How to add collider to borders

I have a box with a hole in it. Is it posible to add a collider only to the dark blue showed at the img? (But only at the borders, not a box collider. Let's say i want some object to get in the box, ...
0
votes
1answer
99 views

How to change music from room to room?

In Unity 2019.3.0a2 I have a labyrinth with multiple rooms. I want the music to change when I get from one room into another. How can I do it so that music from room 1 is only hearable in room 1, and ...
0
votes
2answers
156 views

Nestling into contact with a group of physics objects without exerting forces on them

I'm making a pool game, and would like the circle (imaginary) to be in contact with the table and balls, and to fit perfectly as a ball would. Now I thought I would use Rigidbody and lerp the ...
0
votes
1answer
117 views

How to know which child collider triggered in parent?

I have parent object with 3 children. Each children has one collider (BoxColliders actually) marked as triggers each one. I want to know in a OnTriggerEnter on the parent side which collider was hit. ...
0
votes
1answer
46 views

How do i prevent my player from walking through mesh collider

I have a character being moved using rigidbody.moveposition and I have an floating lowpoly island with a mesh collider. When my player walks into a steep slope or a wall, it passes right through. I ...
0
votes
1answer
68 views

Unity: How many Raycasts per Sphere Collider?

I understand that a simple sphere collider in Unity is a raycast in all directions with a certain length. How many Raycast events does a sphere collider trigger? At what degree increments are the rays ...
0
votes
1answer
51 views

How can I determine when colliders of two gameobjects touch one another?

I stop gameobjects from colliding with one another by having box colliders around the gameobjects with dimensions bigger than the gameobjects. It works fine, but I want that when the gameobjects ...
0
votes
2answers
25 views

how to modify multiples BoxCollider on a same game object?

I have an game object with multiples BoxCollider attached to it, is there a way to get all the BoxCollider to an array so that I could modify their value individually ?
0
votes
2answers
41 views

Unity collision help

So my problem is this: I have a block, which is used as a "pointer block" to show where a block will be spawned. It will be green if it isn't colliding anyone, meaning you can spawn a block. It gets ...
0
votes
1answer
70 views

Check If a 2D Collider Is Completely Inside / Outside of a Polygon Collider

How can I check if one 2d collider (circle, capsule, polygon etc.) is completely inside / outside of a polygon collider?
0
votes
1answer
51 views

How can I add different colliders to each body part of a character in Unity?

I have been using unity game engine for about two weeks now. And I'm very interested in 3D game development. I have been learning basics of Unity and third person games. I saw many tutorials about ...
0
votes
1answer
26 views

Large gap between the grabbed game object and controller

When i grab a gameobject, there is a gap between them. I have tried changing the scale of the colliders, tool handle position from global to pivot but nothing worked for me. Should i reset the pivot ...
0
votes
1answer
267 views

Unity Hit Collider GameObject is Null when Collider is Child (Line-of-Sight Detection Problem)

I'm creating line-of-sight code in Unity. It allows a radar to check whether it can see an object, or whether the object is behind an obstacle (a collider). Similarly to Unity's suggestion, I check ...
0
votes
3answers
117 views

How to add collision to this script in Unity

I Want to be able to have collision were my player can't go through objects with colliders un Unity but I don't know how to make that happen, can you please help? ...
0
votes
1answer
164 views

Resize rigidbody in runtime, Box collider OnTriggerEnter not work

Scene setting: Object A: Rigidbody, kinmeatic Box collider, is trigger true. Object B: Box collider, is trigger true. Script is on Object A: ...
0
votes
1answer
65 views

Unity - OnTriggerEnter & OnTriggerExit strange behavior

I am having a trouble with OnTriggerEnter with a lot of objects. I have a NavMeshAgent moving randomly throught the scene, then I have a sphere collider inside a children to detect nearby objects. If ...
0
votes
1answer
766 views

How to give individual tiles their own collider in Unity's tilemaps?

My floor tile is a 2D drawing of a 3D platform, for lack of a better description. I want my player character to stand not on the top of the tile but a little inside it, as the red circle does in the ...
0
votes
1answer
332 views

Can I test collision inside an edge collider area in Unity?

I draw a triangle with the edge collider2d and I want the player to make an event when he reaches this area, so I set the collider as a trigger and, I used the OnTriggerStay2d function in my code! ...
0
votes
1answer
61 views

Trouble with assigning a model's own mesh to a mesh collider in Unity

I'm trying to use a mesh collider on the player's avatar, rather than the box collider. I've added the mesh collider to the game object (which also has a rigid body) and selected the "convex" ...