All Questions
Tagged with math or mathematics
2,025 questions
0
votes
0
answers
41
views
OBB SAT test with pre-scaled basis vectors
I am trying to do a SAT OBB collision test using OBBs that are represented as a 3D position (\$c_0\$ and \$c_1\$) and a 3x3 rotation/scale matrix (\$A\$ and \$B\$), where the columns of the rotation ...
0
votes
0
answers
115
views
How do I render points in 3d space given spherical coordinates?
I have a 3d renderer I'm working on, and I need to know how the specific details of the human eye so I can project that to a coordinate, what is the math that does this given spherical coordinates and ...
1
vote
1
answer
281
views
How to speed up collision detection if there are hundreds of objects?
Let's say I have like 500 Asteroids and I'm using SAT to determine whether a collision with the Spaceship object has happened. This would require an insane amount of CPU cycles, so it makes sense to ...
3
votes
2
answers
143
views
Number system with restricted set of sequence configurations
I am trying to design a novel number system for a game.
To do this, I want to create a mapping from a set S of symbols to the integers, where not all sequences of symbols from S are allowed, but they ...
1
vote
0
answers
46
views
What is the best way to move a mask in a shader in a square path in Unity Shader Graph?
I would like to make the square move strictly along a square trajectory. The square will later be used to mask the main sprite.
How to achieve this result? How to move the square along the square's ...
1
vote
1
answer
129
views
Two Point Alignment Transformations
I'm trying to determine the transformation steps (position, scale, rotation) needed to be applied to an object so that two points, locally positioned in that object, line up with two world space ...
0
votes
1
answer
149
views
Slot reels RTP(return to player) estimation
I am making a slot game with 3 x 5 reels. The RTP I am targeting is 99%. My reel data is given as (yaml):
...
0
votes
0
answers
80
views
Projecting 3D gaussian's transform matrix to a 2D viewspace transform matrix
Essentially I'm wanting to project:
A 3D transformation matrix of a Gaussian (or in this case for simplicity a unit sphere) that includes scale, rotation and translation in world space TO
A 2D ...
1
vote
1
answer
581
views
Given two points (A and B), how can I obtain a point a set distance along the line between them?
Let's say I have position A, that is (0,0) and Position B that is (10,5).
Now let's say I know that position C is 5 units' distance from position A in direction to Position B.
Provided that the ...
2
votes
1
answer
201
views
How to adapt the Anya any-angle pathfinding algorithm to handle non-discrete start/target positions?
Recently, I have been investigating the Anya pathfinding algorithm.
Anya is an optimal any-angle pathfinding algorithm.
However, it works only with discrete points on the grid.
Here is an excerpt from ...
0
votes
1
answer
134
views
How to Rotate a Sphere around a Tilted Axis in a 3D space
I'm developing a game with Unreal Engine 5.4.4.
In the game, I'm trying to rotate a sphere around its Z axis. If I put the sphere on the map and add a rotation around its Z axis is easy.
I only have ...
0
votes
1
answer
165
views
Resizing a Sprite in 3D space to match its native pixel size at a target screen resolution?
I am placing a 3D game object with a SpriteRenderer + Billboard attached to it in my scene.
However, since it's a distance away from a perspective camera, the sprite gets scaled, losing a lot of the ...
0
votes
0
answers
49
views
How to calculate the Number of blocks per column in an N step pyramid?
Designing a space game, where each ship has a certain size/ number of layers of armor.
for example 3 layers size 7.. .Which would look like this:
...
0
votes
1
answer
165
views
Shrink a Circle's Radius Without Deformation Until It's a Solid Spot
I need to shrink the radius of a ring without deforming it by shrinking it's outline(the way scaling it would).
I need to do this until the hollow fill is gone and its a solid spot.
Here's an example:
...
0
votes
1
answer
130
views
Post process effect with sphere mask is offset until the window is resized
I am having a weird issue with the position of my sphere mask. Here is what it looks like currently:
The white disc should be directly under the player character, not shifted off to the side.
...
0
votes
0
answers
42
views
How can I detect which slice of the pie chart my mouse is hovering over?
I'm trying to create a simple pie chart for my game (a strategy/simulation game) to show population demographic data for a province, but I'm struggling to figure out how to detect which slice is being ...
0
votes
0
answers
87
views
Rotation Matrix rotating in context over another Rotation Matrix
I have 2 rotation matrixes than work in a world that have three dimensions (X, Y and Z) being Y the one of the height.
One of such rotations works using Y dimension, from the point of the center of ...
0
votes
0
answers
106
views
Zoom in and out centered about the mouse cursor in 2D using ImGUI
I have a 2D canvas used in a ImGUI context, that requires Zoom and Pan functionality.
Currently the Pan functionality works fine. However the zoom functionality does scale but the result is not ...
0
votes
0
answers
183
views
Moving SplineAnimate Objects Over Time With Proportional Speed
What I'm doing
I'm using Unity's Spline package and I'm trying to move SplineAnimate objects across a Spline, similar to a racing game's mini-map UI.
...
0
votes
1
answer
205
views
How to express parabolic motion using delta time?
I'm trying to figure out how to express parabolic motion (for example: \$y = x^2\$) using delta time. I thought about deriving it using a differential like \$y' = \frac{1}{2}x\$ but that results in a ...
1
vote
0
answers
53
views
CGLM Not Rendering with Sokol [closed]
I've setup cglm from a wrap configured with Meson, and have copied one of the samples from https://github.com/floooh/sokol-samples/tree/master (cube-sapp, to be exact). I've tried to replace sokol's ...
1
vote
0
answers
274
views
Converting a Transform from Unity's Coordinate System to Unreal Engine's
I am trying to convert a transform from the Unity Coordinate System to the Unreal Engine Coordinate System (and others).
Ideally, I want to take a position, rotation (in Euler angles), and a scale as ...
0
votes
1
answer
159
views
How to make objects appear on the map at a certain distance based on scale?
Mode7 - Sprites on Screen / Pseudo 3D
Scale x1:
Scale x16:
I'm trying to recreate this system with JAVASCRIPT:
https://github.com/vinibiavatti1/Mode7/blob/master/src/mode7/FlatModeSeven.java
The ...
1
vote
1
answer
340
views
Understanding polygonal approach for procedural generation of roads and rivers
First of all, I have already discovered these questions and their answers:
Road / river generation on 2d grid map
Algorithms for rainfall + river creation in procedurally generated terrain
Generating ...
0
votes
1
answer
105
views
LibGdx sprite isn't rotating correctly around its own axis
I'm currently trying to rotate a sprite around its own axis to make it "face" the mouse, but I'm having weird results. This is my code:
...
1
vote
1
answer
96
views
How to understand calculation of step size in voxel terrain renderer?
I was following the Pikuma's Voxel space terrain rendering video.
I understood almost everything that he described in the video except the following point, where he described the the equation to ...
2
votes
1
answer
351
views
Implementing animation curves using cubic bezier curves
I am trying to implement an animation system using cubic bezier curves. It was easy to setup the calculation of the curve itsself. Only evaluating the curve at a specific time x gives me headaches.
I ...
0
votes
0
answers
112
views
Need help controlling a 2d rocket to reach target positions at velocity vector constraints
The problem:
I have a rocket in a 2D space game that can apply force forwards and apply torque to turn. Now I want this rocket to reach a target point in the x,y coordinate system with a certain ...
0
votes
1
answer
120
views
How can a quad be triangulated consistently in 3D? [duplicate]
I'm making a building game and the terrain and modelling system are based on cubes made out of 8 corners each. Players can manipulate the corners to make other shapes.
When you take a quad (ABCD), ...
0
votes
3
answers
467
views
How do large physics based games (space engineers) deal with coordinates
I have recently been looking into physics engines and low level computing. At some point id like to make my own engine down the road.
Something I can't seem to find an aswer for is how physics based ...
0
votes
0
answers
130
views
Normals deformation with FFD
I am developing an FFD tool in Unity for the needs of a level designer. It works similarly to FFD box in 3DS Max. I used the implementation described by Sederberg and Parry with a lattice and ...
1
vote
2
answers
138
views
Inconsistent Movement Behaviour between built Game and Playmode
I'm using a simple MonoBehaviour that causes GameObjects to change their position based on a ...
0
votes
1
answer
424
views
How to calculate the center of mass of a irregular polygon in Godot?
Or to calculate the centroid of a 2D polygon assuming uniform mass density, which is my case. The polygon can be either concave or convex.
1
vote
1
answer
395
views
How to calculate the surface area of a irregular 2D polygon in Godot?
I have a irregular 2D polygon, it is a PackedVector2Array, how do I get its area?
0
votes
1
answer
244
views
How to live on sphere?
What I want to achieve
I want to generate sphere planet world, seamless of course, for RTS game like Planetary Annihilation: TITANS, which means I want:
place walking agents on sphere, move them on a ...
0
votes
1
answer
118
views
Calculating semicircle points of a scaled CapsuleCollider2D
I have a very simple code that draws the shape of a pre-defined capsule. It handles everything well, except the case when the GameObject to which the ...
0
votes
0
answers
98
views
Collision of two rigid spheres with spin
I'm trying to create a particle simulation (solar system kind). Until now my particles have no spin so the collision is rather simple
...
1
vote
0
answers
155
views
Predictive Aim to shoot a moving target with a constant velocity while the projectile is affected by gravity (2D/Platformer view)
I've been working on creating stationary gun turrets that can shoot down missiles in my game. The bullets are affected by gravity while the missile moves in a linear path at a constant rate as if it ...
0
votes
0
answers
69
views
How to make an object keep same relative position and orientation using only velocity
I have object A, I can get any information I want from object A (global position, velocity, etc)
I have object B, which is positioned and oriented in a certain way relative to object B. There is no ...
1
vote
0
answers
41
views
2 object snapping using bounding boxes in Unity Runtime
I am using boundary boxes for all calculations. In the image below you may see a case where this objects need to be snapped. Currently the calculations go as following, the rotation is changed by the ...
0
votes
2
answers
913
views
Normalize an angle in unity
How can I normalize angle between min value and max value?
like normalizing -1136316.78186234° between 0° , 360° or between 180° , 360°.
Node: for now I'm using double value as angle.
Thanks for ...
0
votes
1
answer
57
views
Selection Box Not Positioning Correctly
I found some code that generates a selection box, but when I tried it the box was not starting where the mouse was and I couldn't find the issue.
...
0
votes
0
answers
99
views
How to calculate velocity based on force at an angle
I have a 2D top-down jetboat that is moving (has a x, y velocity). I apply the velocity by multiplying against the delta time <...
1
vote
1
answer
167
views
Mirroring a Character's Position In a Shadow After Rotating 180 Degrees
Description:
I am creating a 2.5D RPG.
When my character moves from left to right, they rotate 180 degrees to face the new direction. Just like this example.
They also have a blob shadow sprite that ...
10
votes
3
answers
3k
views
How hard to brake to perfectly smoothly reach the destination?
Goal
I want the get the required minimum deceleration to perfectly smoothly reach a target.
(The car's AI should know how hard it has to brake to be the perfect valet.)
Research
"How can I ...
0
votes
2
answers
180
views
How to rotate spaceship quaternion to face target direction with constant angular speed?
I have an enemy spaceship, and I want to make it turn to face the player with (for now) a constant angular speed. The ship's orientation is a quaternion. How do I do this?
Since this is totally free ...
1
vote
1
answer
122
views
How to calculate rotation needed to cancel out perspective shift
I have a direction vector that's pointing to (0,0,1) in local object space. How can I calculate rotation needed to rotate it on Y axis so that from camera's point of view it would look as if it's ...
0
votes
2
answers
163
views
Max velocity for smooth deceleration to destination
I am able to update velocity of my agent every 0.5 seconds. My agents max speed is 5f/s and max acceleration/deceleration is 2f/s.
I know how far away I am from the destination. How to determine ...
0
votes
0
answers
106
views
How to make calculating the inverse matrix more robust?
When I calculated the inverse matrix, I found that the error in using the float data type would cause the inverse matrix calculation error. Is there any good solution?
...
0
votes
1
answer
115
views
Software rendering - compose View matrix
There is function compose View Matrix, it's software rendering project. Used fixed point math. phd_sin() and phd_cos() user defined functions implement sin() and cos(). Please explain this ...