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

learn more… | top users | synonyms (2)

0
votes
1answer
42 views

Using Physics.Raycast inside OnCollisionEnter2D function

void OnCollisionEnter2D(Collision2D collision) { foreach(ContactPoint2D contact in collision.contacts) { RaycastHit raycastInfo; ...
0
votes
0answers
13 views

Tile map collision C++, SFML

My problem with the collision here is more to do with how to decide which tile the player is in. Each quad of the map is 16 pixels squared (Vertex array), and the player moves in 1 pixel jumps. ...
1
vote
1answer
33 views

How to detect collision position and that position's texture color in Unity?

I have a prefab and I use Circlecollider2D for physics operations. I want to detect the color of the contact position of the collided objects ? Is is possible by using Unity's collider classes ?
4
votes
0answers
55 views

How do I check for collision between transparent textures?

I am creating a 2D game using OpenGL. For sprites, I use textured quads (actually two triangles). The texures contain transparent pixels, since objects are not always perfectly rectangular. How do I ...
1
vote
1answer
41 views

Clip shadow frustum to scene bounds

I have a global light in my scene. It casts shadows using shadow mapping and has an associated camera (for rendering to the shadow map). I'm going to refer to it as my "shadow camera" from now on. I ...
-1
votes
0answers
21 views

platformer side movement collision problem [duplicate]

I making a game in javascript and I'm stuck, the player will stop moving if he hits the left side and if I move left a little bit and try to move right again I cannot. My question is: Whats wrong ...
-3
votes
0answers
31 views

How To Detect Collision With Coins [closed]

I want to know how to give the player plus 1 point every time the player collides with that a certain object. Every time the object is collided with, it will at on to the previous amount. Example: if ...
1
vote
0answers
33 views

Efficient Collision detection for polygons (fleet) in an RTS

I'm trying to make an RTS for android using libgdx. I would like to have collision detection to be able to detect ships inside the range of weapons and collision between my bullets and the ships. So ...
1
vote
2answers
48 views

How to make sure that when two bodies collide, there is only one collision detection on box2d?

I'm using LibGDX with box2d, and when to bodies collide collision is detected multiple times. here's the code `public void preSolve(Contact contact, Manifold oldManifold) { Body a = ...
0
votes
1answer
24 views

How do you set multiple collision rules with Swift and SpriteKit?

So basically I've got 2 types of balls and 2 types of enemies. Green can delete red only, red can hit delete only. Here's what I have for the first collision test: func didBeginContact(contact: ...
1
vote
0answers
19 views

Implementing Separating Axis Theorem to Detect and Handle Sliding Collisions

I am having a bit of difficulty detecting collisions properly with separating axis theorem. My code seems to be giving a lot of false alarms. Also, I've looked into implementing sliding collisions ...
2
votes
2answers
29 views

Detect collision that happen between frames, between slices of moving, rotating circles?

To detect a collision between two circles, we check if the distance between their centers is smaller than the sum of their radii. To detect a collision between a slice (in this case half) of a circle ...
0
votes
2answers
45 views

Efficient Collisions Iteration?

My project has upwards of 3000 2D objects but not all of them collide with each other. Between each object that can collide, a CollisionPair is created and stored inside a flattened array. Currently, ...
4
votes
2answers
613 views

Wall detection in maze game - On the fly or precomputed?

I've been a programmer for over a decade, professionally for the last five years, but I've never really done any games programming. I've had a look at some tutorials but most of what I've found is ...
0
votes
0answers
17 views

Libgdx polygon ratating

I'm using polygons for collision detection. Here is the code: poly = new Polygon(verticies); poly.setOrigin(100,100); poly.setRotation(45); renderer.setColor(Color.GREEN); ...
-3
votes
1answer
40 views

Collision detection console log errors?

So the code down below is supposed to load the next scene once the player touches the flag which the code is attached to. I've made sure that is trigger is checked and yet I'm still getting errors ...
0
votes
1answer
40 views

How do I have different colliders against different objects? Unity

Say for example I have a ball, I want the sphere collider to be a certain radius when it comes into contact with one material (material A in diagram) and a different size when it comes into contact ...
0
votes
1answer
38 views

LibGDX - Tilemap Wall Collision Detection Issues

I cribbed some code from another web tutorial (SuperKoalio - https://github.com/libgdx/libgdx/blob/master/tests/gdx-tests/src/com/badlogic/gdx/tests/superkoalio/SuperKoalio.java) about detecting a ...
0
votes
1answer
15 views

unity onCollisionEnter does not work

I know this question has been asked several times but none of the answers solved my problem. I made an sphere and gave it rigidbody. then I draged the sphere on to a new made prefab. on mouse-click ...
1
vote
1answer
53 views

Voxel terrain collision detection with AABBs

I'm working on implementing collision detection on voxel terrain (Like Minecraft) with AABBS. Right now, I have it so I can tell if a point is within a voxel or not, I do this by having a 2D byte ...
3
votes
1answer
88 views

Is it really necessary to test collisions against triangle vertices and edges?

I'm reading this paper, and using it to perfect the narrow phase collision system for my game engine. To make the question as self-contained as possible, the essential strategy used to detect ...
-1
votes
1answer
84 views

How to optimize my movement & collision code?

I am trying to implement movement & collision the simplest way possible. public void MovePlayer() { KeyboardState keyState = Keyboard.GetState(); Vector2 checkVec = ...
1
vote
1answer
38 views

Is my collision-free location script working?

I've recently been learning C# and I wanted to take one of my 2D tutorials to Unity. I reached a step where I need to spawn my new sprite into a collision free location. I've followed direction - ...
0
votes
1answer
61 views

LibGDX obstacle collision

How can I handle collisions with obstacles in LibGDX? Is there any automatic way to stop the character's movement when it collides with a wall or I have to constantly poll for all the possible ...
1
vote
1answer
20 views

How to iterate a sprite group correctly in Pygame avoiding “maximum recursion depth exceeded”?

I'm making a game and I have almost finished it, but I'm usually finding the error RuntimeError: maximum recursion depth exceeded when I iterate a sprite group. This is an example and the group is ...
2
votes
1answer
35 views

Platformer Collision in javascript

Hi im making a platformer in javascript and this is the collision function that I have if(obj2.y > obj1.y + obj1.height || obj2.y + obj2.height < obj1.y|| obj2.x > obj1.x + obj1.width ...
3
votes
1answer
123 views

Half top-down view collision and mechanics

I'd like to create a game with a half top-down (2d RPG) view (I don't know the exact name of it). It would be 2d, but I'd like to add 3d-like collisions. For example: If the grenade lands on the ...
-1
votes
1answer
45 views

Getting stuck going left with tile based collision detection [closed]

Thanks to Alexandre Desbiens I have awesome collision detection. I can just slide right along walls. However if I try to go left into a wall I get stuck. But the good news is I can just back out and ...
3
votes
1answer
153 views

Roguelike 2D Collision Detection

I'm just a normal guy trying to do some basic collision detection but I suck at it. I either get stuck in a wall or I go in reverse in the wrong direction trying to update the player position to a non ...
0
votes
1answer
24 views

Collision problem JBox2D

I work with Processing and the JBox2D library and wanna code a new Ping Pong game. But if I move the player to the top border (or lower border), he collide on a wrong position. The picture shows ...
2
votes
1answer
53 views

Java: Problems with Tile Collisions

I have created a tiled map using a BufferedImage (img) from a PNG. From that, I would like to detect the player's (peter) collisions with individual tiles on the map. However, my code will not run and ...
1
vote
1answer
45 views

Best way to deal with Collision in JavaFX

This question I'ts no exactly a fix for the current game I'm working on, but I am showing it as an example to explain my problem. I just want to know the best way to handle collision in JavaFX. My ...
1
vote
0answers
57 views

AABB collision resolution issues

I'm trying to make a character collide with some tiled terrain. I have an issue with the collision resolution, and after days of shooting in the dark ant not finding any relevant help online, I'm no ...
0
votes
1answer
38 views

Libgdx Platform collision problem

I am trying to come up with a collision function where all the cases are made. If the player (Who's hit box is a circle) collides with a platform (hit box is a rectangle) from the right the ...
-1
votes
1answer
19 views

Java-script map/array “undefined” [closed]

Hi when I call the the function below in the chrome console it tells me "Type error cannot read property '2' of undefined" why?. defining the map: var map = { FALL:[ [0, 0, 0, 0, 0, 0, 0, 0, 0, ...
0
votes
0answers
49 views

Simple Bullet Physics Collision Detection

I've been looking into bullet physics a lot here lately to handle my collision detection. I was using XNA collision but once I started to implement momentum into my physics simulation true and false ...
-1
votes
1answer
54 views

Adding obstacles & collision to canvas game

I am trying to add some obstacles to the canvas game that I've got but something seems to be wrong and I can't seem to put my finger on it. I just want some simple walls here and there to make the ...
0
votes
1answer
39 views

Swift - Why does my SKShapeNode pass through an object, pausing briefly beforehand?

The code below when run on a device that’s flat on the table shows a red circle (the 'ball') and a line. When I gently tip the device the circle moves towards the line. When it reaches the line, it ...
0
votes
0answers
64 views

How can I detect collision between two objects

I have some code that when I click on an object with my mouse it will change it to another object. I'm using this code to change an object into a shattered version I made of it for destruction ...
1
vote
0answers
28 views

Collision detection with PyGame

I have been making a 2d platformer using Python with PyGame. It has all be going good, but I have stumbled accross many problems with collision detection. Here they are: You can't go through objects ...
1
vote
0answers
45 views

Entity to tile collision detection (C++, SDL)

I'm currently trying to handle collisions between entities and a tilemap, but I've hit a problem. My tiles are stored simply as integer tile IDs in a multidimensional array, and I wanted to perform a ...
-1
votes
1answer
26 views

Checking collision from below using OnCollisionEnter

Want to use OnCollisionEnter to see if there is a collision from below. void OnCollisionEnter(Collision other) { foreach (ContactPoint contact in other.contacts) { ...
0
votes
2answers
47 views

Ping Pong bat is not detecting the collision with the wall

I have been learning Unity for last couple of days. I want to make one simple ping pong game. The idea is simple. The game has a Sphere as a ball, a plane as ground, 2 rectangles as bats and 4 ...
0
votes
2answers
41 views

How to prevent the player from calling the Jump function if no collision is detected?

I am back once again. This time with a basic 2D platformer game. I would like to allow my player to jump but only if the ground bool checks as true. I would like to fix my script so that upon ...
2
votes
1answer
117 views

Creating a Collision Detection system [duplicate]

I'm currently working on 3D project (C++) and I have now come to writing the collision detection systems. Basically my question is regarding how to architect it. All the collisions are either ...
0
votes
0answers
57 views

My sprites do not always respect collisions in Pygame

I have a Player sprite (40x40 pixels) and Tiles (20x20 pixels) which build the terrain. At the 4 edges there are 2 rows or columns (depends on vertical or horizontal) of wall tiles. Those are the ...
0
votes
0answers
29 views

Proper Angled-Top Down Wall Collision?

Sorry about the vague title, it's kind of hard to say what I want to do in a few words. In my top-down game, I'm having a problem implementing proper collision for walls facing north (that is, you ...
0
votes
0answers
34 views

Detect which direction an object collides with another

so I am trying to implement a collision detection system. I'm only using rectangles, so it's not too complicated. My collision detection currently does detect if the 'player' object intersects the ...
4
votes
1answer
92 views

Torus World Collision Dection

I am looking for a collision detection solution for use when 2d screen wrapping. Specifically, when the image is split between the right and left side I can only detect a collision for a limited ...
0
votes
0answers
34 views

Advantages of “Overlap testing” and “Intersection testing”

I have been looking for advantages and disadvantages of both techniques, but I was only able to find a few disadvantages such as: Overlap testing may fail for objects moving very fast and Intersection ...