Questions tagged [2d]

2D refers to two dimensional space where coordinates are represented with X and Y values.

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

anchoredPosition of Item slot(UI image) changes when it becomes a child of another UI image

The UI elements in question are under a world space rendered canvas. I'm trying to place an item (UI image) into an item slot (UI image), so that it drops right in the middle of the image. This code ...
user avatar
  • 101
0 votes
0 answers
23 views

Unity Isometric Tilemap Sorted Wrong

After changing the Graphics>Scriptable Render Pipeline Settings to the Universal Render Pipeline, my isometric tilemap looks weird. This project is 2D. My tilemap settings: If I want to use the ...
user avatar
  • 137
0 votes
0 answers
35 views

modifying unity scenes

I would like to use Unity scenes (as it's visually easy to create levels) but I want to modify them as the player interacts (for instance, if the player broke a glass, the glass should be broken ...
user avatar
  • 639
0 votes
1 answer
63 views

Script not working on object in unity 2D

I was following a tutorial where the gameobject was to spawn randomly within the screen. The code I used is as follows. ...
user avatar
0 votes
0 answers
16 views

Is there a lighter way to implement "object stops when hit wall" without relying on Dynamic gameobjects in Unity3D (2D)?

I am currently using a Dynamic GameObject for my entities, but I feel as if that will risk slowing down the game on weaker hardware (especially when there are hundreds of entities). Not only that, but ...
user avatar
  • 1
1 vote
1 answer
153 views

How do I get OnTriggerStay2D to consistently work in Unity?

(2D Project) I have a very basic set-up in which I have a Hallway with a door and a bunch of other objects. I have a player that starts on the left side of the hallway and only moves on the x-axis. ...
user avatar
0 votes
1 answer
31 views

Control different speeds for moving left/right, and facing that direction

I have a game idea... and I need a script where I can control the speed for moving left, and control another speed for moving right. But, I also need to let my player face that direction. ...
user avatar
0 votes
0 answers
33 views

Gun keeps firing before the player is finished rotating

I have a script that manages player rotation and shooting. When I click on an enemy, the player is supposed to turn toward the enemy and then shoot in the direction they are facing. However, the ...
user avatar
0 votes
1 answer
116 views

How to rotate parent and all children by center pivot?

I have a DoorSprite with an Animator component which I animate by rotating it by 90 degrees (makes the door look like opening ...
user avatar
0 votes
0 answers
59 views

How to layer multiple terrain tile types using Marching Squares

I've done a lot of research on marching squares, including: https://www.omiod.com/docs/pdf/Squares-Made-for-Marching.pdf https://en.wikipedia.org/wiki/Marching_squares https://www.reddit.com/r/...
user avatar
  • 11
0 votes
1 answer
52 views

How to spawn card sprite

I have a card sprite that I would like to spawn at a specific transform position but can't get anything to appear My Code - ...
user avatar
0 votes
1 answer
52 views

Tilemap is rendering all tiles as black squares

I'm trying to render a 2D tile map. I've placed a Tilemap object in the scene from the create 2D object context menu, set a reference to it to one of my script ...
user avatar
0 votes
0 answers
65 views

Outline Mesh Unity 2D

I have a procedurally generated mesh in Unity and I was hoping to outline the edges of it. I've got a small shader for an outline but instead of it working around the edge the mesh ends up filled with ...
user avatar
  • 223
0 votes
0 answers
21 views

Applying quadratics to velocity based player movement

In a speed based system where player.x and player.y +=1 when a button is pressed, a 3pt quadratic can be calculated via ...
user avatar
  • 197
0 votes
0 answers
21 views

How to position an Image atop a specific point on another Image?

I'm trying to update an older 2D game to run on Unity. One thing it does is place an overworld map with a bunch of icons that you can click on. I've set up a Canvas ...
user avatar
0 votes
1 answer
117 views

How can I make my Unity 2d scene pitch black, except for manually added lighting?

I have tried modifying all the settings suggested that I can find, but the lighting of objects in my Scene remains unchanged. I've used the "Generate" button, I've set "Intensity ...
user avatar
1 vote
0 answers
348 views

Pixel-perfect jitter-free motion

Here's a thing I cannot wrap my head around: When we are talking about low-resolution pixel art, there is a subcategory that deals with pixel perfection: Like in the olden days you are restricted to a ...
user avatar
  • 111
2 votes
1 answer
75 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 ...
user avatar
0 votes
1 answer
89 views

Need help with locking the Y axis on camera

I am working on a small 2D platformer in Unity for my school project and I would like to lock my camera on Y axis (so it can move horizontally, but when the character jumps it doesn't follow the jump)....
user avatar
0 votes
0 answers
29 views

Why is my blender 2D ring so pixelated when imported into Unity?

I created a simple ring in blender, yet when I import it into Unity it is horribly pixelated and choppy looking. I want the ring to look perfectly smooth. In blender, I selected the "shade ...
user avatar
0 votes
2 answers
125 views

Converting from global coordinates to local coordinates

I am trying to create a Radar/Minimap for the F1 2021 game in C#/WPF. Here is a image of what I am trying to replicate In the image, the white car (my car) will always face the direction it is going. ...
user avatar
  • 1
0 votes
1 answer
91 views

Is a platform an entity in 2D Platform in ECS pattern?

I've been coding a small 2D platformer applying ECS pattern. However, I'm struggling with a issue. When building each platform from tilemap and such platforms need to be collided by other entities, ...
user avatar
  • 1
0 votes
0 answers
230 views

How can I force my Navmesh agent to only move four directions? (for 2D)

I'm making a 2D game in Unity. For 2D I am using the NavmeshSurface2D-plus master package available on github. My enemy object is chasing my main character nicely, it's ok. I set my main character to ...
user avatar
  • 13
0 votes
1 answer
77 views

How can I update the Navmesh path in 2D games?

There are destructible and indestructible objects on the map I created with Tilemap, and I create a walkable area (bake) for my enemy object using the information I found on the internet and the ...
user avatar
  • 13
0 votes
1 answer
158 views

High CPU usage with Godot tilemap

I am using Godot as my game engine and I am making a basic 2D game, I have a small map with 1 Player and 5 Enemies walking around in it. The game includes some basic code for walking and shooting at ...
user avatar
  • 45
1 vote
3 answers
632 views

Unity2D Grid-based Sprite Movement and Tilemap Collision

I have just started working with Unity2D to simply learn how it works. I've been trying to get grid-based movement and collision with a tilemap working, and it's mostly there, but there's one bit that'...
user avatar
1 vote
0 answers
72 views

Odd behaviour from parallax

First of all I'm going to say that I'm not trying to blow my own trumpet or anything but usually I'm able to figure this stuff out on my own. But as for now I'm fully stumped. Maybe I'm having a mind ...
user avatar
0 votes
0 answers
22 views

ACharacter falls instead of landing back at its starting point when jumping at the edge of a ledge

I’m using ACharacter class for a 2D platformer game in Unreal 4.26. When the pawn (the main character) starts to jump from a the very edge of a ledge, it’s not able to land in the same position. ...
user avatar
  • 101
0 votes
0 answers
17 views

More smaller scripts or less larger in Unity 2d Development? Better or worse performance? [duplicate]

In my unity 2d game I had large amount of scripts which were components of different enemies and obstacles. All of them were checking for collison, had FixedUpdate, Start and OnCollisionEnter2D and ...
user avatar
0 votes
0 answers
52 views

Optimal data structure for managing AABBs to minimize collision check queries

Say I have thousands of 2D Axis-Aligned Bounding Boxes (AABBs), and a single point. I'm checking whether a point is inside a certain AABB before performing some expensive logic. ...
user avatar
0 votes
0 answers
94 views

character movment and physics on 2d game

I'm developing a client/server multiplayer game. in server side i need prevent players cross map objects like walls also i need prevent player go inside each others, instead want to slide them along ...
user avatar
  • 113
0 votes
1 answer
161 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 ...
user avatar
0 votes
2 answers
51 views

How to make windows that pick up what appears in the other

Basically there are 2 windows that you can drag and drop around the screen. Whatever appears in one window will also appear in the other. The two windows cannot go one over the other. This is a demo ...
user avatar
  • 101
1 vote
1 answer
90 views

Cannot properly get 2D top-down tile-based collisions

I am using HTML, CSS, and plain JavaScript for a 2D top-down tile-based simulation. I am trying to do collisions in which, for example, if I move up and hit the ceiling collision tile, I cannot ...
user avatar
  • 35
0 votes
0 answers
22 views

Struggling to get layer collision to work without stopping movement

I currently have my player object set with a dynamic rigidbody and a box collider, and the object I want it to collide with just has a box collider. The player is on the Player layer, and the object ...
user avatar
0 votes
1 answer
98 views

Does the Z axis matter at all in a 2D project, when using layer collision for all collision detection?

As I understand it, the Z axis is responsible for the rendering position of the object in relation to the camera/other objects, and layer collision only checks if an object collides based on the x/y ...
user avatar
0 votes
1 answer
49 views

How Can I Order The Scores List By Newest Added? Unity C#

I have 5 scripts to make the scoreboard. But I don't know how to order the list (the scores which are stores in a list) by newest added. Can someone please help me? Thanks :) First Script: ...
user avatar
  • 19
5 votes
2 answers
152 views

2D topdown generating stairs (access) to generated hill

I'm doing 2d topdown procedurally generated world. I'm generating perlin height values, and when certain value is crossed I'm generating one level higher, while edging biomes creates cliff of the ...
user avatar
1 vote
1 answer
92 views

Having trouble implementing edge collapse operation with half-edge data structure

I'm trying to make a half-edge data structure to interact with meshes in 2D space in Unity but I'm having trouble with implementing an edge collapse operation that merges one vertex into its twin half-...
user avatar
0 votes
0 answers
22 views

What is the most efficient way to keep a vertex contained within a network of edges/vertices?

Given this picture, I want to move or displace the red vertex but I don't want it to pass the orange edge boundaries or the blue vertices. I either want to stop the red vertex when it gets close ...
user avatar
2 votes
1 answer
49 views

Only Square Textures loading correctly (Beginner question)

(Sorry if this has already been asked, I couldn't find any other question or source describing my problem) Okay so basically Square textures load and display just fine. But for some reason, when ...
user avatar
2 votes
1 answer
578 views

Spritesheet with unstable width

I'm working on my 2d game engine using HTML5 and Canvas. I have a sprite sheet, and each frame of this sprite sheet has its own size. Considering that the Viewport is following this sprite sheet (in ...
user avatar
-3 votes
1 answer
64 views

Can anyone explain this code? C# Unity [closed]

Can someone explain this code to me? ...
user avatar
  • 19
0 votes
1 answer
55 views

Determine when a character is stationary, and which direction they are facing

I'm currently trying to figure out two things for my character's movement and animation. A better/faster way to track when movement stops than the IsSleeping method. A way to track which direction my ...
user avatar
0 votes
1 answer
35 views

How to make a sprite face the mouse while remaining upright, without negative scale?

In the game I'm creating I have a sprite that needs to constantly be facing the mouse, but the sprite also always needs to be facing "up". Because of the Polygon Collider 2D and Shadow ...
user avatar
4 votes
1 answer
118 views

I want to cut a pizza slice out of a 2D circle using mouse input in Unity. What data structures and geometric formulas would be best for this?

I understand this is probably not an easy task considering I haven't found any code examples online that do something like this but if I wanted to take in mouse input lets say during a drag and use ...
user avatar
1 vote
1 answer
235 views

Pixelart loses quality when rotated in unity

Sorry, still fairly new to the game here but my pixel art gets little ridges on it when I rotate it in unity. I'd like the pixels to rotate all together. Is this just because I need to make my pixels &...
user avatar
1 vote
0 answers
84 views

How do I cut mesh partially with EzySlice?

I'm using the EzySlice framework to cut meshes (https://github.com/DavidArayan/ezy-slice). So far it can cut a mesh but infinitely but I want to be able to cut partially like this: As you see in the ...
user avatar
0 votes
1 answer
40 views

Overshooting when traversing between two points with a set velocity

I'm creating a prototype for something I may make into a game and I've run into difficulty in creating a method to move a ship along a line between two points. While it reaches the end point, it ...
user avatar
1 vote
1 answer
80 views

Find those points lying on a circle from a ton of points

Given a 2d scene and 10,000 players with coordinates in the scene, I want to implement a function, the input is a circle with the center coords and its radius, the output is those players that lie on ...
user avatar

1
2
3 4 5
67