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
35 views

Collision contacts stop working, but OnCollisionStay() keeps working

Well, it´s more like deactivating. It is called at the beginning and some time after, but it just stops working without reason. Both objects have rigidbodies and colliders, so it´s not related with ...
0
votes
0answers
13 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 ...
0
votes
0answers
22 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
45 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
53 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
91 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
41 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
28 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
13 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
0answers
35 views

How to calculate faster how much a collider is going through?

So I think this may be an overkill, but am casting two different rays for a single collision. This is because the physics´ system in unity detects collision contacts in the wrong place when ...
0
votes
1answer
24 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
0answers
17 views

Why are the collision contacts different with diffferent gameObjects?

So I have two different colliders colliding with the same gameObject, let´s call it object S. If collider 1 is the one colliding, collision contact points are on the the edge of object S. However, ...
0
votes
0answers
46 views

How to properly squeeze an object when is being pressed based on percentage of collisions in relation to scale?

Am trying to do this: How can I "squeeze" a game object when it is pressed between two others? Which has anwsers, but with some issues, like not lerping back to original scale or not ...
0
votes
1answer
35 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
19 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
38 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
24 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
31 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
14 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
0answers
37 views

Unity 5: How to make object trigger collision, but be able to go through the other object?

I have an object that rotates around my player. I have another object that is the enemy, trying to attack the player. I want the rotating object to object to collide with the enemy and take some of it'...
0
votes
1answer
35 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
34 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
18 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 ...
0
votes
0answers
13 views

Score gained as a particle from the Particle System is collected is it possible

Using Unity. Using the Particle System. Code: c# I want to execute Code using On Trigger particle module when collision has happened to a Game Object. Inside Unity's Particle System/Triggers there ...
0
votes
0answers
32 views

How to prevent object tunneling through ground when under influence of gravity?

I am currently trying to implement 2D continuous collision detection to predict the time to collision between two objects and subsequently apply a collision response. I achieve this by casting a ...
1
vote
1answer
39 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
0answers
20 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
112 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
15 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
128 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
46 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
55 views

How to use seperating 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
27 views

Alternative to a collider for representing a horizontal plane

I'm studying with Unity, and now I'm starting to learn stuff without using the pre-implemented components like colliders etc.. Right now I have my player walking on a plane using the following code: ...
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 ...
0
votes
2answers
110 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
23 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
58 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
30 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
66 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
0answers
16 views

Sat.JS finding the collision vertex

I am making a simulation in Javascript. I am using Sat.js. I have polygons in the simulation such as triangles and squares (these float around rotating) and 'laser beams'. The laser beams are just ...
0
votes
1answer
70 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 ...
0
votes
0answers
27 views

Colliders going through each other

I'm trying to trap objects inside a room (a hollow 3d object), here's what I have: A 3D object with a mesh collider (not convex) on the inside and a bouncy physics material randomly generated ...
1
vote
0answers
9 views

Affect of timeStep on PhysicsBodies in SceneKit

In SceneKit, I had a problem on collision of two dynamic spheres, when the one strikes to another with fast speed, it was passing through inside of it. After i have reduced physicsWorld.timeStep value ...
0
votes
1answer
129 views

Why is my spherecast returning an incorrect hit on mesh collider? (Unity)

I have a mesh collider that is largely a flat plane facing up. Any SphereCast against that surface should return a normal of Vector3(0, 1, 0), but that isn't always happening. When near an edge on the ...
0
votes
0answers
20 views

Polygon vs polyline collision boundaries

I'm making a 2d, point and click, side scroller game and I'd like to limit the playable area. I've created a simple level editor that allows me to place sprites on the map and now I need to decide how ...
0
votes
0answers
17 views
0
votes
1answer
23 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 ...