Questions tagged [2d]
2D computer graphics is the computer-based generation of digital images—mostly from two-dimensional models.
7,136
questions
0
votes
0
answers
26
views
Producing Heatmap as a 2D histogram
I've been attempting to overlay multiple HeatMap frames onto a single 2D plot. I'd like to use a plot to determine the intensity and number of times an event occurs in a specific location. I'm new to ...
0
votes
0
answers
31
views
Offseting particles origin isn't working when having random sizes
so I have ran into a little problem and I don't know how to handle it.. I have a little particle system that can spawn particles with different sizes "and here comes my problem".. I am ...
1
vote
1
answer
46
views
How to render individual sprites from a spritesheet in OpenGL?
I have a spritesheet spritesheet with the following parameters:
spritesheet dimensions are 572px x 220px
tile width and height are 42px
spacing beetween each subsprite is 2px
I also have a Sprite ...
0
votes
1
answer
16
views
Invalid operands 'int' and 'Object' in operator '-'. Godot 3.5
I'm trying to make an rpg game with turn-based combat. My code needed to have a slight randomness to the damage, and I'm getting this error: Invalid operands 'int' and 'Object' in operator '-'. e ...
0
votes
0
answers
21
views
Sprite re-sizing or screen tearing in Java 2D game
Im seeing some weird tearing/distorted image in my 2D java sprite game. Also happens to Rects I draw
Image examples:
Distorted bench image
Rect distorted
Im using a Canvas rather than a JFrame but ...
1
vote
1
answer
25
views
How to make my tile system work with pygame in python
Im making a custom tile system for my game. Its my first time and didnt expect to go that far without a tutorial. So i did my best and made something that works when i render in a tile with the blit ...
-1
votes
1
answer
41
views
Spiral medium-2 question from leetcode producing run time error [closed]
It was to generate 2d matrix for n*n elements where each element is from 1 to n*n arranged in spiral form in 2d matrix.
despite the correct logic for spiral medium-2 from leetcode i am getting this ...
0
votes
0
answers
17
views
I'm getting so many errors in my unity 2d movement script
I wrote a movement script and it wasn't working and I had many errors. I'm new so I don't know how to read the errors and I don't have any coding friends.
I had 9 errors and did research before. There ...
0
votes
1
answer
15
views
MoveTowards doesn't reach to clickpoint
I'd like to move my player object to click point
with constant velocity so I used MoveTowards() method but it teleports towards click point and doesn't reach the point..If it works properly I'll put ...
0
votes
1
answer
24
views
javascript: use addEventListener event object E to finds coordinates of the click and then add a rectangular shape at the same location on canvas [duplicate]
need help!!! i am following this new javascript 2D gaming video and i am currently stuck on 2:32:29 where we are making an explosion effect on canvas where the mouse clicked. https://www.youtube.com/...
0
votes
1
answer
23
views
2D Chunked Grid Fast Access
I am working on a program that stores some data in cells (small structs) and processes each one individually. The processing step accesses the 4 neighbors of the cell (2D). I also need them ...
0
votes
0
answers
16
views
The problem with the rotation of the character in the direction of the mouse and the departure of bullets top down shooter unity2d
The problem with the rotation of the character in the direction of the mouse and the departure of bullets top down shooter unity2d
Why does the character look the other way a couple of degrees away ...
0
votes
1
answer
17
views
Unity, 2d, Joints not forming properly through script
When I run a scene, the script checks the four directions from the object, and if there's another object within range, they should form joints with each other. It should do this with every applicable ...
0
votes
0
answers
13
views
2022.02 won't load 2D meshes, .ply format
I have some 2D triangle meshes in .ply format that both Blender and MS 3D Paint will open. But Meshlab (2022.02) will not. It gives the error message "No vertex field found". I would ...
1
vote
0
answers
30
views
Transferring asci map string to int map array
Hi I am currently trying to convert this string to a usable 2D int Array.
String samplemap =
"-------------------\n" +
"|K * P * D|\n" +
...
0
votes
1
answer
21
views
SpriteRenderer Image getting stretched down
I had a spriterenderer for a square but I want to change it from looking like a basic rectangle to having an image instead. So I tried changing the sprite renderer "Sprite" to the image I ...
0
votes
1
answer
19
views
Unity 2D import sprites larger than their original size
So, I made a sprite that is half long an HD screen, but when I import that in Unity and I add it to the scene it's larger than half the screen. I already set the camera resolution to 1920x1080. How ...
0
votes
1
answer
35
views
Are 2D graphics bottlenecked on modern 3D GPUs by the pipeline, making them significantly slower to draw relative to 3D models?
I'm making a 2D game currently and one of the supposed experts in the community claims that 2D sprites require more instructions than a 3D model, and thus they will render at the same speed.
Coming ...
-1
votes
0
answers
13
views
How to Triangulate Complex Polygon?
For example, I have a polygon with at least 2 intersecting lines. How can I trianglate this polygon ?
Note : It is on 2D space.
0
votes
1
answer
34
views
Save Progress between two scenes in Unity (2D Platformer)
I'm still struggling to figure out how to code this in Unity. I have a button (which is it will change to scene 1 to scene 2, vice versa) then in scene 1 I walk towards the middle of the level already,...
0
votes
1
answer
49
views
How do I make a pixel circle without any specifics other than wanting to use a multiple of a certain number?
I’m trying to make a pixel art circle in Minecraft, but want to use a multiple of 64 blocks/pixels in the circle. I don’t want the corners to be connected, and I can’t figure out how to do the math. I’...
0
votes
0
answers
21
views
Unity 2d Tilemap - Generating grass objects on tiles
New Unity user here. I am trying to find all instances of a particular tile in unity, and then preFab a grass object in the same location as the particular tile. But when I run the code, the grass ...
0
votes
1
answer
32
views
Shuffling two 2D tensors in PyTorch and maintaining same order correlation
Is it possible to shuffle two 2D tensors in PyTorch by their rows, but maintain the same order for both? I know you can shuffle a 2D tensor by rows with the following code:
a=a[torch.randperm(a.size()[...
0
votes
1
answer
30
views
unexpexted output in c++ 2D array
problem
i/o formats
sample test case
For a given two-dimensional integer array/list of size (N x M), print the array/list in a sine wave order, i.e, print the first column top to bottom, next column ...
0
votes
1
answer
32
views
Improving the numpy functionality of a 2D cosine function
I have functioning code but I would like help on two aspects:
Improve the numpy code so that the code runs faster (i.e. don't use for loops)
I would like to first ask about number 1. Here is the ...
0
votes
0
answers
45
views
Unity: ScreenToWorldPoint behaving weird
I have a script for my camera controls and the panning seems to be difficult to get working, ScreenToWorldPoint() is returning weird values and while the mouse is not even being moved.
The panning ...
2
votes
1
answer
28
views
I came across a problem, when creating my game on godot
I'm making a top down style game where the weapon revolves around the character. When I aim with my mouse to the right the sprite is normal... however, when aiming to the left I would need to use Flip ...
0
votes
1
answer
30
views
unity 2d auto shadow caster 2d at wall-closed tilemap
https://www.youtube.com/watch?v=0F8boyFinOk&t=12s
While making a roguelike game with Unity2d, I applied an automatic shadow generator to a randomly generated tilemap from the video above. But it ...
1
vote
1
answer
43
views
move Physics2Dserver RID with mouse in Godot
My goal is detecting the RID when mouse is hovering it and the next goal is to move the RID when the mouse click on it. I have one idea to make this work which is to make another RID which follows the ...
0
votes
1
answer
40
views
Terrible performance with VolatileImage
I recently heard about how awesome VolatileImage's performance is. I decided to switch from BufferedImage to VolatileImage, but it made things a lot worse.
1000 images performance test with ...
0
votes
0
answers
9
views
How to feed neural network .OFF file format 3d data?
I am working on generating 3d model from 2d input images. For the data set part i have .jpeg files for 2d and .OFF format files for their 3d. The problem i am facing here is how do i read this files ...
0
votes
2
answers
45
views
C# powerups how to continue spawning when to 10 when 1 powerups is collected
Now it will only spawn to 10 powerups. when 1 is collected, it doesn't spawn to 10 powerups
[SerializeField] public GameObject[] spawnPowerups;
public int amountOfPowerUpsToSpawn = 10;
[...
-1
votes
0
answers
42
views
Tranform.Rotate() not working in Unity 2D
So, I'm trying to rotate a 2d gameobject of 90° on the Z axis, but when it rotates of 180°.
Here's my code:
if (Mouse.current.rightButton.wasPressedThisFrame == true)
{
transform....
0
votes
0
answers
18
views
Exporting 2D+3D drawings from my drawing application
We are making a drawing application for kids and this application has 2 modes 2D and 3D, when on the whiteboard we draw 2D strokes and import a 2D image and then we toggle to 3D whiteboard and import ...
-1
votes
1
answer
35
views
Move player use Input.getKeyDown unity
Hello guys i want move player between two position use Input.getKeyDown
firstPosition = new vector2(0,0); secondPosition = new vector2(0,5);
if player in firstPosition will go to secondPosition if ...
0
votes
0
answers
7
views
How to do a 2d vector of struc?
i need to creat a Grid in each cell of the Grid are 9 points for each direction and those Points have x and y coordinates and some values. I want to call the grid something like this: grid.cells[0][0]....
0
votes
1
answer
25
views
Unity 3D: 2D physics for a multiplayer game using Photon
I am currently struggling to figure out how to push a cart.
To help you imagine what I'm trying to achieve, I'll try to give my best description.
Imagine you have 3 friends and a rectangle. Each of ...
-2
votes
3
answers
55
views
Given perpendicular distance d on line1, how to find point P on line2 in C++? [closed]
Given line1, line2, and distance d, I want to write a program to calculate the point on Line2 that is perpendicular to Line1, and the perpendicular distance is d.
Does anyone know where to start?
In ...
0
votes
0
answers
27
views
Custom character 2D or 3D - Flutter
I'm researching custom characters in Flutter like change color skin, hair, and eyes,...But I don't know keywords or any library to search on google. Please help me, thank you.
0
votes
0
answers
20
views
2D geometry: Scale 2 objects, keep their distance proportional to scale and translate
I have 2 objects. I need to scale them to fit a certain area. The scaling is determined by the rectangle of most upper left and lower right position. The important part is that after scaling the ...
0
votes
0
answers
16
views
I am trying to create a 2D string array where the first dimension is initialized and populated from user input
The first dimension is from user input. The second dimension(in the corresponding row/col) is the lowercase first character of the first dimension. I can not get the array to populate, or the row ...
0
votes
2
answers
32
views
Subsetting 2D NumPy Arrays
hello im on the path of learning the python and i am struggling to understand this problem can you please help me to solve this problem
Print out the 50th row of np_baseball.
why the answer for this ...
-1
votes
1
answer
33
views
How to convert model space to view space? (3d point to 2d point?)
I've been trying to get a cube to go on my screen. I just don't know how to make the verticies line up as screen positions (x,y). I have a cube OBJ. And I use the values that start with "v". ...
0
votes
1
answer
45
views
C program to compare each word of a 2D array to all words of the order 2D array
I created 2 2D arrays containing words. For example:
loadKey[25][30] =
{
{'J','a','v','a','\0'},
{'P','y','t','h','o','n','\0'},
{'C','+','+','\0'},
{'H','T','M','L','\0'},
{'S','Q','L'...
-1
votes
0
answers
78
views
Optimizing the rendering of a large number of 2D tiles
For a couple of days I can't realize optimization. I have a map generator (it creates map randomly) and it fills vector with tiles (with map length 512 you get ~20000 elements) So, when rendering ...
0
votes
1
answer
31
views
Why my character won't jump with my code?
I have this problem with my 2D game project,I pasted and modified it a little bit from the code can be found in this video:https://www.youtube.com/watch?v=dwcT-Dch0bA
But the problem is it won't jump ...
-1
votes
1
answer
22
views
What is this called? Polygon/Vertices/XY Points Related
I am looking for the right term for this procedure:
Creating polygons with each point (x,y) generated through the application.
Example if I have this picture with this shape (white background is ...
2
votes
0
answers
54
views
Finding repeated pattern in a set of points in the plane
Consider the following problem: You have data that describes a rectangular Printed-Circuit-Board (PCB), for example a list of polygons in the plane with type information (that can be represented by a ...
0
votes
1
answer
80
views
How to implement player state machine
I am very new to godot, and making 2d action platformer. I am trying to implement player state machine by following Finite State Machine in Godot by Nathan Lovato from GDQuest. However I am not sure ...
0
votes
2
answers
40
views
python 3d list manipulation
I have a 3d list
aa = [[[2, 3, 4, 5],
[ 6, 7, 8, 9]], [[11, 12, 14, 15]]], which consists of two 2d lists
how do I get this result
[[2, 6], [11]]
the first element of each sub list.
b = []
for i, row ...