15 votes
Accepted

How is a Mesh Collider "performance expensive"?

A moving body near a meshcollider needs to check for collisions against potentially every triangular face of the mesh. So for a detailed or non-convex mesh, or lots of bodies, this can get expensive. ...
DMGregory's user avatar
  • 132k
15 votes
Accepted

Solving obtuse interior corner collisions

There is an alternate way to think about solving this. You can do a transform by offseting the lines by radius of your circle then the solution is same as intersection of 2 lines. Image 1: You can ...
joojaa's user avatar
  • 399
13 votes

Solving obtuse interior corner collisions

I assume that you want a solution for collisions in general, which also works well for interior corners. When resolving a collision against one plane, do not move the circle perpendicular to the plane....
Kevin Reid's user avatar
  • 5,398
7 votes
Accepted

Most efficient way to get the world position of the 8 vertices of a Box Collider

Try this: ...
MAnd's user avatar
  • 4,907
7 votes
Accepted

Nestling into contact with a group of physics objects without exerting forces on them

Here's a way to do this using Physics.SphereCast to test against the bodies' colliders without actually exerting any forces on them. It assumes that your cursor object is placed on exactly the same y ...
DMGregory's user avatar
  • 132k
7 votes
Accepted

_ready(): Node not found: "Pivot/Camera" + player falls through the floor

On picking your tutorials You seem to have been mixing Godot 3 and Godot 4 tutorials. So be careful which one the tutorial is for. Chances are that tutorials prior to Godot 4 don't specify. At the ...
Theraot's user avatar
  • 25.1k
6 votes
Accepted

Why is OnTriggerEnter not called when my objects do not have Rigidbodies?

As you can see from the Collision action matrix in the documentation: Trigger messages are sent upon collision StaticCollider RigidbodyCollider KinematicRigidbodyCollider StaticTriggerCollider ...
DMGregory's user avatar
  • 132k
5 votes

How is a Mesh Collider "performance expensive"?

Unity first uses Axis-Alligned Bounding Boxes (AABB) to check which colliders actually have a chance to collide. Checking two AABB's for intersection is a very cheap operation. Only then does Unity ...
Philipp's user avatar
  • 118k
5 votes

Godot: How do I get the id mask for a physics layer by name?

Just a demo in an empty node - range starts with 1 up to the number of layers It creates a dictionary where you can access with layer name and get the number as 2 to the power of layer number - run ...
Daniel Kukula's user avatar
5 votes
Accepted

Show colliders in a build game in Unity

Gizmos are only visible in the Editor, so that is not a solution. Instead, you can render the colliders or (simulate rendering them) any number of ways. BoxCollider2D If your 2D colliders are boxes, ...
Acme Nerd Games's user avatar
4 votes
Accepted

Unity - An unwanted Collider , far too big , being added to meshes without reason and I cannot remove it

Well that collider might not even belong to the game object you are currently selecting, try to go through each game object that is a child object and you'd probably find it. And when you do you can ...
YeetlordTheFirst's user avatar
4 votes

How is a Mesh Collider "performance expensive"?

A Mesh Collider will have to figure out the collisions for every single face of the whole mesh, Therefore It would take Longer (No significant difference most of the time) and would consume more ...
Demoncious's user avatar
4 votes
Accepted

How to change music from room to room?

If you want to play non-diegetic music (background music which just plays without a positional source), then a simple solution is to add the audio source which plays that music directly to the camera. ...
Philipp's user avatar
  • 118k
4 votes
Accepted

What is a raycast?

A raycast is like shining a laser pointer in your scene, to see what the laser hits. It takes a starting point and a direction as input (together, they make a "ray"). The physics engine takes this ...
DMGregory's user avatar
  • 132k
4 votes
Accepted

Godot: How do I get the id mask for a physics layer by name?

Getting layer via name is not possible as of Godot v3.2.1. However, you can use groups and the logic will be the same. Add the wall collision objects to a "Walls" group and then check if it's in the ...
hola's user avatar
  • 321
4 votes
Accepted

How to prevent an object with high velocity from passing through a collider?

To prevent a collider from passing through another collider at high velocity, change the "Collision Detection" option on its "Rigidbody 2D" from "Discrete" (default) to &...
Chaitanya's user avatar
  • 151
4 votes

Solving obtuse interior corner collisions

To find the position where the circle is resting against both planes, you could use following approach: We define the line k which is the bisector of the angle between g and h. Every point on line k ...
Benedikt Jensen's user avatar
3 votes
Accepted

Changing CharacterController's height causes jittering issue in Unity

I'm assuming this is the issue you're having: You can fix this by offsetting the CharacterController's center so that the bottom of the collider is always at the foot of your character. Specifically, ...
Coffee Boat's user avatar
3 votes
Accepted

Unity tilemap collider not colliding with rigidbody

I forgot to put a circle collider on the red circle. Leaving this up for others who might run into the same problem.
Siggytron's user avatar
3 votes
Accepted

Mesh made in Blender is correct in Unity3D as a rendered mesh, but "empty" as a collider?

this is just a guess that I am pulling out. but I see a missing line on the side of your stairs. No line showing up in unity seems like a hint. you can see triangles 012, 234, and 145 because of the ...
Jody Sowald's user avatar
3 votes
Accepted

Which collider to use on "island" situation?

An EdgeCollider2D would handle this case well. Much like a LineRenderer, you provide it a list of points to join into line segments, marking your collision boundary. It can be a closed shape, but it ...
DMGregory's user avatar
  • 132k
3 votes
Accepted

Making pickup objects with gravity that won't push the player on collision

Set the pickup to be on a layer that interacts with the ground only, not the player character. Give your player character a child object that represents their collection radius. Give it a trigger ...
DMGregory's user avatar
  • 132k
3 votes
Accepted

Collision objects aren't preventing falling in Unity

Check the Layer Collision Matrix of your Physics 2D project settings to make sure the "Default" layer reacts to itself. I've seen this mysteriously get ...
Acme Nerd Games's user avatar
3 votes
Accepted

My sprite is hovering slightly above my tilemap in Unity 2D

There are several ways to fix this: 1- Go to Project Setting and then Physics 2D and change the value of Default Contact Offset to something smaller 2- make the collider slightly smaller than the ...
Arian_ki's user avatar
  • 691
2 votes

Nestling into contact with a group of physics objects without exerting forces on them

If your problem here is that when player is placing the ball, it pushes other balls back, then why not just turn isKinematic on and off? Turn off physics for all the other balls on the playing field, ...
John Hamilton's user avatar
2 votes
Accepted

Every Item is colliding but 1

So comparing bullet and player I learned bullet worked because it wasn't a trigger so I set my player object to not be a trigger and now it works, Im embarrassed Lol.
Dino Alves's user avatar
2 votes

Most efficient way to get the world position of the 8 vertices of a Box Collider

If you can access a Mesh of the same size and shape, you can use Mesh.bounds, which returns positions in local space.
Evan's user avatar
  • 186
2 votes

Merging box colliders for optimization

Sure you can. Assuming you have a list of BoxCollider that need to be combined, you can access each of their bounds properties, ...
Tống Tùng Giang's user avatar
2 votes
Accepted

Is Trigger Colliders not ignored

I solved the problem by not using RigidBody.Cast that uses all attached colliders but instead using a Collider.Cast so I only got back collission for that specific collider.
Samuel Wahlberg's user avatar
2 votes

How to ignore collisions of triggers after first collision of trigger until OnTriggerExit of first collision of trigger?

I think it should be as easy as: if (whitettank.gameObject.tag == "whitetank" && !red.isStopped) { // do stuff } This way the script will skip over ...
sjoerd216's user avatar
  • 221

Only top scored, non community-wiki answers of a minimum length are eligible