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
1 answer
64 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
44 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
102 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
95 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
56 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
59 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
  • 941
0 votes
1 answer
69 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
39 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
0 votes
1 answer
54 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
  • 13
1 vote
1 answer
52 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
37 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
98 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
0 votes
0 answers
52 views

How to find the vertices most rigidly skinned to each bone?

I'm trying to reimplement this paper in Unity: https://theorangeduck.com/media/uploads/other_stuff/DReCon.pdf To setup the character avatar, the authors write: "Our character’s rigid body ...
Rishar's user avatar
  • 1
2 votes
0 answers
54 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
290 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
49 views

Fill the mesh gap when joning two seprate mesh

I am looking for a way to fill the gap of a mesh based on intersection of two planes. Sorry maybe I am not able to properly express the problem. So here is the picture representation for more ...
Muhammad Faizan Khan's user avatar
0 votes
0 answers
107 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
44 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
0 votes
2 answers
99 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
301 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
2 votes
0 answers
359 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
  • 125
0 votes
1 answer
89 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
55 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
53 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
0 answers
36 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
  • 733
0 votes
1 answer
139 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
46 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
76 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 vote
1 answer
194 views

Optimal way to find the closest entity to player with a restricted set of functions

The scripting engine of Skyrim (and Fallout 4) has an interesting function called FindClosestActor(x,y,z,radius). If you call it with x,y,z center coordinates and a radius, it returns the closest ...
Bálint Juhász's user avatar
0 votes
1 answer
62 views

Needs help on actually making the trigonometric function work as intended

...
random person's user avatar
-1 votes
1 answer
150 views

Extracting cell center and corner points from rasterized Voronoi diagram

I currently have this code which I copied from Rosetta code: ...
random person's user avatar
0 votes
1 answer
397 views

Deriving shadow position from a 2D heightmap

I have a 2D heightmap with discrete values. Based on these values they should cast a fixed position shadow (constant angle respective to the "sun"). I can figure out how to cast it on a flat ...
KayleMaster's user avatar
2 votes
0 answers
554 views

How to project 3D meshes onto a 2D plane producing a 2D polygon silhouette?

I would like to project a number of separate 3D meshes onto a 2D plane and create a 2D polygon representing the outline of all the meshes. I would also like to to create multiple 2D polygons if the ...
Path's user avatar
  • 21
0 votes
1 answer
38 views

Arranging points in a 2D grid so that successively added points approximate a square shape

So, I ran into a problem with placing points in a grid while always trying to fit them into a square. Here are some examples (the numbers represent the order of placement): Placing 1 point: ...
thzoid's user avatar
  • 3
0 votes
0 answers
49 views

How to find the center of mass from CapsuleCast in unity

Is there an easy way to find the center of mass from a CapsuleCast, or should I find the geometric center of it?
RhinoPak's user avatar
2 votes
0 answers
119 views

Approximate doom/heretic-style freelook distortion with modern graphics APIs

Currently working on a doom-like engine with fewer technical limitations, and looking into rendering techniques. I'm aware doom's a raycaster, and I want to capture a similar look but with modern ...
NotVeryMoe's user avatar
0 votes
1 answer
273 views

How do I find the correct vectors perpendicular to a vector in between two vertices?

I'm trying to push the purple vertices inward by moving it with a vector perpendicular to the red vector shown in the picture. Each directional vector created will move its respective vertex towards ...
KD867746's user avatar
1 vote
1 answer
67 views

How can I remove unnecessary vertices from wall edges?

I've got a pretty simple tile based 2d top-down map with an array of walls. In order to figure where to cast light and shadows, I've generated an array of vertex coordinates along the walls like so: ...
q11's user avatar
  • 11
1 vote
0 answers
26 views

How can I draw a partial circle with LineRenderer?

I'm using the following code, which I found online, to draw a circle with a predefined radius centred on a predefined point in LineRenderer (2D game). ...
chpmerlin's user avatar
0 votes
0 answers
27 views

Rotating two types of cubes -- one cube's sides disappear

I had a cube that had 8 vertices and 12 triangles and the visibility of the cube was okay. When I rotated, I was able to see all visible sides of it. Here is my old cube: ...
Gasim's user avatar
  • 189
1 vote
0 answers
98 views

Dual Contouring - Eliminating sharp edges

I want to remove the sharp edges (Cubic looks) of Dual contouring. It currently looks like this: This is what I get when I try to implement QEF: ...
ma1169's user avatar
  • 143
0 votes
1 answer
67 views

Movement within a circle, but the circle bends around obstacles?

I wish I knew a better way to phrase this, but I want to make an object move from point to point inside a circle. But I also want that "circle" to bend around obstacles, so that no matter ...
circler's user avatar
0 votes
2 answers
89 views

Placing a circle as close as possible to a specific coordinate without overlapping another circle

I am working on a 2D game in Java. My goal is to place a ball as close as possible to the center without overlapping the balls that are already there. How can this be done?
gina16's user avatar
  • 1
2 votes
1 answer
336 views

Formula for attack range using hexagons

I need a little help with a formula to calculate the attack range for my turn-based strat game. Since it's a hexagon grid, I'm having trouble coming up with a formula that would pick the character ...
ガビ ユカチノ's user avatar
0 votes
1 answer
86 views

How to check if a point is on the plane given bottom-right point, top-left point, normal and the quaternion rotation of the plane

I know the world positions of A and B. We are also given the vector normal and the quaternion rotation of the plane How do I check if a point lies on the plane?
MrRobot9's user avatar
  • 321
1 vote
1 answer
1k views

Getting the point of intersection from this fast ray box intersection algorithm

I have seen lots of such algorithms that return a Boolean value, but I also need to get back the intersection point and ray length. I am looking into this example, but I'm not sure how I can extract ...
trshmanx's user avatar
  • 161
0 votes
0 answers
88 views

Clipping walls in Doom-style FPS view

I have two points representing a line, and a player position. I translated and rotated the points around the player, and this works just fine. Next I want to clip the resulting line like Bisqwit did ...
LogicTheorist's user avatar
-1 votes
1 answer
139 views

What is the relationship between gimbals and Euler angles?

Through reading a lot of articles, I understand what gimbals are (at least I think so). And I know that Euler angles follow the rules of gimbals, but why? Why do Euler angles comply with the rules of ...
zeng's user avatar
  • 1
0 votes
1 answer
82 views

How to handle movements of objects in a platformer with a cylindrical map?

I was wondering what would be the best approach for a game with a perspective like Resogun, where the world wraps around in a cylinder: In my opinion, the easiest approach is to: have a "...
alaslipknot's user avatar

1
2 3 4 5
11