Questions tagged [collision-detection]

Collision detection is the determination of whether or not two or more entities make contact with each other during gameplay.

Filter by
Sorted by
Tagged with
4
votes
1answer
291 views

Making a wrapping wire (like the Worms Ninja Rope) work correctly with moving geometry

I have implemented a 2D wire like the one described in this question which is made up of straight line segments between wrapping points. However, while the algorithms described in this answer work ...
0
votes
0answers
73 views

Pygame Mask Doesen't Detect Collisions

I'm trying to make my game's collisions with masks. I have 6 masks but only 2 works. My code is: ...
0
votes
2answers
152 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
0answers
23 views

Collision2D on sprite child (sword of char) does not detect collision on tag == enemy

Problem is in the title. The sword sprite is a child of body which is a child of my char. Sword and Char have collider and rigidbody, and if the char and enemy collide, it works. But it does not ...
1
vote
1answer
61 views

How to prevent/“reverse” displacement from a collision?

In my game I can throw a hammer. The hammer moves based on physics in Unity. The hammer destroys the first object it touches. I want it to continue moving as though it didn't touch anything when this ...
0
votes
1answer
46 views

Why do my objects with colliders go through each other, and how do I fix it?

I am new to Unity and I am just experimenting with a player controller script (which I got off youtube) and another object which doesn't move. Both my player and the stand-alone object have colliders ...
0
votes
0answers
99 views

Box2D with SDL2 not working properly (Collision without rotation and problems with MKS)

I already have some expirience using SDL2 so I thought I will add a Physic Engine to my game - I chose Box2D. I managed to setup everything and to build a small program using SDL2 and Box2D. But now ...
0
votes
0answers
32 views

Odd Behavior with Simple Collision Detection Between Moving Objects, Rectangle Method

Solution Update After tinkering around a bit, I noticed that my bounding boxes were not updating in accordance with the movement of their respective objects, so it struck me that I should put the ...
1
vote
1answer
200 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
0answers
23 views

Unexpected collision between two gameobjects [duplicate]

I can't find out why my Cube gameobject sometimes collides on transition right between two gameobjects (blocks), which are the same height, material and so on. See the gif below (note, the colors are ...
1
vote
0answers
109 views

Where and how should I check for collision in multiplayer game?

I'm making a multiplayer game. For now, I added a script to towers and I have booleans to change using OnTriggerEnter. When triggered, client sends a message to server and towers health starts to get ...
0
votes
0answers
32 views

Unity3d:Detect a collision between an image and a sphere

So, I just realized, an image with BoxCollider2D wont detect any collision with Sphere with <...
0
votes
1answer
44 views

How to make character not enter the platform when colliding on the side with the platform?

I had a problem with detecting my character's collision with the enemy being detected in 2 ways: side by side when it (character) jumps into the enemy's head. I imagine it to be basic, so I figured ...
1
vote
0answers
44 views

Problem with collisions detection on canvas platformer

Having a lot of trouble with my collision detection in my platformer. If you go straight to the right the block will float. Also the corners let the block sink right through and the walls are sticky. ...
1
vote
1answer
50 views

Is there a name for this algorithm for 2d shape collision?

A while ago I was considering my possibilities for implementing collisions between 2D shapes, and after much googling (which mostly turned up SAT), I came up with this: ...
3
votes
1answer
48 views

Creating a victory zone / Count units inside zone

So I am attempting to create a zone implementation where if the amount of units with a certain tag exceeds the number of units with another tag an objective will be captured standing in the zone will ...
0
votes
0answers
114 views

How to create polygonal or elliptical colliders by python tkinter?

I am developing a primitive game by python tkinter (I use canvas). It's not a big project. It's only my own self-challenge to create a game using only tkinter and standard python libraries. My problem ...
1
vote
1answer
161 views

Monogame - Collision not working and invisible walls

I have recently been experimenting with Monogame and XNA (moving from Gamemaker) and decided to work on a simple collision system. Problem is shown in the GIF. Main Collision Each entity (Quick name ...
1
vote
1answer
47 views

Find the co-ordinates of collided objects in Python

I have a group containing my aliens and another containing the bullets I have fired. When I detect their collisions, I want to pull the alien's x-y co-ordinates during it's deletion so I can put an ...
0
votes
1answer
75 views

How do I use trigger colliders in Unity?

I am trying to create a "Fruit Ninja" style game in Unity in VR. I have a BoxCollider on my sword set to "Trigger" and I have some "fruit" objects coming towards it. I then have this function: ...
1
vote
1answer
254 views

Unity Colliders - How do I detect nearby objects without my detection ranges detecting each other

How can I get both colliders' types in a trigger overlap message like OnTriggerExit2D(Collider2D other)? Example: ...
0
votes
0answers
54 views

Collision detection - formula for getting intersection point

I need help with collision detection algorithm from this paper: http://www.peroxide.dk/papers/collision/collision.pdf I assume I am colliding with sphere of radius 1, just to make everything not ...
0
votes
1answer
27 views

Gameobject stops moving or gets stuck when colliding with another GameObject

I'm currently making a brick breaker style game. My issue comes when the ball is launched off the pad it gets stuck in between two blocks. I have all the blocks on a "Foreground" layer with an "Order ...
0
votes
1answer
103 views

Unity Collider2D - Know the collider type ob the object collider with the other object

I have my GameObject which represents a soldier in my game. It has the following colliders: 1st BoxCollider2D in child named "sword". Is Trigger checked. Tag = Sword. This collider is enable when ...
1
vote
1answer
76 views

Voxel traversal for parabolic projectile arc under constant gravity

For linear polynomials, there's a bunch of algorithms for efficiently determining which voxels to test for collision (eg. A Fast Voxel Traversal Algorithm for Ray Tracing ). I'm having troubles though,...
0
votes
0answers
396 views

Can I detect collision on specific collider?

I'm a beginner with Unity and I'm developing my very first 2D game. My game character needs to have an automatic right/left movement but I'm struggling with the colliders on the walls (I made a ...
-1
votes
1answer
150 views

How to make player land on platforms more than one in pygame

I'm trying to make multiple platforms (blocks) on screen on which player can jump and land on it. When I just keep only one block, player jumps on it and land easily. But when I create other platform ...
0
votes
0answers
40 views

Check whether an object is fully inside/overlapped by other objects in Unity3D?

I have structures made of voxels (cube gameobjects), and I want to make complex structures from them. But I don't always want to place them on the grid. I want them to be more realistic, like ...
3
votes
3answers
2k views

Unity Round(Circle) Buttons

I have been using unity and C# scripting now for the past 2 or 3 weeks. So yeah i am very new to unity and C#. I wanted to know if there is a way to make a round(circle) button without using the ...
0
votes
0answers
69 views

something very strange in one of the collisions with OpenGL 3.3

As some of you know, I'm developing a game engine in C, and I came across a problem that left me kind of lost. When I was developing my collision system, I saw something very strange in one of the ...
0
votes
1answer
410 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
193 views

Sebastian Lague 2D Platformer Controller 'Continue' Problem

In episode 10 of Sebastian Lague's "[Unity] Creating a 2D Platformer" series, he creates a jump through platform by using "Continue;" in his vertical collisions script. This worked great for a jump ...
0
votes
1answer
85 views

Error detecting collision with another instance of the same actor?

I have a project where after a certain time interval 2 NPCs are generated in different locations on the map. Each of them collides with a collision box that defines its "class" (red or blue): When 2 ...
1
vote
1answer
140 views

Minimal, unrealistic physics engine

I'd like to prototype a game with custom, very simple physics. Something similar to older games, anything from Super Mario to Quake 3 Arena. I'd prefer to avoid realistic physics engine because they ...
0
votes
1answer
31 views

Does collision detection data structures require a manifold mesh

Is it possible to apply spatial split techniques (oct-trees bsp-trees, etc) when meshes are not necessary manifolds? The mesh in question represents the "map". This means that it is static so spatial ...
1
vote
0answers
114 views

C# 2D game collision detection huge problem

I'm making my first game using C# and Monogame and I have a huge problem with collision detection. The entire code is in a link below: My game code So, I use Vector2 to keep position and dimensions ...
0
votes
1answer
159 views

Capsule to Sphere Collision

For my Maths unit at university, we have to manually calculate if a sphere is colliding with a capsule collider. The information I have to go with is this; You have the following Sphere: LadyBird3 -...
1
vote
1answer
132 views

What technique can I use to animate interaction between tiny objects in a sim game?

In simulation games like Sim City and Factorio, there are numerous interaction between tiny objects that needs to be animated. e.g. random people walking on the sidewalk, then waits for a bus, then ...
1
vote
1answer
69 views

How to make object that moves with constant speed not overshoot the object it collides with?

To learn LOVE2D I am creating a simple project. Player moves the square with arrows keys until it hits the goal square, at which point the game is won. ...
1
vote
1answer
807 views

How to detect collision direction in Phaser 3

Please consider this scene. Developed using PhaserJS 3. I want to make the slider move left when the player touches the right hand side of it, and move right when the player touches the left hand ...
1
vote
1answer
90 views

Should your world map have it's own collision object?

I am attempting to understand collision detection at the moment. I have seen many examples of a simple flat plane with boxes or cubes which move around on the plane and react when the touch each other ...
0
votes
2answers
187 views

Problem Implementing SAT Collision in 3D, OBB vs OBB

I am trying to implement SAT collision detection between 2 OBBs, however, I am getting a lot of false positives, can anyone help me figure out what I am doing wrong, thank you in advance. This is my ...
0
votes
2answers
591 views

how to detect touch on instantiated prefabs in unity

I have instantiated objects (that have collider2D attached) in a grid of 9x13. Now I want to detect a touch on each object ...
-1
votes
1answer
423 views

Detecting collision between 2 rotated rectangles with limited parameters

Are there any function that can detect collisions between 2 rotated rectangles in javascript with this kind of information: ...
1
vote
2answers
257 views

Efficient collision detection of sphere with wall

I'm building a first-person game where up till now the player has been represented as a dimensionless point; this makes collision detection really easy, as I can just cast a ray along their velocity ...
0
votes
0answers
35 views

Update movement actor with collisions in 2D game

I have the algorithm for moving an actor. The actor has: 4 states: Stay, Move, Jump, ...
0
votes
0answers
22 views

Collision Checking in Unity immediately after instantiation

I'm working on a dungeon generation script and I'm having some issues detecting overlap. Each piece that I spawn has attachment points, with rotation values and an offset amount so things lineup ...
1
vote
1answer
62 views

How to fix Corner Collision with SAT algorithm?

I am making a platformer game, my way of handling collision works most of the times, but when I jump on a platform's corner I get pushed away, it probably happens because my function returns right or ...
0
votes
3answers
110 views

Stop checking for the same collision

I am creating a JavaScript game that is currently implemented as follows: Run a game loop Check for arrow keys pressed When arrow is pressed, calculate the new player coordinates if new player ...
1
vote
0answers
178 views

Aligning a sprite with a tilemap

I'm trying to create a hybrid system for my Unity game. I want to use tilemap for collision and use sprites for the world. I drew a sprite onto a 40x40 checkerboard grid as can be seen here. I wanted ...

1 2 3
4
5
45