Questions tagged [collision-detection]
Collision detection is the determination of whether or not two or more entities make contact with each other during gameplay.
2,128
questions
1
vote
0answers
75 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 ...
0
votes
0answers
53 views
How do I do collision detection in a 2d game using a tile grid but which also has pixel by pixel camera and character movements?
So I've been at this for weeks now and every solution I programmed did not work. I am using Free Pascal and SDL2.
So I programmed a 2d game which uses a two-dimensional array which contains the tile ...
0
votes
1answer
317 views
How do I apply collision to a turtle
I cannot figure out how to apply collision to a turtle. I am in need of help for collision with pen lines and turtles. I want the two to hit and restart the game but I can't get collision on either.
<...
1
vote
1answer
70 views
Character moving without control
i've been developing a third person adventure game on Unity with a grappling hook and i found a problem that i don't understand and it's driving me mad.
Basically, if the player character collides ...
3
votes
1answer
152 views
Dodge different type of obstacles
I'm writing a 2D game where the player has to kill a Ninja. This Ninja is coming closer with a constant speed chasing the player.
The Map has some static obstacles like stones no one can pass.
The ...
0
votes
2answers
61 views
How to apply code of certain script to another?
I have a code in my "OnCollider" script to respawn whenever the player dies and has taken an object containing tag 'Respawn'.
1st script: OnCollider ;
...
0
votes
1answer
83 views
2D vehicle collision detection and rotation
I'm attempting to make a simple 2D car game from scratch, but I can't figure out the collision detection between a vehicle and a road. The vehicle should also rotate appropriately to its position on ...
3
votes
1answer
305 views
Workflow for authoring hitbox data for a 2D fighting/platformer game
I understand that collisions in fighting games are detected using hitboxes and hurtboxes associated with specific frames of the animation
I am looking for techniques to author the data for these ...
1
vote
0answers
30 views
Issues With Buggy Collision Detection
I am working on a small game in Processing 3. Essentialy I have a small open-world game and I wrote up a enemy AI to make the enemies wander aimlessly back and forth around the gameworld, and chase ...
0
votes
2answers
26 views
Dividing properties between RigidBody and Collider
I am currently making a physics engine in Rust.
The 2 main data structures concerning collision detection are:
RigidBody: Physics-related aspects of the body. Contains a reference to a Collider ...
3
votes
0answers
64 views
How to implement path-finding with a large number of blocking agents following similar paths?
I want to implement a demo like creeps laning in Dota 2.
So for simplicity, there is Left team and Right team, they are enemies.
Units from Left team move toward Right base, and units from Right team ...
0
votes
0answers
28 views
How to check if moving OOB will resolve the collision?
I now (thanks to several questions that were already asked here) that I can use SAT to check if two OOB are intersecting or not.
But what if they are already intersecting?
My situation is:
I have two ...
0
votes
0answers
74 views
A collider defined as intersection of two colliders
I'm working in unity and I have the following problem :
Suppose you have an object that's very similar to say the intersection of say the corner of a cube and a ball, and you want a nice collider for ...
1
vote
2answers
103 views
Collision Detection in Direction (SFML) [closed]
I am experiencing a problem with collision detection, an efficiency problem. Right now I want to make it so that my player square stops traveling in the direction of collision into the static object. ...
0
votes
2answers
95 views
Pygame Collision Bug
I'm trying to add collisions to my first game, and it has a bug.
My code is:
...
0
votes
0answers
123 views
How do I keep a rigidbody from making unnecessary collisions on smooth surfaces in Unity3d?
I have been having trouble with a custom character controller I am making. The root of the problem lies with collisions. I am trying to make movement code, but I have a problem with ground movement. ...
2
votes
1answer
85 views
Issues with AABB on a platformer game
i'm facing an issue at the moment in my javascript/html platformer game that despite searching for this issue i can't solve. The problem is this:
When i place two platforms next to each other and the ...
1
vote
0answers
28 views
Handling strange physics behaviour while sliding between coplanar surfaces
We've got a character setup based around manually resolving collisions, and we're using bullet to do so. Our characters have a kinematic rigidbody to push things around, but their movement and ...
1
vote
1answer
68 views
Is Rigidbody needed and what move function to use in 2D games?
I don't really fully understand how to use rigidbody and which movement functions in a 2D game. There seems to be so many options and it's just a mess in my head right now. If I'm making a game like ...
0
votes
2answers
52 views
0
votes
1answer
53 views
Dealing with curved lines in GJK
I'm currently using a GJK implementation (supported by EPA for penetration) and I'm trying to optimise the calculation times of distance calculations.
One of the biggest hits is trying to solve for ...
1
vote
1answer
94 views
How to interact spheres with random walls
I have a physics problem to deal with, I am asking here because a game developers often uses the efficient method. I have randomly distributed circles interacting to through Lennard-Jones potential or ...
0
votes
0answers
30 views
Godot: How to maintain constant inertia
Inertia
If I have a platform moving vertically I want the player to jump onto it without it losing its motion and slowing down or stopping. I have tried looking at the settings to CollisionShape2D ...
0
votes
1answer
74 views
Tile based collision detection errors if player is smaller than tiles
I have implemented a tilemap where each tile is at a non-negative x and y position. (So at the moment think like chess)
At the moment a tile is 16, 16 pixels in ...
0
votes
1answer
59 views
MoveTowards object stuck with isTrigger Collider
I am trying to have a missile seek its target once it has entered the target's trigger. The code should be fine, I think it has something to do with how the colliders are operating.
I want the blue ...
0
votes
0answers
38 views
Resolving this kind of situation in my platformer (movement on slope with roof)
I'm building a simple 2D character controller based on raycasts. At this moment I'm trying to finish the player-ground interaction. For the ground I will be using edge colliders and no tiling ...
0
votes
2answers
179 views
Why Some objects or prefabs don't respond to mesh collider?
I imported some assets and, I used some prefabs from that assets. Some of them responds when I add the component of mesh collider to it and disable the ability of going through with it. But some of ...
1
vote
1answer
83 views
Why do my NPC's fall through the world when I select them as triggers?
I'm making a game in Unity where when the player comes into contact with an NPC it will switch scenes. I have the code for it and made sure all NPC's have rigidbody as well as using gravity and convex....
0
votes
1answer
102 views
How would I move something around inside of a sphere without it going outside of the sphere?
I want to be able to do this, but not go outside of the 4.4 meter limit, the radius is 4.4 meters, and it has zero gravity and no friction. I have a hard time explaining this, but imagine holding a ...
0
votes
1answer
32 views
Unity Proximity Warning System Trigger issues
I'm trying to set up a proximity warning system but I'm having some trouble.
To simplify things as much as possible:
I have two game objects in a scene (Object1 and Object2). Object1 has a large ...
0
votes
1answer
553 views
Pygame Error AttributeError: 'pygame.Surface' object has no attribute 'add_internal'
I'm making my first game of Pygame. I'm going to create groups for making collisions but when I add an object to the group, I get an error in sprite.py (Pygame's Files)
...
0
votes
0answers
54 views
How to check collisions between rotated rectangle and a straight line?
How do I detect collisions between a rotated rectangle and a straight line?
3
votes
3answers
192 views
Collision detection in Arkanoid-like game at intersections
I'm creating an Arkanoid-like game from scratch. I have no (formal or informal) education of any kind in game-development, so I kinda made up things as I went regarding collision detection based on ...
1
vote
0answers
32 views
How to differentiate between colliding objects in Box2D?
I need to differentiate between different points of contact in my racing game.
I currently have staticSensors which determine if the car is on the track or not, but I have created a second sensor to ...
3
votes
0answers
59 views
Support function of Minkowski Difference
I am watching this and if you stop at 7:25, you will find an implementation of the support function. The goal of the function is to give you the farthest point in a given direction. My question is how ...
3
votes
0answers
66 views
Unity - kinematic rigidbody character calling OnCollisionEnter and OnCollsionExit on every frame for specific collisions
I'm encountering an issue with my character collider behavior. I have several elements that are relevant to this issue:
a "character" gameobject (capsule mesh), that is assigned with a kinematic ...
0
votes
0answers
46 views
2D AABB Swept Collision Algorithm Premature Collision
I've been following this pseudo code for my implementation of 2D AABB Swept Collision:
...
0
votes
2answers
168 views
Calculating the intersection of a fast moving circle and a line
Inside of my game, I am in need of a way to test the collision between a line segment and a fast-moving circle. I would say I need a line v capsule collision however the problem is I need the ...
0
votes
0answers
13 views
MelonJS - How can I change position of collided object (push or pull with player Entity)?
I'm getting started on game development with MelonJS and I don't get how can make a Pushable/Pullable Entity.
I'm pretty sure that the approach I'm taking is not right since It cannot detect the ...
0
votes
2answers
88 views
How can I solve niche collision cases between circles and insides/outsides of AABBs or arcs?
I am trying to create a game with some interesting geometry. Literally all the geometry that is involved are the circles that move large distances per frame, and the edge of an iPhone X display, which ...
0
votes
0answers
593 views
Unity Mesh collider not working with capsule collider
I have in my Unity3d Project a capsule that represents a character and has a Rigidbody and capsule collider as components, and in my project I also have a mesh that is my terrain imported as fbx from ...
1
vote
2answers
800 views
Player gets stuck on edges between TilemapCollider2D tiles
I'm currently working on a simple 2D Physics-Based Platformer Project. However, I ran into the following issue:
I'm using a Tilemap and a TilemapCollider2D to display the world. When I move the player ...
0
votes
0answers
25 views
Adding a collider to a wheel in a way that does not interfere with the suspension
I want to add a collider to a wheel so that it does not interfere with the suspension in any way but will allow the car to run into walls or other cars. The implementation of the wheel is as follows:
...
1
vote
1answer
182 views
Redundant checks from spatial partitioning
A simple 2D grid partition system for collision detection divides space into equal-sized tiles. Colliders then map themselves to tiles with their bounding box in O(1) time. Collision detection only ...
1
vote
1answer
108 views
How can one replicate the 'Quake Disruptor' of Wipeout XL/2097?
Following my previous question, I am wondering how one can achieve the same effect under Unity?
The effect in action
https://youtu.be/kzmmLeCwL0g?t=790
Description of the effect
When you fire the ...
0
votes
1answer
373 views
Godot: 'is_on_floor' problem
I have a character in a basic platformer game and am having trouble.
Whenever my character stands over two tiles on a tilemap and appears to be directly colliding with them the character's ...
0
votes
2answers
149 views
2d Rectangle Collision Resolution: Find rollback point
I have a 2-part question:
1:
I have 2 rectangles, A and B. B is a wall and A is moving. My simple logic here is every time A moves, it moves based on some (x,y) offset and then checks if it collided ...
1
vote
1answer
44 views
Sum of FoV enemies
so what I need is to calculate the sum of players' Field of view.
Put simple, In a 2d space, I want to check how much they cover (in degrees).
So here are a couple of use cases to explain by example:
...
0
votes
0answers
37 views
Collision detection not working on some parts of mesh
Racing game with a single mesh to act as a collider for all the track sides. Recently revised the mesh and now it is behaving strangely. The player correctly collides (bounces off) some parts, on ...
0
votes
0answers
9 views
Detecting when a single group of blocks is broken into multiple groups
Let's say you have an array of blocks (AABB), where each block is touching or intersecting any number of other blocks. Together they make up a larger object, and because they're all touching, you can ...