Questions tagged [collider]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1
vote
1answer
14 views

Collision objects aren't preventing falling in Unity

This is a super basic question, but I have absolutelly no clue why there is no collision and the player continues to fall. Im following FreeCodeCamp(minute 37:20). This is what I have: What is ...
0
votes
1answer
51 views

Show colliders in a build game in Unity

Is there a way to show all colliders 2D in a a released game at once? I am making a 2D game in Unity and have to show all colliders to the player. Can I use Gizmos?
0
votes
0answers
19 views

Unity: how to make a kinematic rigidbody react to a rigidbody hitting it?

How do I make a non-kinematic rigidbody react to a "normal" rigidbody colliding with it in Unity? Like when the rigidbody hits the non-kinematic one, it pushes it back (note: not using the ...
0
votes
1answer
19 views

how to add overall collider to a bunch of circles or boxes?

I have 3 circles (2D) they all have circleCollider2D. what I want is to make a collider that make border around them. I can't express which type of collider I need, so I put example image below. Red ...
0
votes
0answers
13 views

Automatically create capsule colliders from bones?

I have tried to automatically generate capsule colliders from bones by temporarily creating a mesh collider and using raycast to find the distance to it from the bone, but when I create the capsule ...
0
votes
1answer
60 views

What is an alternative solution to the problem of polygon collider2D not following character (animation)movement?

A 2D game and a bird's eye view of the character. This character, who has a knife in his hand, swings the knife by waving his arm, just at this time, I look at "polygon collider2d" from the ...
1
vote
1answer
258 views

Firearm magazine ejection

I am playing around with a VR game where the player can fire a hand gun. When the magazine is empty they can press a button on the controller to eject the magazine from the gun. As its VR, I would ...
0
votes
2answers
19 views

Detect what object was dropped onto, rather than the object being dragged

I want to make a simple drag and drop system in 2D in Unity. When the user drags the object to a position, I want to check if the position is valid. As in I want the user to drag an object onto ...
1
vote
0answers
28 views

How can I make this motion collide against a wall

EDIT I've actually commented out the motion in my code and adapted it to try reproduce this post.After a chat with @DMGregory he told me to use velocity reflection but as you can see in the following ...
0
votes
0answers
36 views

HUGE 2D worlds in Unity (like spaceflight simulator)

I am a beginner in the field of game development and I am having some doubts regarding some stuff... I am trying to build a 2D space-rocket-orbit game like the Spaceflight Simulator and I'm not able ...
0
votes
0answers
78 views

How to use Transform.lossyScale in a local reference frame?

According to the Unity docs for Transform.lossyScale, this attribute is "The global scale of the object". From what I can tell, this isn't actually an estimate of the scaling aligned with ...
-1
votes
0answers
23 views

RigidBody player is moving through floor upon MovePosition

Movement Code: ...
0
votes
0answers
9 views

one collider for 2 combined object

I have an obstacle that composed of 2 game object, but when the player collides it, it gets in OnTriggerEnter twice when the obstacle have 2 different collider, which is what it should be, of course. ...
0
votes
0answers
58 views

How to detect ray cast collision on terrain gameobjects?

I made a script were an objects shoots a ray cast facing on the vertical axis and detects were the terrain is and then moves to the current terrain height wherever it is. This is so I can spawn an ...
0
votes
1answer
118 views

Scope of 'this' - Cannot read property of undefined in collider and overlap function

I am working on my first 2D game with Phaser 3. I have set up VS Code with a node.js https server and run it to deploy the game on localhost. While the game gets compiled successfully and deployed, I ...
1
vote
1answer
69 views

How big can/should wall colliders be?

Following my previous question, I now have my wall collider building tool and built many of them: Bird-view, about 17 walls selected, on the right, one is selected: Here, wall and barriers form a ...
1
vote
1answer
67 views

How could I simulate projectile collision agaisnt RTS units with primitive colliders?

For example, humans are easy they are just capsules. But for cavalry, an arrow could hit the horse or the rider. Right now cavalry are also capsule colliders for unit-unit collision, but for ...
0
votes
1answer
38 views

How to best apply colliders on a rough 3D shape

I have a 3D model for a level in unity. I want to add colliders to it. What is the best type of collider for this model? And,it is 3D
0
votes
2answers
57 views

Rigidbody not working properly

I have two objects: a player and a wall. The player is passing through the long side of the wall but it collided with the short side of the wall. I want the player to collide with whole wall. Here is ...
0
votes
2answers
38 views

Position of Gameobject Changes When Hit Play Button

I have a 3D Humanoid model. When I press play button, suddenly position of model changes and collider doesn't match with model.
0
votes
2answers
48 views

Coins are solid objects and I can't collect them

I am just starting out with Unity following along with this video, and I am stuck at roughly 1 hour and 54 minutes in: https://www.youtube.com/watch?v=pwZpJzpE2lQ It is worth noting that the video ...
0
votes
1answer
38 views

RaycastHit2D.point is acting weird when used with circlecast2d

When I make circleCast2d intersects with another circle collider, I get a RaycastHit2D.point that doesn't point at the tip of ...
0
votes
1answer
25 views

Is it possible to prevent the collider 2D outline from hiding in Unity?

Is it possible to prevent the collider 2D outline from hiding in Unity? I am creating some animations in Unity. To create animations I select different parts of a hero and move them frame by frame. ...
0
votes
1answer
32 views

Sphere - AABOX Edge detection

I am trying to implement a particle-AABOX edge collision, the below images represent, two timesteps(dt) where the spherical particle is accelerated by gravity. I have the particle center C and its ...
0
votes
1answer
25 views

Applying velocity to parent that ignores children's mass not working

I am making a VR data visualisation app in Unity and I have a parent with many children (just some primitive cubes) that I can toss around the scene by just setting the parent's rigidbody to the same ...
1
vote
1answer
130 views

Is it possible to somehow change the collider points to match sprites during the animation in Unity?

Is it possible to somehow change the collider points to match sprites during the animation in Unity? I am using the Unity built in animtion recording feature. I would like to change the points of some ...
1
vote
3answers
845 views

How to Make Border of 2D Game in Unity

I have a border by default. But, I'm having trouble detecting if my object collides with the border. I am looking for efficient ways to do this, and I am not sure what should I use. I thought using a <...
0
votes
1answer
271 views

Character falls through the Platform Effector 2D in Unity. How can I fix it?

Character falls through the Platform Effector 2D in Unity. How can I fix it? Here is the demonstration: https://imgur.com/G5YkTxa. I tried changing the Edit - Project Settings... - Physics 2D - ...
1
vote
1answer
125 views

How can I jump down from a platform in Unity?

How can I jump down from a platform in Unity? I use two 2D colliders: one is my character, another one is platform. These colliders allow my character to stand on platform. Now whenever a characters ...
0
votes
0answers
16 views

Circle collider wheels push through polygon collider car chassis

I'm trying to create a simple vehicle and make it run on a terrain (from sprites + PolygonCollider2D). I imported a chassis sprite with ...
0
votes
0answers
23 views

Endless runner character stops moving unexpectedly

I've been trying to make an endless runner game in Unity in which a player moves forward automatically and can move from x to y axis while still moving forward. I do not know how to program so I used ...
0
votes
1answer
524 views

How to align the Polygon Collider 2D in Unity to match the position of Sprite?

How to align the Polygon Collider 2D in Unity to match the position of Sprite? I have a game object. It has a Sprite Renderer with an image. Now I add a Polygon Collider 2D component to the game ...
0
votes
1answer
69 views

Why isn't my tilemap collider appearing?

I am trying to make a 2d game but my player falls through the tilemap every time. My tilemap collider doesn't seem to show up. What is going on and how do I fix this? The first image is rigidbody ...
0
votes
0answers
58 views

Unity: Have raycast penetrate through other colliders/triggers

I have a setup where an enemy prefab has a trigger box that is in front of it: Box and enemy itself is in the Enemy Layer. Now I want to project a raycast to the Player, which is in Player layer. [![...
0
votes
0answers
10 views

Sync Collider size with bones in model

I'm setting at runtime a BoxCollider2D size by taking the difference between the Y position of two bones on the model... but the size I'm getting out of this ...
1
vote
1answer
45 views

Why does my collider behave strangely after a coroutine

So I'm trying to create a simple script that is going to handle the logic for cutting down a tree I'm experiencing some strange behaviour with my script. I have a private field which holds the "...
0
votes
1answer
58 views

How to prevent an object with high velocity from passing through a collider?

Consider a simple 2D platformer. I have a BoxCollider2D on the player object and a TilemapCollider on the ground below(grid). I ...
0
votes
1answer
188 views

Two Colliders on the same GameObject for different purposes

I'm somewhat new to Unity and am trying to build a battle system. Right now, I have an attack that checks collisions with enemy objects like this: ...
0
votes
0answers
69 views

Collider inside another collider: Move the brain via mouse while being able the click the spheres

The spheres have a sphere collider on them and are clickable via this script:Clickable.cs ...
0
votes
1answer
28 views

Collision with supposedly aligned box-colliders

I am quite new to game development, and I am trying to create a top-down game with 2D sprites, but with a 3D feel to it. I managed to do so with the 2D engine by setting ...
0
votes
3answers
648 views

Jittery collisions in Unity 2D

I tried to implement a simple movement to my object. My object moves perfectly fine but I'm having issues with its collision. When I keep on moving object towards the obstacle/ground, collision are ...
-1
votes
1answer
35 views

How would I detect a collision between a rigidbody and a static

I have an object with a rigid body. How would I go around detecting collisions between this object and any other object with a collider on it? I know you can enable/disable collision detection (https:/...
0
votes
0answers
332 views

(Unity) how to write my own raycasting functions

I am making a game in curved space in Unity and I am trying to figure out the best way to handle raycasting. For my purposes the Ray struct doesn't carry enough ...
0
votes
1answer
207 views

Tetris block kinematic rigidbodies pass through one another with Transform.Translate

I am trying to build a Tetris 3D game in Unity but I am stuck at getting the different blocks to interact (to detect each other, to sit one on top of the other rather than going through each other). I ...
0
votes
1answer
275 views

Check if 2 objects with multiple colliders overlap using bounds

I'm writing a script which instantiates buildings in a scene, but in such a way that 2 buildings don't overlap with each other. Every building consists of approx. 10 parts, of which each has a box ...
0
votes
1answer
466 views

OnCollisionEnter2D not working

I am fairly new to Unity2D and am making a 2D platformer to get used to the engine. I am trying to create a platform that moves when the player jumps on it, however, on the script for the platform the ...
1
vote
1answer
350 views

Problems with gravity and box colliders in Unity 3D

I have a game character that can jump or roll in order to avoid obstacles. He is able to roll while on the ground and he can also roll while he is in the air after jumping. Everything was working fine ...
1
vote
1answer
127 views

Why is my player spinning after a collision?

I've made a very simple 2D top down prototype with Unity. This is the code I use for the player: ...
2
votes
1answer
81 views

Making pickup objects with gravity that won't push the player on collision

I am trying to create pickups, that appear after an enemy dies, and that the player can pick up, but I am running into some issues. First of all, I want the pickups to be affected by gravity, so I ...
0
votes
1answer
52 views

Which collider to use on "island" situation?

I have a 2d-top-down-unity game where the player is on an island. The shape of the island is random generated and he is not able to "escape" from the island. So which Collider should I use for ...