Skip to main content
Share Your Experience: Take the 2024 Developer Survey

Questions tagged [geometry]

A branch of mathematics concerned with questions of shape, size, relative position of figures, and the properties of space.

Filter by
Sorted by
Tagged with
0 votes
0 answers
34 views

How do I move a point in a specific direction in 3D Space?

I know how to move a point in a direction in 2D space it's like this: pointX += sin(angle) * movementSpeed; pointY += cos(angle) * movementSpeed; How do I do the ...
Earthmars643's user avatar
1 vote
2 answers
67 views

Representing a concave polygon as a hull "minus" convex cavities

I am implementing 2D collision detection, and trying to tackle the problem of concave polygon vs. shape. The SAT works only for convex shapes. I was wondering if the following approach is a viable ...
Eilan Laken's user avatar
2 votes
0 answers
43 views

Rebasing barycentric coordinates to an adjacent triangle

Say that in a 2D space I have the barycentric coordinates B=(Bx, By, Bz) of point P relative to triangle T. I now need to calculate the barycentric coordinates B' of P relative to triangle T', where T ...
Gabriele Giuseppini's user avatar
0 votes
1 answer
103 views

How can I calculate vertex positions for a rectangle outline using a unit square, vertex normals, model matrix and outline thickness?

I'm trying to draw a hollow rectangle (i.e. the border of a rectangle without the middle) using a unit square plus normals. The actual positions are being calculated in my vertex shader. For example, ...
junglie85's user avatar
  • 123
2 votes
1 answer
86 views

Approach to rendering a planet texture

I'm making a space game using Godot 4, and I need to capture the "hugeness" of planets. I figured I'd use spheres with textures on them for planets. The textures have identifiable ...
w94n9's user avatar
  • 21
0 votes
1 answer
45 views

Checking if I am looking through a window using angles

I am developing a mod for a game with a Lua api. I am trying to detect if I am looking through from behind a window when I shoot an enemy. For context, when I shoot through this window I apply a ...
Ben R's user avatar
  • 1
1 vote
2 answers
169 views

Calculate path segments size

I have a problem more closely described on a picture below. The idea is that I have my agent in point A and I want to get to the point B. The problem is, that agents rotation towards point B is alpha ...
Peter's user avatar
  • 13
21 votes
2 answers
7k views

What is a "normal" in game development

I'm new in Game development and probably this is a silly question. I had a look online but haven't found a clear answer, I did it bit quick but enough to evaluate that this is a confusing topic ...
Federico Baù's user avatar
0 votes
1 answer
101 views

How can I correctly pass 2 vertices instead of all 4 for a quad to a vertex shader?

If I am rendering quads, but all the quads will be axis-aligned (that is, their plane is always parallel to either the X Y or Z plane), I thought I could cut vertex video memory usage in half by ...
CPlus's user avatar
  • 143
9 votes
3 answers
8k views

How do game engines avoid recalculating normals upon mesh rotation?

Assume that a face of a mesh is defined by vertices A, B, C and that the normal of the face ...
Carpetfizz's user avatar
2 votes
0 answers
68 views

Aligning vector by rotation around non-orthogonal axis

This is almost more a geometry/mathematics question than a game dev one, but I think I'll have a better chance actually understanding the answer if I ask here. Rather than try to explain it- because ...
Keith Stein's user avatar
3 votes
0 answers
166 views

How to test for intersection of a cone with infinite camera frustum (no near/far plane)?

I have a given infinite camera frustum defined by four planes, each defined by a normal (left, right, bottom, top). From those planes we can also easily get the camera position and the view direction. ...
Lukas Kalbertodt's user avatar
1 vote
1 answer
100 views

Vertex Shader Sphere Projection and CPU Distance Calculation

I have multiple planes whose vertices are transformed to a position on a sphere in the vertex shader. The GLSL function called pointToSphere transforms a point <...
Miguel Myers's user avatar
0 votes
1 answer
74 views

How to calculate angular momentum of two colliding bodies about their shared center of mass in 2D?

I'm following this guide to implementing collisions in 2D physics. It shows this diagram, but I don't understand how to calculate the values of Da and ...
noodle_run's user avatar
0 votes
0 answers
154 views

Generating tris for concave polygon 2D

I have an arbitrary array of points that describe vertices of the polygon 2D, they ar in order. To generate plane mesh for that, I need to generate tris. For something like circle/hexagon/square it is ...
Kirikan's user avatar
1 vote
0 answers
22 views

Move a non-convex polygon's outline inwards?

The polygons are small 3D parts of a quasi sphere centered in the origin and a solution that works in the plane can easily be made to work in this world. I tried to move the outline inwards by using ...
August2323's user avatar
2 votes
2 answers
170 views

Finding the closest point on a circle to end of a ray in 3D

I have a circle in 3D space, so we have center C with radius r, and the normal of plane the circle lies on, N. There is also a normalized vector V that I am modifying to go far past the circle's ...
A well-rested dog's user avatar
3 votes
2 answers
178 views

How to check if player actually went through a trigger area and didn't just touch it?

I'm trying to make a racing game that measures your distance from the center-line of the road. To do this I need to check on which part of the road the player is, so the calculation is correct. (If it ...
NationalGeographicProgrammer's user avatar
0 votes
1 answer
80 views

Discontinuous Normals on a Normalized Cube Mesh with Displacement Texture

In my project, I have created a normalized cube using six plane meshes. To improve its visual quality, I added a displacement texture and calculated the normals for that texture to ensure proper ...
Memory1's user avatar
0 votes
1 answer
60 views

Rotating around 3D cube Camera Controller for Unity

I am Unity game developer with more than 2 years experience. I am working in a personal project, a mobile game for Android in Unity. I am trying to make a camera controller for a 3D Cube Game in Unity....
DamagedCyborg's user avatar
0 votes
1 answer
37 views

How to correctly position a set of cuboids based on a direction property in MonoGame

I am trying to create a map for my game using a list of cuboid sections that are defined like this: ...
Maxim Gershkovich's user avatar
0 votes
0 answers
23 views

Two moving and rotating bodies, how to approximate hitbox of a trajectory of a point on one body in the coordinate system of other

The game is in 2D. Let's say I have two bodies: A and B, each with position, angle, velocity vector, and angular velocity (I'm not sure yet if I should be using angles, or rotation matrices). Given a ...
HolyBlackCat's user avatar
  • 2,035
0 votes
2 answers
371 views

How to get area of 2D shape bounded by vertical and horizontal line segments?

I am making a game similar to Volfied using Unity: The player outlines an area using straight lines, either horizontal or vertical. I am stuck at the algorithm to decompose the area into rectangles ...
nicklowkc's user avatar
0 votes
2 answers
188 views

How do I detect collisions with a circle sector against basic geometry?

For the 2D game that I'm building, I want some entities to be able to use areas of attack, such as a wedge/circle sector area of attack. In this case, the circle sector is a pie-slice shaped section ...
WulffHunter's user avatar
0 votes
1 answer
110 views

What is the point of Geometry2D.make_atlas()?

I'm completely bewildered by the Geometry2D.make_atlas() method. I believe it has to do with texture atlases based on its name and comment on its source code but am ...
Javlin Joslin's user avatar
0 votes
1 answer
405 views

Two methods of finding angle between vectors give different answers!

Ok, am I misunderstanding how Unity quaternions work, or is there a bad (about 2 degrees difference!) floating point error? The TLDR is I use a quaternion r to rotate vector v and put the result in w. ...
user1895149's user avatar
0 votes
1 answer
269 views

How to create an octahedron for sphere subdivision?

I have vertices that generate the first out of two pyramids. However, I want to have the second pyramid facing downwards as to make an octahedron. What are the correct vertices to use, because I've ...
Chillzy's user avatar
  • 47
0 votes
1 answer
134 views

Help understanding the math to position sphere vertices by latitude and longitude

For a project of mine, I need to render spheres without loading a pre-made model or using built-in functions. I found this bit of code on the internet that seems to work but I really want to ...
Chillzy's user avatar
  • 47
0 votes
1 answer
71 views

Align two meshes given 2 faces

I have two meshes (A and B) and I know that a triangle in A has the same size and same angles as a triangle in B. For simplicity, suppose A is an octahedron and B is a tetrahedron. And suppose the ...
nkint's user avatar
  • 961
0 votes
1 answer
169 views

GameObject mesh.vertices array is empty

I've an Icosphere GameObject: I want to iterate over each of the faces and change the material based on their distance from the center, however I don't seem to be able to retrieve the list of ...
TomSelleck's user avatar
0 votes
0 answers
48 views

Wheel position on surface

I have a bicycle with suspension and need to find the contact point of the wheel on the "road". If the front fork was pointing straight down, it would be as easy as doing a raycast down the ...
Charl Cillie's user avatar
1 vote
1 answer
154 views

Given a quad in 3D space with two diagonally opposite points and normal, how would I find the other two points?

Image attached below for clarification: So here we have a plane with a random rotation in 3D space, and we have the values for P1, P2, and the plane normal. How do I find the points X1 and X2? This ...
Pooper's user avatar
  • 23
1 vote
1 answer
60 views

Add and Removing Elements on the Circumference of a Circle

I am trying to spawn entities on the circumference of a circle. These entities may be removed at any time, including all of them being removed. Periodically I would like to add an element on the ...
stats's user avatar
  • 135
0 votes
1 answer
81 views

Finding point along vector to maintain distance to an arbitrary point

I'm currently working on a particular project where orthographic and perspective projections are both used interchangeably. To keep the transition between both projection modes somewhat seamless, I ...
JJJohan's user avatar
0 votes
1 answer
136 views

How to spread circles evenly around a point?

In my game there's a part where a bunch of circles need to evenly spread around a point. Like in this demo below: ...
Ryan Peschel's user avatar
2 votes
0 answers
60 views

Audio emission from a polygon instead of a point

I'm developing a 2D game in Godot. The engine doesn't matter in this case. Given a polygon, convex or concave, and a listener (camera) location, what 2D position should an audio emitter be placed at ...
Anixias's user avatar
  • 23
2 votes
1 answer
535 views

Efficiently find all points within a circle

I am writing code that requires me to find all points within circle on certain parts of the screen hundreds of times per frame. I wrote a quadtree for this and have 1 method called query_circle that ...
Aayush's user avatar
  • 47
0 votes
0 answers
200 views

How can I move an object on a non flat surface in vulkan?

I am writing a small "game" in vulkan, in which a car can move in an environment that is not flat, like a desert with valleys. I am able to translate my car and follow it with the camera on ...
Luca Venturini's user avatar
0 votes
1 answer
84 views

Tangent Space View Direction based factor value remap

I'm trying to setup a mask similar to what Fresnel produces. Unfortunately Fresnel gives pretty bad results at grazing angles so I ended up using this : ...
MaT's user avatar
  • 1,045
2 votes
2 answers
305 views

Finding the position of a point based on a relative point inside a quad

I'm trying to get the relative point position on a quad using a [0,1] Vector2, like in the picture below: The red dots are relative positions. What I'm trying to make is a function that takes the A,B,...
Paulo Vinícius Bettio's user avatar
1 vote
1 answer
603 views

Find closest open space in grid of rectangles?

I'm making a builder game where you snap arbitrarily sized rectangles into a 2D grid. I want the player to be able to drag and drop these rectangles anywhere on the grid, but prevent collisions (i.e., ...
Andrew's user avatar
  • 13
3 votes
0 answers
948 views

Wall sliding collision resolution with multiple objects

TLDR My collision resolution algorithm with wall sliding works perfect for multiple walls but it fails when the angle of the corner of two walls is less than 90 degrees. (acute angles) and the player ...
Ciberman's user avatar
  • 135
0 votes
1 answer
184 views

Find out (general) orientation of cube faces with rotated and translated camera

I have the following problem. I have a camera that is initially looking at a cube. The cube is with center at (0, 0, 0). The camera that is initially on (0, 0, 60). The camera can rotate and translate ...
Teodor Dyakov's user avatar
0 votes
0 answers
77 views

Finger (Sensor) Shaking Detection

I want to make the user be able to shake a certain object through the phone's sensor. I have drag&drop mechanics now, and I want this shake to be directly related to that mechanics. How would that ...
ArtemiZ Studio's user avatar
0 votes
2 answers
73 views

Changing Model's rotation to keep its left side toward the pivot as it goes in a circle

I wrote a little script for my scene that allows my ship to circle an island, and it seems to work alright. Now I am trying to get the ship model to stay broadside to a pivot point in the center of ...
Doug Ray's user avatar
  • 143
2 votes
0 answers
17 views

Create a quad that faces a given normal [duplicate]

Let's imagine that we have a given normal, (it could be done with source and destination points but let's say that source is 0 0 0 and the destination has been already normalized) What could be the ...
Frank Escobar's user avatar
0 votes
1 answer
96 views

writing a custom Quaternion.FromTo

I'm using the new Unity.Mathematics library. I'm trying to to replace Quaternion.FromTo(Vector3 from, Vector3 to) which returns a quaternion with what it would take ...
Charly's user avatar
  • 742
0 votes
1 answer
386 views

How do I adjust the start diameter of a spotlight in Unity?

To clarify, I'm an experienced 3D modeller, but there are hiccups here and there getting used to Unity's interface. I'm working with an adjustable spotlight for a game; it can be mounted and directed ...
Michael Macha's user avatar
1 vote
0 answers
52 views

how to efficiently raytrace a rectangle side in 8bits without mul and div?

Imagine you are on a hardware that is 8bits like the nes or the game boy, NO mul no div, only add and shift. Given a rectangle or integer size nk*mk, where k is the size of the underlying grid, and P ...
user29244's user avatar
  • 327
2 votes
1 answer
81 views

How do I get the consistent time it would take for two points to reach each other in circular motion?

I'm making a 2D game. It involves the player swinging around a grapple hook in perfect circular motion, however, I want to make the cooldown for this ability based on predicted end position for the ...
Andrew M's user avatar

1
2 3 4 5
11