Questions tagged [collider]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
1answer
35 views

Unity get reference of GameObject under another GameObject

I am trying to get reference of the object underneath my Player. I don't know if I am aproaching this correctly. Right now, I have a player simply put in the scene, like this: Then I am trying to ...
0
votes
0answers
9 views

How to add Collider to a Line Renderer in unity? [duplicate]

I have created a semicircle using a line renderer, I need to add a collider to this so whenever enemy objects hit this they get destroyed, how do I do this. Current Code ...
1
vote
0answers
22 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) ...
0
votes
1answer
21 views

How to make a collider the follows all the animations of a prefab?

I have attached a capsule collider with my player(prefab) and made a script so that when Space key is down it does the jump animation in Unity. But because of the collider not jumping with the player, ...
0
votes
1answer
17 views

'Edit Collider' exits after every adjustment

When I click the Edit Collider button I can see the collider's region and the handles to adjust it. After every adjustment (with the mouse) the collider outline disappears as Edit Collider finishes. ...
0
votes
1answer
33 views

Space game scene boundaries

I've been trying to add boundaries to my space game. I've been following this tutorial with a sphere instead of a cube, but every time I start the game and move or rotate my ship it appears outside ...
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 ...
0
votes
1answer
82 views

Unity: Move Collider up stairs/ramps

The bots have a simple Capsule collider which cannot tilt. Movement is applied across the horizontal axes, gravity is enabled on the rigidbody. It moves up stairs okay with steps roughly 0.2 units ...
1
vote
1answer
150 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. ...
0
votes
2answers
82 views

OnTriggerEnter With First Person Controller

I'm working on an FPS for my first time. I'm creating a simple terrain and instatiating 15 cubes on my terrain. (This works fine). Each cube is named "cube" and has a static trigger collider. Here's ...
0
votes
1answer
80 views

How can I destroy trees when placing a building in an RTS?

I am developing RTS game. When I build buildings on the Terrain, any trees that were in that location end up intersecting with the building. I want to remove all trees from the building's footprint ...
1
vote
1answer
29 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 ...
0
votes
1answer
93 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
0answers
36 views

Rotating a vehicle to match a 2D slope

I have a vehicle that needs to move on a randomly generated terrain and handle slopes. I'm not using wheels, but instead moving the vehicle with velocity. The ideal case would be if I can make the ...
1
vote
2answers
182 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 ...
0
votes
1answer
136 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
0answers
57 views

My gameObject does not move, when it returns to its original scene

I have a map where I have a 2d Ship as gameObject, which can be dragged with the finger to travel between islands and do the corresponding activities, when the player finishes playing on the island he ...
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 ...
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
117 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 ...
0
votes
0answers
16 views

Making colliders for a user controlled stick held by character

I am making a game (Unity) in which the player controls a blind person with a stick. The stick is controlled by the mouse using the script ...
1
vote
0answers
152 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 ...
0
votes
1answer
65 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
53 views

MoveTowards object stuck with isTrigger Collider

I am trying to have a missile seek its target once it has entered the target's trigger. The code should be fine, I think it has something to do with how the colliders are operating. I want the blue ...
1
vote
1answer
83 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....
0
votes
1answer
351 views

How to transform Capsule Component in UE4?

The collision of the character with the environment only works correctly (in the eyes) when I use the original skeletal mesh. I tested it in the most varied sizes and it worked perfectly. It turns ...
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 ...
1
vote
1answer
717 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 ...
0
votes
1answer
49 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
0answers
84 views

Unity — Proper algorithm for a Character Controller that automatically fits mesh?

I'm trying to make an algorithm that will automatically generate a CharacterController component (on a parent-GameObject) which should automatically resize to whatever the current mesh size is. To ...
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....
0
votes
0answers
27 views

Is a simple PolygonCollider2D really worse than several BoxCollider2Ds?

In my scene I have very simple quadrilateral blocks, which I'm considering using PolygonCollider2D for. These blocks will be the building blocks of the scenery so ...
3
votes
0answers
59 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 ...
0
votes
0answers
15 views

Unity: finding force vector to separate colliders in OnTriggerStay events

In Unity, I have Trigger Colliders, and catch the OnTriggerStay(Collider other) events. Once two Colliders are touching, how do I get the Force vector to make them want to separate again? In the ...
0
votes
0answers
24 views

How do I transform from local points to world when using a scroll view?

I'm using a scroll view to store my game character icons (basically an RPG). The movement system for the characters is tile based, but in game hazards could be located anywhere. So I need to detect if ...
0
votes
1answer
292 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
121 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? ...
3
votes
0answers
104 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. ...
0
votes
1answer
173 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
72 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
70 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
862 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 ...
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
1answer
116 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
0answers
120 views

How can I get visually accurate collision normals with sphere collisions?

I'm solving simple 3D sphere collisions by checking the sphere for overlap with a mesh, finding the nearest point on that mesh's surface to the center of the sphere, and then resolving the collision ...
0
votes
1answer
291 views

How to know the point of collision with another object in Unity5

I have a small problem and it would be very helpful, which could guide me. What happens is the following, I have an enemy (evil usb) in my scene, to the collisionar this enemy with my main player ...
0
votes
1answer
204 views

Physics.IgnoreCollision not working right after invoked

When invoking Physics.IgnoreCollision in Unity, it seems work but it still have collision detection right after creation. I have this issue with ejecting empty case after gun fire, it's spawning ...
0
votes
0answers
379 views

Detecting collisions without rigidbody

I have a car with the following aspect: As you can see, colliders are locally static, because they are separated from the original rigidbody component. Well, as you can suppose, I have a problem, ...
0
votes
1answer
353 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! ...
1
vote
1answer
41 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, ...