Tag Info

Hot answers tagged

7

The resolution should not affect computation of simulation logic such as "where your bullet hit." Any reasonable game will divorce such simulation data from the final render resolution of the screen. That means the main thing you're talking about with respect to resolution is what the player sees. If all other things are equal, then a lower resolution ...


3

OBB - Oriented bounding box. Here's a tutorial Effectively, a bounding box aligned with the Velocity vector of object A as the y-axis (up). It's width and height can be calculated by the starting and ending points of object A. You then compare this with the AABB of object B (treating it as an OOBB), and your golden. If you're just looking for a quick ...


3

You will have to decompose the movement into smaller steps of movement. For example: You want to decompose the movement using the greater componen (in this case, X-axis), and then check for collision in each step. This might look too expensive, but take into account that an object moving faster than it's own width each cycle will be EXTREMELLY fast, so ...


3

BoundingBox provides several Contains (MSDN) methods that return ContainmentType (MSDN). To test if an object is outside your bounding box, test for ContainmentType.Disjoint.


3

You will need to first decompose the movement into smaller steps and use that information to calculate a high-level AABB. If the large AABB's intersect, you can then check the smaller steps to be more accurate. Estimating whether or not there may have been a collision by checking AABB (or OOBB) using just the starting and ending positions can miss ...


2

You should also use relative speeds for the collision check so one AABB is "static" and the other move at a speed of its own speed minus the speed of the "static" one. The fastest way to see if they may intersect is to just expand the moving AABB with the speed. for example the AABB is moving right with 0.1 x/frame, then you extend it so the left edge ...


2

You need to invert the logic of the test not the box itself. The bounding box can only describe a box. Whether that is a rectangular solid in space or a rectangular hole in infinite space is up to the test performed.


1

Sticking to walls is a problem mentioned in this Unity learning module around 8:45, and they set the friction of the ground to zero to solve it. However, they don't address the sliding down slopes problem. Option 1: Give the character's body a frictionless rectangle collider that is just wider than the circle collider at it's feet, with its bottom ...


1

For completeness, I'll document the "reinventing the wheel" approach. I recently wanted to do this too, but I wanted to do it statically (due to some code-structure decisions made before that I didn't want to break). So I didn't want to create a sensor body and World.Step, as previously suggested. Instead, I figured that a convex polygon intersects with a ...


1

You probably need to check for collision first, then check for depth. You can get the wall you are colliding with using wallHit = instance_place(.., .., oWall) then compare depth with wallHit.depth. Since you are checking collision twice, once for movement on each axis, you will need to check twice just in case there is a different collision result in each ...


1

I think these two lines are not needed: Subtract(a,&entities[target].pos);// Make it relative to the obstacle model ... Subtract(b,&entities[target].pos);// Make it relative to the obstacle model I don't see why are you adding them. I think that if you remove them it should work as intended. EDIT: when you calculate the normal to the triangle ...


1

Yes, it's common to cap GJK to small number of iterations. This is because the algorithm is most limited by numeric precision. Also I should note that some of Casey's optimizations don't actually work in practice if you need really accurate results. For graphics culling and whatnot, perhaps this is a non-issue, for collision detection in a physics engine ...


1

The correct design choice here would be making one script and attaching it to the menu elements (I assume buttons) and define what each button will do on OnCollisionEnter() or OnMouseButtonDown(0). The main idea here is to differentiate clicks based on the name of the object that is being clicked on. void OnCollisionEnter(Collision col) { ...


1

I usually use a transform hierarchy like this: Entity Object -> Visual -> Collision The "Entity Object" is at unit scale (1,1,1) and contains the rigidbody and whatever the "main script" for a particular entity is. This keeps the inspector clean and means the transform viewed by the main script is predictable. The Collision object is also kept ...


1

You need to change the collision of a ball against an infinitely thin line to an infinitely small point (ray) against a thick segment with two round ends You transfer the ball's thickness to the segment. Both end points become circles. The collision then becomes a 2D ray-cast operation.


1

Instead of using Mathf.Atan(y / x), which can only return angles between [-90..90] degrees, then compensating for angles outside that range by adding 180 degrees, simply use Mathf.Atan2(y, x). Atan2 is specifically made for the task you are solving. From the Mathf.Atan2 docs: public static float Atan2(float y, float x); Returns the angle in radians ...


1

Pros Higher resolution should give the player more visual information about the game world. Everything will be clearer and more sharply defined. This should confer an advantage in overall situational awareness, which in an FPS is important. There should be no effect on game state as the game engine does not compute the position of objects and actors based ...



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