Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [collision-detection]

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

0
votes
0answers
19 views

Item collision detection doesn't work

My GameWorld constructor has the following code inside it. ...
0
votes
1answer
58 views

How can I make collisions in a game similar to Mario 64?

I'm currently trying to build a kind of Mario 64 -like game (very simplified). The environnement of the game will typically be a bunch of triangles issued from a .obj made on blender. Currently I ...
0
votes
0answers
23 views

Calculating Damage from from object collision

I need to calculate the damage resulting from a crash of two objects. I found the formula of the resulting kinetic energy: E = m * v² / 2 I guess I also have to ...
0
votes
1answer
21 views

Collisions in other sides on pong in python

Im trying to create pong in python, so far Ive set up correct collisions on the right paddle but upon just trying to reverse the code to work with the other side it refuses to work, simply glitching ...
1
vote
0answers
23 views

OBB vs Frustrum collision detection

Some definitions: An oriented bounding box (OBB) is a rectangular block which can be represented in many ways, as a collection of eight vertices, a collection of six planes or others, for this ...
0
votes
0answers
51 views

How can I handle two collisions in the same frame?

My problem is that I have a player with collisions, and enemy can collide with players collision and execute Hurt function in players script. But the problem is enemies can overlap and can hit the ...
0
votes
1answer
14 views

I can't find a way to make my projectile gameobject collide with my ofscreen collider

so my code on my collider is as followed public class Collide : MonoBehaviour { ...
0
votes
0answers
18 views

Drawing ortho outline of rotated elipsoid

I'm working on a collision system for a 2.5D game, and I'm stuck on the sphereoids. As long as scaling x=y=z, and it doesn't rotate, I can just use an r^2 check, but I'm trying to figure out a way to ...
0
votes
1answer
18 views

Detect collision with bullet physics, to make a character controller

I inherited from btCollisionWorld::ContactResultCallback but I really have no idea how to use this virtual function: ...
0
votes
1answer
38 views

Can't get AABB Collision to work properly

This is the code I'm using to resolve collisions on the players left side. It works when I'm on the ground, but if I'm falling, it does not work. ...
-1
votes
0answers
22 views

LWJGL Java 3D Collision

I am trying to make a 3D FPS in java, but I am having a hard time with the collision. I tried multiple methods but none of them worked. The code is based on ThinMatrix's 3D engine. I want something ...
0
votes
1answer
70 views

SDL Sliding Collision

I'm working on a 2D SDL C++ project, and I'm having a bit of trouble with collision detection. Currently the player collides with the edges of the level and with the SDL_Rect objects in the level, ...
0
votes
0answers
27 views

Mirror effect on isometric map

I'm trying to make an isometric game with LibGDX and Box2D for collisions. The map and collisions lines are made in Tiled, but when transforming orthogonal coordinates to isometric with this code I ...
0
votes
0answers
33 views

How to get one KinematicBody2D to push another?

I am working in Godot 3, where my player is a KinematicBody2D. When I collide with a block which is also a KinematicBody2D I'd ...
1
vote
4answers
90 views

How can I convert Physics2D.Raycast to Physics2D.BoxCast to yield the same results?

This question has been updated to better reflect my current issue, and some of the progress made while solving it. I've been working on a 2D character controller that uses raycasting to detect ...
1
vote
0answers
28 views

Modding sprites in New Super Mario Bros. DS

I'm a New Super Mario Bros. DS modder. My goal is to create a custom sprite over an existing unused sprite. I checked in on fellow modders and they said theoretically, I could copy another sprite's ...
1
vote
1answer
42 views

How would I swap a character when a player touches a collider?

I wrote a simple script to attempt to do this and I created an empty game object and applied the script to it and dragged both of my sprites into my script and I receive no errors but nothing happens ...
0
votes
1answer
62 views

How is raycasting implemented

I know what it's used for, I know what it does. What I am essentially asking is what is the math/code behind how it works? I'm aware that any custom implementation would likely be slower than an ...
1
vote
1answer
73 views

2d side scroller slope physics and collisions

In old 2d games such as double dragon, streets of rage etc. where the player could move “up and down” on the y-axis to give an illusion of depth (as opposed to something like Mario) how were slopes ...
0
votes
2answers
112 views

How do I implement efficient collision avoidance in 100 enemies

I am developing a libgdx game. It is a top down shooter and I am trying to make a good AI. I have tried to implement A* from the AI library from libgdx and it works fine but when i have a lot of ...
0
votes
1answer
84 views

How to check for mesh overlap?

I'm creating a level editor in Unity. I need to detect when an object is intersecting another as I don't want to allow the user to place an object when it is colliding with something else. In the ...
0
votes
1answer
34 views

How to stop all character movement when jumping against the side of a platform?

My Sprite is Moving against a platform. I have a script and an unusual one (that's what one of the member said.) My isGrounded isn't using any rayCasting. I didn't have any problem with it but when I ...
0
votes
0answers
21 views

How can I add multiple collision components to a skeletal mesh?

How can I add multiple collision components to a mesh that is part of a character blueprint? I have a character blueprint with an inherited capsule component. The capsule component works, but if I ...
0
votes
1answer
33 views

Trying to trigger dialogue when the space bar is clicked, and two objects are colliding

I'm getting a NullReferenceException on OnTriggerStay. I've been going crazy trying to figure out why. I have tried to cut this down to only the relevent information. I got this code through a ...
0
votes
1answer
44 views

Preventing overlap in OnCollisionEnter2D

So I have successfully built a script that can determine the physics for a ball reflecting linearly off of walls, similar to pong, while the ball is using a kinematic rigidbody. The issue is when the ...
0
votes
0answers
22 views

Create AABB Cube from click-and-drag user rectangle? AABB OBB Collision Detection

I'm trying to create a 3D cube from rectangle drawn by ther user's mouse (think click-and-drag selection). My end goal is to use this to implement entity click-and-drag box selection. If you've played ...
1
vote
1answer
48 views

OnCollisionEnter2D just flat out not running for certain objects

I am working with the Unity3D Engine in 2D mode. Currently I am trying to make a circle collider bounce off of a composite collider for the walls of my game. The only issue is that for some reason the ...
0
votes
0answers
25 views

How to deal with pushing objects out of collision

I am developing RTS game in unity3d. I have thousands of units running around the battlefield I can't use unity physics component for collision detection as physics API is not available for job system ...
1
vote
0answers
32 views

Avoid object from bouncing non-stop after AddForce() is applied to it

I want to implement some sort of elastic field on my light blue magnetic field when a cylinder is colliding it, it worked except the lines won't stop bouncing. I am enabling the trigger collider on ...
0
votes
0answers
26 views

OBB-triangle and sphere-triangle contact manifold using SAT

in this question I asked how to detect and resolve collisions between a OBB or a sphere and a terrain. Now I understand that the approach is to select the triangles under the colliding object (a ...
0
votes
1answer
44 views

Terrain collision with sphere and OBB

I'm implementing my physics engine for my 3D game. So far I've been able to implement collision detection between OBB, spheres and planes. The engine generate contacts and resolve them with an ...
0
votes
1answer
49 views

Drag Object to Collide Unity

Please help, I am developing a 2D game for a school project and I want to drag the apple to the think box then when it collides, the apple will go back to the original position then it will add 1 ...
0
votes
0answers
20 views

How to create wall to protect enemy spawn & destroy bullet entities?

I am creating a 2d shooter in which there will be enemies that spawn from given spawn points. In order to protect the spawn from players raining bullets into the spawn I created a wall to stop the ...
1
vote
1answer
44 views

Bump and push entities without a physics engine

I have seen on many games the ability to push entities around and bump into enemies/characters. What is this called? I have implemented Matterjs to accomplish this with Pixijs but it seems overkill ...
0
votes
1answer
35 views

detect collision between two circles and sliding them on each other

I'm trying to detect collision between two circles like this: ...
2
votes
1answer
154 views

AABB to AABB collision response

I am currently trying to resolve collision between two AABBs. I already have a function that can detect if the the two boxes are colliding and returns true if the two boxes are colliding. The problem ...
4
votes
4answers
3k views

What would be the best approach to creating a pressure plate in a 2D game?

I've just really gotten started in Unity and while documentation has been helpful I haven't figure out how to detect collisions with 2 or more objects. I was able to get a script working that plays a ...
0
votes
1answer
17 views

Unity2D Register which player colliders have activated

I have a player character that has three separate coliders that form this shape (one for the top, one for the bottom, and one for both sides) I'm trying to register floor collisions with the bottom ...
0
votes
2answers
131 views

Tetris Glitchy Movement Fix

Usual tetris game has 2D arrays for arena/piece and collision check with matrix comparison. To add smooth movement and auto alignment of pieces: x and y are pixels on the screen xMatrix [the cell ...
0
votes
1answer
79 views

How to manage collision between balls in Game Maker 2 (Drag and Drop)

Hey there I'm using Game Maker 2 Drag and Drop for a project, I made a game like Break Out and when the ball collides with the wall it doesn't bounce, in Game Maker Studio we had Bounce Action but in ...
1
vote
1answer
117 views

How to allow to slide rectangle to not colliding with corners between two rectagles?

I am detecting each side of collision between two rectangles, and wen I collide them, lets say, with the left side, it also detects collision on the top side when I move to the top, and the downside ...
0
votes
2answers
75 views

How to use separating axis theorem to allow for sliding along walls

I'm making a 2D platformer game and using the separating axis theorem for collision detection, but I want the player to be able to walk along the ground and slide on walls and other stuff and I can't ...
1
vote
0answers
18 views

How to determine angle of incidence, resulting position, and resulting velocity for a point with position and velocity appearing within a rectangle?

I have a rectangle positioned on a 2D Cartesian coordinate system, and its minimum x and minimum y are represented as a coordinate pair (xrect, ...
0
votes
0answers
9 views

How do I rotate the child object of a rigidbody? [duplicate]

Suppose I have a game object with Rigidbody component attached. I then create a child object below it. parent->child How do I rotate this child object relative ...
1
vote
2answers
154 views

Collision detection in 2D games

I am making a basic 2D platformer. I want to get the relative position of one rectangle to another. This is how I do it right now: ...
0
votes
0answers
24 views

How do I apply rotations to parent child using Rigidbody? [duplicate]

I have a finger object. It is just three cubes representing the finger parts. The 2nd cube is the child of the 1st one. And the 3rd cube is the child of the 2nd one. This is the heirarchy: ...
0
votes
1answer
61 views

Most efficient way to check collision

For example, I have a player and a map, to check player collision with some block we need to check entire map tiles, but the bigger the map, the slower the framerate. What's most efficient way to ...
-1
votes
1answer
31 views

trying to work out coords based collision [closed]

In this game I'm working on, both player and enemies are represented by 32x32 sprites(not using bounding boxes). I'm trying to make a system where if the x and y coordinates of the player and ...
1
vote
3answers
78 views

Splice enemy array to destroy enemy (js game)

I am currently working on a basic space invaders game. So far I have created the enemies, a main character, and a laser beam, collision detection between enemy and bullet, however when my bullet ...
0
votes
1answer
111 views

Separating axis theorem OBB vs Sphere

I am trying to implement collision detection in 3D between OBB/AABB and sphere. For this i'm using sat/separating axis theorem. For sat to work in 3D i need face normals of obb (sphere to face), each ...