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
0answers
81 views

Unity 2D softbody with custom spring

I'm trying to make custom 2D softbody physics that can interact with other Unity colliders. My starting point was to implement a custom spring joint capable of connecting two entities ("particle&...
0
votes
1answer
700 views

How to align the Polygon Collider 2D in Unity to match the position of Sprite?

How to align the Polygon Collider 2D in Unity to match the position of Sprite? I have a game object. It has a Sprite Renderer with an image. Now I add a Polygon Collider 2D component to the game ...
0
votes
1answer
153 views

How to detect if a 2D object overlaps any other 2D objects

I am programmatically placing 4 large dots on my 2D scene which already has some objects on it. If the new dot overlaps an existing object I want to destroy the existing object. All the objects have ...
0
votes
0answers
159 views

How to Implement One-Way Slopes?

I am working on a 2D platformer in Unity and am doing my own collision detection. I was previously using the method described in Sebastian Lague's popular YouTube tutorial, where you break your ...
0
votes
1answer
20 views

What is the best approach to minimise the lag caused by ping when spawning predictable entities?

When the client clicks it spawns a unit on the client-side which moves in a predetermined path, it also emits an event to the server which indicates that the client has spawned a unit. Once received ...
0
votes
1answer
73 views

Why the enemy is flipping constantly when it collides with an obstacle?

I'm making a 2D platformer with Unity. I have an enemy patrol that shoots bullet. The enemy is working fine until it reaches to a point that should be turn around. (when collides with an obstacle or ...
0
votes
1answer
57 views

Control how quickly 2D vehicle straightens out

I'm implementing vehicle movement in a 2D environment, where a vehicle consists of a front and a back "axle", both represented as 2D points. When the front axle moves, the back axle should ...
0
votes
1answer
43 views

Contact friction for overlapping rectangles

I am currently developing a top-down "tabletop simulator" where you are able to drag, drop and rotate playing cards on a table. The cards are able to overlap but do not interact as of yet. ...
0
votes
2answers
40 views

2D physics without "rebound"

I'm trying to get my 2D top down shooter to use -some- physics. I want the player and enemies not be able to exist in the same position, in other words, use collisions. My first attempt was to use a ...
0
votes
1answer
59 views

Object to reach height depending on its gravity and mass

A mathematician will probably think this was a silly question, but I'm not one and I'm in need of help :D I'm working in Godot and with its RigidBody2Ds (objects ...
0
votes
1answer
37 views

How to get object or its index from mouse coordinates? [closed]

Basically, I have a NumPy array of rectangles that store their colour and position. I want to be able to compare my mouse position and clicked on the rectangle's position and get the index or the ...
0
votes
0answers
101 views

Path following with turning radius and obstacle avoidance

I would like to move an object through a path found by A* star but taking into account the object's turn radius and movement speed, while also avoiding possible obstacles during a curve. After some ...
1
vote
1answer
46 views

Why does my collider behave strangely after a coroutine

So I'm trying to create a simple script that is going to handle the logic for cutting down a tree I'm experiencing some strange behaviour with my script. I have a private field which holds the "...
0
votes
2answers
48 views

Unity - Renderer "raycasts" from top down?

I'm trying to have objects in a game be selectable only from a top down orthographic camera view. I think having physics colliders might be overkill for that - especially because this only needs to be ...
0
votes
1answer
52 views

The farther I move my character, the more its projectiles fire in the wrong direction

I'm making a top down shooter, and the movement is working fine. However, I'm having trouble getting my Fire function to work correctly. When I run the game, it kind of fires in the right direction, ...
2
votes
0answers
393 views

How to load parts of a large tilemap like chunks in Unity 2d?

I use more pictures so you can understand my opinion better. Here is the video link I recorded. My code has a problem that I use for to render it and cause it to "lag" for 1-5 seconds, so I ...
0
votes
1answer
40 views

Need a little more help with rotating sword around player (Unity 2D)

this question is somewhat similar to my last question (found here). This time, I have upgraded to the new Input Manager and updated the script that uses the controller, but now I'm having trouble with ...
0
votes
1answer
28 views

Character Jump (AddForce) unusual behavior near objects in unity 2D

My character object has a single jump mechanics and I just noticed the whenever I press the jump button many times quickly in which the character is near a "Platforms like staircase, boxes or ...
4
votes
1answer
245 views

Supercover line algorithm from corners instead of the square's center?

I need to check whether a cell in a 2D grid is visible to the starting cell. I'm currently using amit's supercover line algorithm, this one https://www.redblobgames.com/grids/line-drawing.html#...
0
votes
2answers
348 views

Need help with rotating sword around player (Unity 2D)

I'm having an issue with rotating an object around another object in my top-down roguelike in Unity 2D. My goal is to rotate a sword around a player based on joystick input from a controller (as shown ...
0
votes
2answers
204 views

"Invalid call. Nonexistent function 'travel' in base 'Nil'."?

I was perfect as I could possibly be with this code but for some reason every time I try to play the game it just breaks. It says "Invalid call. Nonexistent function 'travel' in base 'Nil'." ...
2
votes
2answers
199 views

Should the entity handle his own movement?

I am currently building a simple turn based game with a Room consisting of a 2D array of Tile objects. Those can be WallTile or FloorTile. Tile objects have a north, east, south and west Neighbour. ...
3
votes
2answers
349 views

Downsides of using a large texture atlases?

So I am using Unity to build a 2D game and one thing that I needed is to be able to render a lot (talking about 10s of thousands) of sprite to the screen so I have a custom solution that basically is ...
0
votes
1answer
610 views

How are Tile Collision Slopes done in Game Maker Studio 2 / GML or in general?

I have been trying to get my slopes to function for almost a month now, doing nothing else with the project. Rewrote it 6-7 times in different collision styles, sometimes coming close to success while ...
1
vote
1answer
78 views

How can I implement a Varying Jump Height Mechanic for my character?

First of all I want to mention that English is NOT my mother tongue, I am using GODOT to make my game and that I am only 16, so I don't have any prior programming experience, although, I understand ...
0
votes
1answer
101 views

Bullets Stop when Shooting Unity 2D

...
1
vote
1answer
210 views

How do I procedurally generate rivers on a tilemap with thickness?

I have read numerous articles on the subject but can find none that can explain to me how it is that procedural river generation achieves a certain amount of thickness to the river. I have managed to ...
0
votes
1answer
64 views

2d gravity simulator - smaller object orbiting towards center of bigger object

In my libgdx test game, I have initially created 2 circle objects (stellar) about which I will say more in details below. However, my goal is to simulate gravity in 2d, where smaller object orbits ...
-1
votes
2answers
623 views

Check if NavMeshAgent can reach position with dynamic obstacles

I am currently checking if a position in the NavMesh is reachable. It is reachable without the NavMesh obstacles. But the moment I add it, NavMesh's CalculatePath() ...
0
votes
0answers
76 views

How do I solve this physics slowdown?

within 10-20 min without touching the android game it would lag. Here is the Unity Profiler Debug. This if the fish clicker script where I started noticing lag. ...
0
votes
1answer
31 views

How can I manipulate a layer with click and drag functionality?

This works well on clicking layers but not click and dragging layers. ...
0
votes
1answer
112 views

How can I detect a Gameobject touching another gameObject without using collider2D's?

I have fish gameObjects that have colliders2D so that I can click and move them. I added fish food with Collider2D's but it was hard for me to click on the fish. After I disabled the fish food ...
11
votes
3answers
2k views

Ways to draw tracks on 4-connected grid

I'm working on a grid based puzzle game involving tracks, and I'm having trouble finding a nice way to have users draw those tracks on the grid in a way is easily understood. For simplicity I had the ...
0
votes
1answer
93 views

How do I get my sprite to do a regular jump instead of jolt up?

I have been getting into game development and I have made some progress. I have come across an obstacle which is jumping I managed to get the Jumping to semi work but it doesn't look like a jump but ...
1
vote
1answer
419 views

Architecture for scaling a large 2D MMORPG world vs player load

I want to make 2D MMORPG in a post-apocalyptic world. I would like to make the game world seamless and big, with big battles for the players. Something similar is in Eve Online (in 3D), but I do not ...
0
votes
1answer
85 views

Help with inventory!

Ok so i made this inventory script but the items are not picking up and not appearing in the inventory. Im new to c# so that is why im asking this question also ive never done an inventory before. I ...
0
votes
0answers
15 views

How to make it so my cursor is not behind the UI?

My cursor keeps going behind the UI how to make it go above?
0
votes
2answers
86 views

How to move one Game unit with every key press?

I have a tile board set up with 500 x 500 pixels = 1 unit. I have code that will move the object over time. ...
1
vote
2answers
587 views

Unity Application.Quit() doesn't work

In the update, I have set up a counter so that after 140 frames, Unity will quit the game. But this quit command doesn't quit and it just continues to play the game. What am I doing wrong? I am using ...
0
votes
2answers
32 views

Crate destroy when in trigger and button E pressed

There are no errors in the console but I feel like im doing something wrong. The crate is not destroying when I click E. ...
0
votes
1answer
762 views

OnTriggerEnter error: The message parameter has to be of type: Collider

I have a crate and I want to make it so if you are in the trigger of the crate a UI appears and says "Click E to loot". I have the UI setup but the script is not working. Here is my script ...
0
votes
1answer
23 views

For my Heat I want to change the players speed but its not working

I have a heat bar for my player and I want it so if the player is at 40 heat or under the players speed slows. This is my script. The problem is when the player gets to under 40 heat the speed is not ...
0
votes
1answer
86 views

Heat bar that always goes down but when near fire it goes up

For the fire I have this script on it. ...
0
votes
1answer
2k views

2D/3D Soft body physics in Unity

I want to implement soft bodies in my game similar to this link. I tried using this Soft body simulation plugin but it has the following problems: Only works with box colliders. Doesn’t work with ...
0
votes
1answer
50 views

How to hide a sprite on trigger when the player enters the trigger zone?

I am making a roof for my 2D top down survival game, and I want to make it so that the roof disappears when the player enters the building, and re-appears when they leave. Here is the code I've ...
0
votes
1answer
185 views

How to make player walk through layers of 2d fog smoothly?

I'm trying to recreate the fog effect that Graveyard Keeper has, with several layers, so taller objects will get less fog. I'm using the approach described here: the devs post on Gamasutra The problem ...
0
votes
1answer
72 views

Unity Unable to blend 2D Light renderers

I've followed the documentation on Unity regarding 2D lighting. It said to turn on Alpha blending in the options. But this is how it turns out: If Alpha blending is off: If Alpha blending is on: I'm ...
0
votes
0answers
152 views

Unity 2D Player Shoots at my joystick position

Hi I am new to unity and have only a little coding knowledge. Right now I have made my character shoot at my touch position on mobile but when ever I touch the joystick, whick I use to move my ...
0
votes
0answers
292 views

Android - Canvas.drawBitmap gives an awful performance

I am using SurfaceView for my game and I am loading all of the bitmaps that are the right size for the screen (pre-scaled in mipmap folder) into a class when the game starts. And I am drawing the ...
0
votes
2answers
194 views

Rotating towards a target in top-down 2D game

I use the following code to rotate a transform towards another. And it's working fine. However, I want to lerp it over time period. ...

1
3 4
5
6 7
66