7,613 questions
0
votes
0
answers
30
views
How should I configure a pathfinding algororithim for my new level generation program
my problem is that I have a 2D array like this:
[["#", "#", "#", "#", "#", "#", "#", "#", "#", "#&...
-1
votes
0
answers
22
views
Unity 2D: new input system issue with JUMP Action via CallbackContext canceled
This is my code for Jump Action using the new input system:
/// JUMP action callback
public void Jump(InputAction.CallbackContext context)
{
if (context.performed)
{
//hold down button:...
1
vote
1
answer
54
views
How do I make an algorithm for tracing lines given a set a points?
I need an algorithm to position lines on a set of points in a 2D environment. The algorithm should identify collinear points within a specified tolerance and place lines accordingly. Each resulting ...
-2
votes
0
answers
36
views
Paint bucket algorithm [closed]
Does anyone know the fill color paint bucket algorithm, like the one used in Microsoft Paint? I have a canvas that was created using raylib, like this:
# Create the canvas as a render texture
#--------...
1
vote
1
answer
41
views
Unity Find all Gameobjects with certaint maintag, not having to specify the subtag?
I´m making a simple Unity 2D Idle game rigth now with a lot of balls jumping around and making money. I am currently using subtags to declare them( For everyone who doesnt know that, you can make ...
-1
votes
0
answers
40
views
circle moves too far through a collection of points
Long story short, I'm making a trench warfare game. Trench walls are represented by an array of points, and I need my game characters, using a circular colliders, to stop when they hit a point, and ...
-2
votes
1
answer
46
views
Replace dash and increment for number of mines adjacent [closed]
I'm trying to replace the dashes in this 2d list for number of mines adjacent
grid = [["-", "-", "-", "#", "#"],
["-", "#",...
-1
votes
0
answers
21
views
Unity 2D sidescroller Raycast ground detection problem
I have a character with box collider 2d attached to it and 2 raycasts facing down to check if the character is grounded (if it collides with groundlayer it sets isGrounded= true). But there is a ...
0
votes
0
answers
31
views
Mesh doesn't render in Unity 2D
I'm just starting in game development and I'm working in Unity, 2d. I worked through a tutorial to make a simple mesh, in order to make a field of vision of the player and npcs. All of my code and ...
0
votes
2
answers
42
views
2D Canvas JavaScript | How do I draw a circle in canvas that is set to a defined number of degrees?
I simulate an interactive view for a player. As long as a component of the game is within the view width, it should be possible to interact with it. With my code, it is not a problem to play the ...
-2
votes
0
answers
29
views
I am currently working on a scoring system for a game using a TMPro, but it will not work [duplicate]
When I play the game in the Unity Engine, it runs well, but does not show the score. When I looked at my TMPro, it said that its position on the Y axis was -36.39999, another asset was positioned ...
0
votes
2
answers
58
views
IEnumerator Not Taking Input Value
I'm making a turn based RPG in Unity and I have a slider that pops up when the player attacks. A runs down the slider and the closer the player gets the slider to the center and presses Z, the more ...
0
votes
0
answers
17
views
Player swinging slowly with Distance joint in Unity 2D
I’m making a grappling hook with a distance joint in my 2D platformer game. However, the player is supposed to swing fast when they hook onto an object, but instead, they are swinging slowly.
I tried ...
0
votes
0
answers
29
views
Unity2d Custom Made Sprites Imported In The Engine Lose Quality
I created a PNG image of slime with a size of 360x360 pixels in Krita, dragged it into Unity2D Editor, resized it to 0.3 on the X and Y axes, and it immediately got pixelized... How can I fix that?
I ...
1
vote
2
answers
42
views
Masking and SortOrder Text in 2D game
I'm creating a 2d game in Unity with simple cards that can be dragged from hand to be played in the middle of the game space. The cards are created from multiple sprite GameObjects along with their ...
0
votes
1
answer
39
views
How to make player stick to collider in Unity
I'm trying to make a gameplay where you can jump between asteroids in a 0 gravity space. I want my player to stick to the asteroid and be able to walk along its surface until he jump to go away.
I was ...
0
votes
0
answers
38
views
How to get distance between an object and viewpoint after rotating projected 3D coordinates on a 2D plane?
I have a question related to projecting 3D xyz coordinates to a 2D representation in a window. So far, I have succesfully created a 3D world where the coordinates are happening correctly. I have also ...
0
votes
0
answers
74
views
How to convert point cloud to textured mesh model or colored mesh model in python
I'm trying to convert a 2d image of a leaf
into a 3d textured mesh model or colored mesh model using python in colab. I followed this guy tutorial. But i am facing some problem when trying to convert ...
3
votes
1
answer
81
views
Polygons on 2D plane: Calculate the exact shift to resolve overlaps
I'm working with polygons on a 2D plane that have Tetris-style gravity. Each polygon can rest either on the X-axis or on top of another polygon. If a polygon overlaps with any other polygon(s), it ...
0
votes
1
answer
114
views
Unity 2D following the enemy behind the player, avoiding obstacles
I'm having a problem using this script. Could you help a newbie?
I need the enemy to chase the player and avoid obstacles. Game from above
using System.Collections;
using System.Collections.Generic;
...
-1
votes
2
answers
68
views
The trigger doesn't stop the enemy from walking
I'm having an issue with my light system in my game made with unity, where I'm trying to stop the enemy when he touches the light emitted by the player, but when he touches the light, the enterTrigger ...
0
votes
0
answers
27
views
Platformer game collision detection not working
I'm trying to implement collision detection into a platformer style game in XNA/MonoGame.
I'm following two separate tutorials, one for an animation manager, and another for adding collision. I'm ...
0
votes
0
answers
22
views
How to Convert 2D Lines from a DXF File into 3D Walls in Unity?
I'm working on a Unity project where I need to automatically generate 3D walls based on 2D lines extracted from a .dxf floorplan (AutoCAD format). I'm using the IxMilia.Dxf library to read the DXF ...
0
votes
0
answers
31
views
Unity 2D IK character Help(holding 2H weapons)
My IK character that have arms that follow my cursor
How can I connect arm on the right to the weapon? When I swing weapon to left, because right left arm is closer right arm cannot reach there and ...
1
vote
1
answer
141
views
Sorting 2D points clockwise
I found a way to sort clockwise 2D points in Unity, but for some reason that i don't understand there are sometimes points still in the wrong order.
On the first picture the red sphere is the center ...
1
vote
0
answers
49
views
2D Top Down Slime Jump
I am trying to make a Top down game with the main character as a slime. i am trying to get it so when the player clicks with the mouse the slime jumps to that location and actually looks like a jump.
...
0
votes
2
answers
108
views
Finding the intersection of two lines a given perpendicular distance from the line of intersection
I'm looking for help to solve the following situation. I have a line segment defined by two points P1 and P2. And I have a ray that starts at P3 and intersects segment P1P2 at P4. I want to calculate ...
0
votes
0
answers
14
views
Regions bounds (created from a Path) are not as expected
I need to check if a point lies inside of a Path describing a 2d shape.
As Path object doesn't have contains function, but Region does and we can construct a Region out of a Path I tried it.
But the ...
0
votes
1
answer
27
views
Getting uniform coordinates from a 3D plane projected as a 2D plane
3d plane projected to a 2d polygon
I have the coordinates of the vertexes P1, P2, P3 and P4 that define a rectangular rectangle.
Those coordinates always define a regular rectangular area and the ...
0
votes
0
answers
19
views
camera project image onto CAD object
I am trying to project on image onto a CAD object using python. I know it is possible in Blender or other 3d softwares, but was trying to find a way to do it in python. Does anyone have any ...
1
vote
2
answers
66
views
frame rate and delta time my sprite animation with SFML in C++
I am studying 2D animation using C++ and SFML library. I use a png spritesheet. The code I wrote as a starting point is the following:
#include <SFML/Graphics.hpp>
#include <iostream>
int ...
0
votes
0
answers
35
views
I was basically trying to make my function bounce when it hits the end of the window's sceen but instead it only stops and doesn't bounce
So here, I am trying to implement a Bounce logic whenever the object called Poo (followed a tutorial) hits the end of the screen. I copied my implementation for making any object not go off the screen ...
0
votes
0
answers
30
views
Calculate Moving Average Window over 2D grid in Python - in the top there is a white horizontal area which grows bigger the bigger the chosen window
when I calculate the mean over a 2D moving grid window in Python, but there is a white line just in the top, not on the bottom, right or left, but horizontal, after which there's just white in the ...
0
votes
0
answers
33
views
Hard dropping blocks isn't instant and doesn't put it in the correct spot
Godot Version: v4.3.stable.official [77dcf97d8]
I'm trying to add the ability for blocks (frozen RigidBody2Ds) to be hard-dropped instantly (they get placed on the closest surface directly below them) ...
1
vote
3
answers
51
views
Why does my dragging logic in Unity not work? (only once)
I have a script attached to a GameObject with a Collider2D attached to it as well.
The script should enable me to drag the GameObject while holding down the mouse and "dropping" it by simply ...
3
votes
2
answers
233
views
Python opencv draws polygons outside of lines
[edited] It appears there is a new bug in opencv that introduces an issue causing fillPoly's boundaries to exceed polylines's.
Here is humble code to draw a red filled polygon with a blue outline.
...
1
vote
0
answers
43
views
Weird "bug" in my LOS check, what other algorithm should i use?
Image Link
So as you can see there are some weird dots on the left side, which dont look so pleasing. These weird dots are actually correct but i dont like them. I use a line algorithm with some extra ...
0
votes
0
answers
14
views
How to ensure that a line drawn with GL_LINES is always visible?
I need to draw a waveform exactly 1 pixel thick like Sound Forge or Wavelab does.
For the example, a stereo sine wave is shown at 1:4 and 1:2 ratios.
(make sure to view the pictures in full size)
...
0
votes
1
answer
128
views
"Checkerboarding" effect when rotating sprite in software renderer?
I'm writing a 2D software renderer and when rotating in certain angles I will get a sort of "checkerboarding" effect with my sprite pixels:
To try and get proper rotation, I tried rounding/...
0
votes
2
answers
115
views
Prevent objects from overlapping when spawning in random locations (Unity 2D)
I’m struggling to stop prefab objects from overlapping when they spawn. I’ve Googled a lot of similar questions and realized that this issue is common in game development, but I’m having trouble ...
1
vote
1
answer
121
views
C# Library for 2D shape drawing user interface [closed]
I am currently developing a Windows Forms Application in C#. In my application the user needs to be able to draw shapes like lines, rectangles and polygons on a specific area and then they need to ...
0
votes
0
answers
30
views
How to achieve 2D product preview images?
I want to implement a product customization function, which renders the final effect image for users to preview by uploading customized images. For example, here are two bleeding images of products. ...
0
votes
1
answer
65
views
2d tilemap or 3d isometric?
I am learning unity for fun and to experience myself I would like to recreate my childhood game : master of olympus zeus. Should I go 2D with tilemap or 3D with camera setup to reproduce the isometric ...
0
votes
0
answers
24
views
Pong ball slowing down on contact instead of speeding up
So I was following a simple pong guide to kinda ease myself into coding and it was all going fine until the person added code to speed up everytime the ball came in contact with everything, except for ...
-1
votes
1
answer
37
views
Cannot implicitly convert type 'UnityEngine.Rigidbody2D' to 'UnityEngine.Rigidbody' error in Unity 2D core
I am new to Unity and I am following a tutorial, but when I write the code I get this error:
Cannot implicitly convert type 'UnityEngine.Rigidbody2D' to 'UnityEngine.Rigidbody'
The code:
using ...
-1
votes
1
answer
36
views
How to apply a offset to child gameobject in Unity2D
I'm trying to apply an offset to a unity child gameobject who's transform component values doesn't change on its own.
I've tried solutions like the pictures show but none of them work how would i ...
0
votes
0
answers
24
views
2d top down car steering mechanism in godot fails to rotate the car and infinitly spins it instead
I'm trying to code a 2d top down car controls for my godot project.
This is the car controls algorithm and it takes a vector parameter beign the joystick vector so the player's input.
GDScript
extends ...
1
vote
0
answers
28
views
Impossible to draw pixel-perfect aliased 2D lines?
Would like to draw pixel-perfect aliased 2D lines in Unity but I can't get a good result.
Code:
using UnityEngine;
public class GLTest : MonoBehaviour
{
[SerializeField]
[HideInInspector]
...
0
votes
1
answer
229
views
Why Camera2D (or viewport) is not moving in Godot 4?
I created the main level scene of my game and it was working until I worked the title scene and the transition. I have a Camera2D node with a simple script:
extends Camera2D
@export var desCentrar := ...
0
votes
3
answers
78
views
Minimizing and simplifying a 2D triangle mesh
Goal:
I have a list of lots of triangles on a 2D surface, represented as std::vector<QPolygonF>. I want to transform this list into another list of triangles that have the same outline, but no ...