Questions tagged [2d]

2D computer graphics is the computer-based generation of digital images—mostly from two-dimensional models.

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

Simplest way to use `CGAL::simplify` on a 2D Arrangement?

I have a CGAL 2D Arrangement, and I would like to simplify each sequence of egdes separated by degree-2 vertices using CGAL::simplify. Is there a simple way to do that, or do I have to do something ...
Clement's user avatar
-1 votes
0 answers
20 views

How would I take input from a text input field, then send that through my script and print out text using Unity 2D UI?

I'm having an issue figuring out how I could use this code: ` class Program { public static void Main (string[] args) { Console.WriteLine("Enter text to encode:"); string input = ...
R. Gardiner's user avatar
0 votes
1 answer
17 views

Unity 2d jumping horizontally not always works

So i have this code for player movement in Unity: using UnityEngine; using System.Collections; public class PlayerMovement : MonoBehaviour { private float horizontal; private float ...
edgzoah's user avatar
-1 votes
0 answers
65 views

Position of Bomb when firing

Can anyone suggest to me how to fix this? I went to find out what happening, then it was due to the rect.x of the bomb. However, when I fixed that it still struggled, my character when moving back or ...
chews's user avatar
  • 39
1 vote
1 answer
25 views

Render a cross-section of a 3D scene in Godot

I'm looking to make a puzzle platformer 2d game in Godot, where the user manipulates the Z axis of the scene to reveal hidden elements of the scene. Before I start making it, I wanted to know if it ...
logobot's user avatar
  • 13
0 votes
1 answer
35 views

Attempted Perlin Noise in C# but results are all too close to 0

So I am trying to use 2D Perlin Noise for a Monogame project and I read through the wikipedia article (https://en.wikipedia.org/wiki/Perlin_noise) covering the approach and tried to code it. After a ...
Phlips's user avatar
  • 1
-1 votes
0 answers
12 views

Need a timer/clock of some kind for my 2d shooter so that all the bullets dont shoot at the same time

I am making a 2d shooter much like space invader where you fly a ship and try to shoot down approaching enemies. To destroy the enemies the ship can shoot small bolts at the enemies. Now i am trying ...
Valter.K's user avatar
-2 votes
1 answer
54 views

I can't display this array correctly [closed]

I want to create an array like this. But so far this is what I'm getting. enter image description here int[][] a = new int[10][10]; int value = 1; for (int i = 0; i < 10; i++) { for (int j = 0; ...
Axel4Web's user avatar
0 votes
0 answers
26 views

Quadtree of 2D array

so we have this project where we have to build a quadtree from a 2D array in parameters, the thing is my inital code doesn't manage well rectangle arrays when i want to expand the length of the width ...
Dannette15's user avatar
-1 votes
0 answers
30 views

python pygame Two dimensional platformer that the collisions do not work as they fall through platform or do not stop [duplicate]

i am making a 2d platformer and the gravity will pull the player through the platform and the collisions do not stop the player even when it detects it collides i used collide rect to detect when the ...
liamm's user avatar
  • 1
-1 votes
0 answers
22 views

C# 2D Layout library [closed]

This is my first time asking something on Stackoverflow, please bei gentle. I wanted to build a c# app that can help me with making a 2d layout where i can drag and drop forms (rectangles) and save ...
rupey's user avatar
  • 9
0 votes
0 answers
15 views

How to draw offcanvas of offscreen canvas to onscreen canvas?

What I'm making a 2D game on pure JS and I use CanvasRenderingContext2D.translate() to emulate camera movements. I mean that my drawable level is much bigger than the canvas itself (when the canvas ...
aexra's user avatar
  • 1
0 votes
0 answers
7 views

What is the method for 2D collisions detection that most engines uses?

I wan't to make my own 2D game without a game engine just for learning. I am struggeling with the collision detection. I found a lot of methods but the best one is SAT method. But the thing that i can'...
Sunny's user avatar
  • 1
1 vote
1 answer
52 views

Why is unity not modifying my player's position?

I'm making a 2D top-down game, and I'm currently trying to implement a checkpoint system. The checkpoint saves the scene the player was in correctly, and it saves the player's X and Y coordinates. ...
PawzyPuppy's user avatar
-1 votes
0 answers
21 views

Drag and shoot mechanic for a ball that bounces from walls with reflected vector

I made a simple Drag and shoot mechanic for a 2d ball, but when trying to implement a feature that would let the ball bounce off walls, the ball just slides down the wall. I used ai to generate a code ...
VipR's user avatar
  • 25
0 votes
1 answer
19 views

Sprite jitters when camera is smoothed

Whenever I move my 2D Camera around (when smoothing is enabled), the sprites seem to shake, which is visually distracting - is there any way to disable this?
LeoDog896's user avatar
  • 3,612
1 vote
0 answers
16 views

Circle automatically divided and colorized according to input on unity

i’m trying to make a fraction calculator simulator kinda like the pic below enter image description here so when input is changed it automatically change according to the input are there any way to do ...
astraplaneta's user avatar
-1 votes
0 answers
36 views

two dimensional platformer collisions not working on pygame [duplicate]

I am trying to create a 2d platformer but the collision detection is not working as i keep falling through the ground I have tried following this tutorial https://docs.replit.com/tutorials/python/2d-...
liamm's user avatar
  • 1
0 votes
0 answers
31 views

How to eliminate response delays when clicking on the screen in my mobile game

i am creating a 2D game in Unity similar to an already created mobile game by the title (knife hit). During the creation of the game I came across a problem, namely on the computer the game works fine,...
Viw0a's user avatar
  • 37
0 votes
1 answer
32 views

Blendspace 2D not updating when input direction is changed

I'm trying to animate a 2D character using a blendspace2D in an animation tree. I've built a basic state machine where, when the charge input is detected while the directional movement is not (0, 0), ...
DLS's user avatar
  • 15
0 votes
0 answers
53 views

Drawing QPolygonF to QSGGeometry

I'm trying to draw a polygon using QSGGeometry/QSGFlatColorMaterial. If I draw a rectangle with right corners, then everything works correctly: QPolygonF polygon; // Rectangle with right corners ...
posix's user avatar
  • 101
0 votes
1 answer
30 views

Invalid set index 'texture', in GDScript?

I keep getting an error, when I try to run a function from a different script. Script 1: extends Node2D var tex = preload("res://icon.svg") @onready var sprite = $Char/Person func ...
ogerboy_'s user avatar
0 votes
1 answer
40 views

problems with velocity and rotation

my square is supposed to rotate 90 degrees when jumping. but the rotation interferes with jump height. at first i tried actually rotating, now i'm trying an animation. i tried to change the inertia ...
jude's user avatar
  • 1
-1 votes
0 answers
11 views

My wallslide is not working even through it is running perfectly

private void WallSlide() { bool horizontalcondition = horizontal != 0f; Debug.Log(horizontalcondition); if (IsWalled() && !isGrounded() && horizontalcondition) { ...
VELUPUGONDA BHAVANI KRISHNA's user avatar
0 votes
1 answer
27 views

Double collision of prefab in Unity

I would like that when two spheres (prefab) meet they disappear and form a square, but 2 are formed using System.Collections; using System.Collections.Generic; using UnityEngine; public class circle :...
Matteo Bertoglio's user avatar
-1 votes
0 answers
16 views

Unity2D - Randomly place items within tilemap cave on any surface?

I've got an underwater cave made from a tilemap. It has a floor, walls and a ceiling. I want to be able to randomly instantiate rock items for the player to mine from all surfaces as the player can ...
wgibbsw's user avatar
  • 15
0 votes
1 answer
21 views

Problems in Unity with layers and random lines

Firstly my grid doesnt aline on different layers of the tilemap: Ground layer , Animation layer. In the examples you can see my ground alyer and my animation layer, the grid just doesnt align. And ...
Niek Slijt's user avatar
0 votes
0 answers
28 views

Can't use any function from Tilemap.cs library in Unity 2D 2021.3

I'm trying to create a simple 2D game in Unity. That's the problem code: using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.Tilemaps; ...
Inette's user avatar
  • 1
0 votes
0 answers
22 views

In the flip function my character's gun is pointing elsewhere. I want it to look at the position of my mouse

My weapon object is my character's child object and so when my character turns, my weapon object is facing where my character is facing. What I want is that my weapon object can move in a different ...
F3lla's user avatar
  • 27
0 votes
0 answers
37 views

Two dimensional transient heat conduction problem with heat source

There is a question about 2D heat conduction with heat source in the center. and its image is like this. Given: The 2cm*2cm heat source could be considered as one node. The temperature of all the ...
五里霧中's user avatar
1 vote
1 answer
54 views

Balls phasing through each other in physics engine

I'm trying to write a simple physics engine in C++; it's been going well so far, and all of the functions work as intended except for the physics between the balls themselves. During collisions, the ...
metror's user avatar
  • 11
-1 votes
1 answer
45 views

How to save/load the scene of a checkpoint in Unity?

I'm coding a top-down 2D Unity game. There is a room (separate scene) with an enemy and a checkpoint inside. I have tried to make it so that I can go to the checkpoint, have it log my location and ...
PawzyPuppy's user avatar
0 votes
0 answers
29 views

Measuring the distance of detected objects in a 2D image/video

I have trained a YOLO pose estimation model to detect monkeys in videos. I have 20h + video footage from a stabilized 2D camera in a cage with about 12 monkeys. The detection and key point estimation ...
laurahagedorn's user avatar
0 votes
1 answer
47 views

How can i do shooting mechanic on unity2d?

i want a shooting mechanic but i cant spawn bullet on front of my gun. Unity This circle always looking my cursor with a Z rotation so i cant spawn bullets with x or y axis i need to base Z rotation ...
SethWithG's user avatar
-1 votes
2 answers
196 views

Generating data for OpenGL 2D rendering perfomance is slow but Monogame.GL's data generation/rendering methods are speedy. How? (CPU Perfomance?)

I am trying to make a custom tile map editor using OpenGL, C++ with GLFW(Version 3.3.8) library but I am having major issues with generation speeds but I can run games that have large tile maps such ...
sonofjacks's user avatar
-1 votes
1 answer
105 views

Optimizing millions of points render using python [closed]

I am trying to display a million points in 2D using pygame and (maybe) openGL. The problem is, my code isn't optimized yet to make it run at a high frame rate, even though I have a really good GPU. ...
user19013678's user avatar
0 votes
0 answers
30 views

Methods to procedurally generate objects and enemies in an open world

I've been working on my first game recently and have gotten to the part where I need to consider how I handle creating my game world and configuring how levels are even created. I've been thinking of ...
BedlessSleeper's user avatar
0 votes
0 answers
18 views

Ran into a URP sorting issue in Unity

Apparently there is no way to access the transparency sort axis in code for Universal Render Pipeline's 2D Renderer data asset. I've looked at the Unity manual and have had no luck. I need to access ...
Phantom Red Interactive's user avatar
-1 votes
1 answer
70 views

Show device specific div

When the game starts, I need to show the start game button to the first connected player and the waiting text to the second player, but it shows the waiting text to both players, how can I solve it? ...
umutK's user avatar
  • 1
0 votes
1 answer
68 views

How can I get the projected distance between a line segment and a circle?

I am making a 2D shooting game in Java, I need to be able to work out the maximum distance a circle could travel forwards (Only on the Y-axis) and get the distance as a float value, I have looked ...
Reiss Gomez's user avatar
0 votes
0 answers
14 views

Changing from 3d filter to 2d, first 2d filter shows white face

Switching to 3D to 2D gives me a white/blank face filter, can't seem to figure out how to avoid that, using material to hide the 2d Filter when I want the 3d filter to be shown and remove the material ...
Karl Cusi's user avatar
1 vote
3 answers
174 views

What is the fastest way to check if a line segment contains a point using C++?

I know that there are already many questions about how to check whether a line segment contains a point or not, but my question is specifically about which method will most probably be most efficient ...
JensB's user avatar
  • 911
1 vote
1 answer
151 views

Godot render image with different shaders to a texture

I'm sorry, I can't explain it normally, but I hope you understand. In general, there is an image from the camera and it is displayed in the game. Also in 3d, the camera creates a depth texture that is ...
certrue's user avatar
  • 11
1 vote
2 answers
71 views

Finding an average representation for a set of 2D contours

I work at a lab and use mice for behavioral studies. Part of what I want to show is how a known stimulus will elicit movement of the ear in a predictable way. I have a script to segment an ear across ...
Brian Constantinescu's user avatar
0 votes
0 answers
14 views

Monster Mash shortcuts

Monster Mash is located here (https://github.com/google/monster-mash): what is keyboard shortcut to save the obj file? Ctrl+s only gives a message "Saving project to a zip file". There is no ...
anildadj's user avatar
0 votes
2 answers
59 views

Unity Procedurally generated GameObjects does not generate in the desired way

I am trying to use Perlin noise as a pattern for generating forests / clusters of 2D prefabs in unity, for my procedurally generated game. So my plan was to generate Perlin noise, and then use the ...
Tobias Thy's user avatar
0 votes
0 answers
33 views

Calling a function of a GameObject by button click in Unity 2D

I have a GameObject in my scene, it contains a script. The name of the object is - WoodCutter(Clone), the script name is WoodHarvester.cs. I also have the UI Canvas with few objects. The code ...
Paul Sotena's user avatar
0 votes
2 answers
46 views

how do i search a 2d list to be able to play rock, paper, scissors?

still kinda new to this site (sorry if i messed up) so my homework for the week is working with lists... my professor wants me to modify my rock, paper, Scissors game to use a 2d list. which i was ...
Andrew's user avatar
  • 3
-1 votes
1 answer
24 views

What is the most efficient way of detecting all objects in a set radius after a short interval. 2D

I'm working on a 2D tower defense game and I'm not sure how to make the turrets get a new target. I want them to focus the enemy that is closest to the end. And I wonder, what is the most efficient ...
IsaKobe's user avatar
0 votes
0 answers
42 views

my bullets use raycasts to detects everything they miss in a physics update but it doesnt do damage

using System; using System.Collections; using System.Collections.Generic; using System.Runtime.CompilerServices; using System.Threading; using Unity.VisualScripting; using UnityEngine; using ...
kraken's user avatar
  • 1

1
2 3 4 5
151