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
0
votes
1answer
36 views

Speed after an angled collision?

I can calculate the speed when there is no angle, but I can't calculate the speed when it is angle. Physics paramaters: ...
0
votes
1answer
68 views

Collision between a player and a solid block C++ SDL2

I am trying to implement a collision between a player and a solid e.g. a solid box. ...
0
votes
0answers
28 views

How to store 3D entity position, offset, and transformation data for parent and children?

I am looking for a cleaner pattern to storing character position data, offsets, and transformations. I currently have a character with a vec3 for position. ...
0
votes
0answers
17 views

Auto-generate optimal direction for Unity Raycast with specifications

How can I have a Physics.Raycast auto-generate a direction for itself to try to hit a given target through a restricted window of space? [Update] After much work, ...
0
votes
1answer
31 views

How to move player out of multiple penetrating colliders?

The player in my game can teleport like Noctis from ffxv.The player shots a weapon projectile and then teleports to the projectile. I'm using raycast to calculate the weapon position after thrown. ...
0
votes
1answer
103 views

Unity: How to fix collision detection with fast moving objects in 2D?

I was making a simple pong game and it worked fine until I tried to increase speed of the ball. With increased speed ball moves across the walls occasionally. I've set no rigidbody for walls and ...
4
votes
3answers
1k views

Why is “collision” event needed when there is a “trigger” event?

The "trigger" event in unity is very flexible: it can be set to fire on both dynamic and kinematic bodies, as long as one of them has a collider with the "trigger" flag. On the other hand, the "...
0
votes
0answers
13 views

Overlap Collision on Box Collision only working on wireframe

When my player collides with the box collision instead of triggering while the player is overlapping the whole box it only triggers when I collide with the wireframe of it.
0
votes
1answer
22 views

Unity Springjoint2d - how to put collider between anchors?

I want gameobjects to bounce off a line between 2 springjoint points. I placed boxcollider2d (with small Y scale) or edgecollider2d between two Joint points and every frame put it in right place, set ...
1
vote
0answers
53 views

Hitboxes in a Java game without rectangles

I left this question on "normal" stackOverFlow but they recommended I asked you guys! I am new to making games in Java but I made some games using the paintComponent method, however I felt like I was ...
0
votes
1answer
31 views

How do I get the player to collide with another object to use as a boundary?

I'm trying to make a simple game where you move a sphere from left/right and try to avoid falling cubes. If a cube touches the player (sphere), the player dies. I'm trying to set up boundaries using a ...
0
votes
1answer
57 views

Colliders slightly intersecting each other; any solution?

Consider this simple scene: In Unity, colliders slightly intersect each other. Typically, this isn't a problem. However, I want to make a custom character controller using a box collider and not a ...
0
votes
1answer
325 views

Collision Player and Tilemap Unity

i am a student in austria. I am working on a project for school, where we have to make our own first game with unity. Because it is the first time using unity, i constantly run against problems. Most ...
0
votes
0answers
22 views

How can I prevent two rectangles from overlapping?

I have two rectangles defined by their respective left, right, top and bottom. I'm trying to prevent the collisions for these two rectangles but I cannot find a working solution. I am obtaining the ...
0
votes
0answers
22 views

Capsule component lagging when using AIMoveTo

I`m currently working on RTS in space. All ships are with fixed Z value. When ship is created its placed on a plane (Floor) with collision set on blocking. Every ship is moved by selecting it and ...
0
votes
0answers
13 views

Collision Overlap not working in a Plane

I want to make all the objects that are overlaping my plane to be sliced! I can achieve this effect sometimes, but in some cases it does not work. Below you can see a situation where the collision ...
0
votes
1answer
187 views

How often should I check for collisions in a Miinecraft-like game?

I'm trying to build a game from scratch in Dart, similar to Minecraft. As far as I understood, there are two main functions in a general game loop: tick: a function that gets executed a fixed ...
0
votes
1answer
88 views

Topdown Game Collision Detection

I am working on a simple game with topdown movement, but I am unable to get the collisions to work properly. I know the collision detection itself works, but the constraining of the player is where I ...
0
votes
1answer
55 views

Zoom into character upon collision

When a character collides with an object in my game, there is a slow motion effect. That's coool, but how would I zoom into a sprite when it collides with another object? Here is my code currently... ...
0
votes
2answers
83 views

line to point collision without doing three square roots

Is it possible to test a point to line collision without doing three square roots? Here's how I'm currently doing it: I have point P that I want to check is on the line, and point A and B for the two ...
0
votes
1answer
41 views

Why isn't my BoxCollider2D doing anything?

I'm trying to make a speech bubble appear when you approach the tutorial board. The bubble is there and it has its animation states "Appear" and "Disappear" Appear is called OnTriggerEnter2D ...
0
votes
1answer
33 views

rigidbody cube falls off the ground

Inspite my ground and cube contains colliders as i apply rigidbody it falls down....use gravity
-1
votes
1answer
56 views

Circle Square Collision Detection Simple Formula

Say I have a circle of diameter c and a square with a base of s. Is there a simple formula to check whether they have collided? ...
0
votes
1answer
22 views

Can I test for containment of convex polyhedra with the separating axis theorem?

I would like to refine the output of the separating axis test to not only tell me whether convex polyhedron A intersects convex polyhedron B, but also whether A is completely inside B. Is it safe to ...
1
vote
1answer
50 views

Box collisions between vehicles in traffic pattern

I'm working on a traffic simulator. Right now, I have ways to manage 4-way stop intersections and a solution for efficiently determining which vehicles are colliding with one another. All vehicles ...
2
votes
0answers
41 views

Adding A Mesh Collider Async

I am building an infinite landscape and I generate all of the terrains procedurally. I recently offloaded my terrain generation code onto another thread to try to eliminate the freeze up when new ...
2
votes
0answers
49 views

SFML Separating Axis Theorem collision detected outside shape

Trying to implement the SAT in SFML using SFML's ConvexShape. Some shapes, like rectangles, seem to work but others trigger the collision outside the shape. I tried drawing the normals, or the axes ...
0
votes
1answer
48 views

2-D character not falling to the ground

I am very new to Game Development and I am making a game with a simple Ragdoll which has a body, a head, and 2 limbs(hands). The head and the limbs are hinged to the body and I have kept the Ragdoll ...
0
votes
0answers
57 views

Pong paddle and deflection angles

I'm trying to make a pong clone and am having trouble grasping ball deflection. The way I'm approaching it is to increase the angle by how far the ball collides from the middle of the paddle. However, ...
1
vote
1answer
33 views

Raycast check for Collisions across XZ coords without Y rotations / Unity C#

I'm really new to Unity/C# (I have a bit of experience in GML but far from professional) and I am currently building out my first prototype. I originally copied THIS script to get a cube that rotates ...
0
votes
1answer
40 views

Why aren't the Physics2D.Raycasts reliably colliding with the 2D Box Collider walls?

I've got this NPC walking around and I'm trying to create a cone to represent their line of sight, including how it would be blocked by buildings, similar to how Nicky Case has implemented it as ...
0
votes
2answers
222 views

Is it possible to detect a collision between a sprite and a UI image in Unity?

I have a stationary sprite with the tag "Player" with a Rigidbody2D (dynamic body type and discrete collision detection) and circle collider 2D. I also have a moving UI image; also with a Rigidbody2D ...
0
votes
1answer
77 views

How to make a teleporter in unity3d?

For my game, I need to teleport player (GameObject) to a position (Vector3) whenever it touches a cube with this script. I tried ...
0
votes
0answers
25 views

Setting the position of a Rectangle does not always work in libgdx

I'm experimenting a little with libgdx and I'm trying to use it to create a little android game. Everything goes well until I try to correct the player position when a collision occurs. This is the ...
0
votes
0answers
40 views

Why are my colliders offset on my isometric map?

I'm building an isometric environment in Unity and having some trouble with my colliders aligning with what shows in the scene editor to the reality in gameplay. There is nothing in the collider ...
1
vote
1answer
46 views

How to prevent OnCollisionEnter2D calling a function again and again?

My current code makes a ball keep jumping whenever it hits the ground. But when it hits a vertical ground it keeps calling the jump function again and again. That is because OnCollisionEnter2D makes ...
0
votes
1answer
146 views

Can a GameObject be both 2D and 3D?

In all Unity games I saw so far, every object is either 2D (with RigidBody2D and Collider2D components), or 3D (with RigidBody and Collider components). This makes sense, but I wonder if there is any ...
0
votes
0answers
21 views

Collision between a static collider and a rigidbody collider [duplicate]

I am trying to understand the Unity rules for collision detection. In particular, the manual says that a static collider touching a rigidbody collider should lead to a collision. So I did this: ...
0
votes
2answers
56 views

How to not move my character when they collide using Unity and Box Collider?

I'm trying to get my characters near to each other so they can attack the other one, but when the player character or otherwise gets near they are pushed to the other direction when they collide. How ...
0
votes
1answer
269 views

Unity's Box Collider isn't preventing an object from falling through the floor

I'm working on a little "Tower of Hanoi" AR game in Unity using Vuforia, where the game is projected onto an image target. Now I wanted to make the rings "fall" into place, so I added an invisible ...
0
votes
0answers
25 views

Pushing an object on other colliders makes the pusher object go through

The Wall moves to the right and pushes the Character with it. The character travels along a bunch of Blocks with colliders attached to them. This is the result: At some point, the Character gets ...
1
vote
0answers
33 views

Q: 2D cone and rectangle collision detection

I'm working on a 2D RPG game and now I need to detect if players ability collides with enemy rectangle hitbox. Currently I have this code that detects if a point is in cone, but I need to modify it to ...
0
votes
1answer
69 views

What's wrong with my line segment plane intersection code?

I'm following the algorithm on on this website for my line segment intersection test code. But when looking at my line segment and plane intersect it doesn't produce the correct point of intersection. ...
0
votes
0answers
32 views

Collisons with rock and player(spaceship)

I'm trying to make when the rock hits the spaceship or player it should decrease the health from the health bar but when I run it, it doesn't work. The rock decreases the health randomly. How can I ...
0
votes
0answers
102 views

Why isn't OnCollisionEnter being called?

I have a hammer and an object to be hit in my scene. I put this line Debug.Log("Collided with" + collision.gameObject.name); to debug whether the function ...
0
votes
1answer
73 views

Collision with walls in a completely tile based game

I am making a tile based game, in which also the player movement is completely snapped to the grid. Imagine sokoban. I basically have a 2d array for the layout of the level (walls / not walls), and ...
0
votes
0answers
98 views

2D Spatial Hashing in C++ Causing Game to run more Slowly

I'm trying to use spatial hashing to speed up collision detection in my game. I believe spatial hashing is better suited for my game than quadtrees, because I have lots of fast-moving objects in my ...
0
votes
0answers
31 views

How to Tag sprites in tilemap unity

I am trying to detect collision with particular sprites added in scene using tilemap, collider is added to all the tilemap,Is there any way I can detect collision with only particular sprite from the ...
0
votes
1answer
95 views

Collision detection / physics for simple game

I am currently working on a mini game for class (first time doing something like this) and I don't really know how to start with collision detection at all. The game I'm creating is a top down sumo ...
0
votes
1answer
207 views

How to get the overlap volume of OBB and or ABB?

The following code is a current attempt at a function I have to determine if two bounding boxes overlap. The bounding box structures are [min[x,y,z], max[x,y,z]] ...

1
2
3 4 5
45