# LaVOZs

The World’s Largest Online Community for Developers

'; Newest '2d' Questions - LavOzs.Com

# Questions tagged [2d]

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

• ### How to move in the 2d/3d array using pointers in C?

Today I was coding a little bit for my studies. And I have a problem with 2d (and also 3d arrays in C). When I allocate memory for an array or make a static array for example: //dynamic int *a=(int *)...
• ### How to attach a weapon to players hand and implement dynamic aiming?

I wanted the weapon to be pointing in the direction of wherever the mouse is, what i want is, if a weapon is in players hand, than the weapon along with the hand, being in perfect sync with the body ...
• ### Slicing of a 3d array with use of a 2d array in Numpy

I got a question regarding slicing of a 3d array with use of a 2d array. largearray is the 3d array which I want to slice with values from the 2d smallarray array([[[36.914 , 38.795 , 37.733 ...
• ### Shaking grid at point with Z value

I'm trying to achieve similar result to this with fragment opengl shader So far I found this grid shaking example (https://www.shadertoy.com/view/MsGyWK) with using Perlin Noise. Next stet I need to ...
• ### Fourier Decomposition of a 2D function

I have a matrix with three columns representing x,y and f(x,y). I don't have an analytic expression, just the value on those points. I would like to compute the 2D Fourier transform but I can't get a ...
• ### Java graphics slow down after adding objects

I am still new to java and I've been trying to make a SpaceInvaders copy in Java's native graphics. I've finished the basic mechanics, however the game slows down significantly when the player or ...
• ### How to move gameobject by The screen dragging finger In mobile games?

I have a problem with dragging an object on the scene by clicking and holding with my finger, does anyone have any ideas how to fix this, or is there some kind of universal script. In the drawing in ...
• ### How to do multiplayer ai for 2d top down in realtime [closed]

I'm new to unity and I'm looking to make a simple ai for a top down game in local multiplayer. The problem is that players only appear when they click a button. So ,impossible set from the beginning a ...
• ### why inkscape default extensions not working?

after perspective before perspective correct perspective I am using inkscape v 1.0 . here when I am using perspective extension, it is not likely worked and you see the image after perspective in ...
• ### Check if the given Matrix has Valid dimensions - JAVA

I want to check if the given Matrix has valid dimensions. This Matrix Below has Invalid Dim because it does not satisfy Matrix properties Matrix x = new Matrix(new double[][]{ { 1.0, ...
• ### Procedural world generation in “ Unity” [closed]

All welcome, guys, the question is the following.. I write the generation of a 2D world on "Unity", but I do not know how to correctly or rather in what sequence to write the generation of the world. ...
• ### Math to calculate line thickness on triangulated line strings

I am creating my own 2D paint engine that is able to stroke and fill paths. I am having trouble with the corners of line segments connecting. The way I do it is calculate the normal of each line ...
• ### Java Collision Detection with custom images

So I have a class. In this class I have a timer which repeats every 100 millisecs. I want to check If 2 objects collidate. Everthing is fine with rectangles and circles but custom images won't work or ...
• ### Algorithm to pick one Polygon which is selected from a User

I can't figure out a proper algorithm to detect if the user had select a Polygon. This is my example: If the User clicks on polygon one then one is selected. If the User clicks on polygon two then ...
• ### How to covert Raycast3D to Raycast2D?

i have problem converting 3d code to work on 2d project. code supposed to drag object out of inventory canvas and drop it into 2d world. public void OnDrop() { RaycastHit hit = new RaycastHit(); ...
• ### Sorting a list into a 2D array according to X and Y

I created a Java object called bounding box which contains X and Y coordinates and can return string like (x0, y2) according to its values. I'm having a list of these boxes, I would like to turn this ...
• ### 2D PlayerController in unity

Someone can tell me what is the problem with this code that's work but my player fly to the sky. I'm just started with codding but pls help me. the start of this code start down here: using System....
• ### Write a function that takes two lists of coordinat

Write a function that takes two 2D lists of coordinates as parameters. The function should print the Euclidean distance between all points in the first list and all other points on the second list
• ### Modern approach for 2D/3D fast graphics hosted under WPF [closed]

We are working on WPF application to control different types of cnc machines. What we need right now is: Display several large image files, approx size of 3000x3000px Ability to interact with those ...
• ### Create rectangles in a grid with mousemove event

I'm trying to do a simple game with js but I have some problems. What I want to do is with the mousemove event in a canvas create a grid of rectangles while mouse move with random colors. My code: ...
• ### How to Get my GameObject move on a fixed platform on Unity for Android Game Development

I was following a tutorial from AwesomeTuts on Youtube and completed it successfully and then I wanted to convert the game for Android, When I changed the build settings few errors took place here and ...
• ### What should I change to get smoother (tap and hold) control in Unity?

I have been trying to get smooth movement on the Y-axis whit my code (for exapmle in IOS game--->Space Frontier), but its Jittering, absolutely not good, not smooth. How should I try differently ? My ...
• ### How to add 2D real time dynamic text to a Three.js scene?

I need a better solution to add 2d text to my three.js scene. I've tried using TextGeometry but I can't update the text in real-time (in a way that won't hurt performance) and I don't want to have to ...
• ### How can a make new list from a 2d list with specific conditions?

I need to tell you that I know very basic things about python (and programming generally), so I would like an explained answer if that is possible. So I have an exercise where I have a kind of list ...
• ### i have Lower Triangular Matrix issue my code is working but not what i want

I have written the following code for which I need help on this. public class JavaApplication11 { /** * @param args the command line arguments */ public static void main(String[] ...
• ### [SOLVED]Finding Tile Index of a point- on an infinite 2D plane divided into tiles

I am attempting to divide my game world into Sectors/tiles. And identify the tile where the player/object is at depending on the player/object position. I do not have a limited world size, so the ...
• ### (C++) OpenGL renderering tilemap causes framedrops

I'm using OpenGL to draw a large tile map currently made up of 50 x 50 tiles. I'm using GLFW, GLEW and GLM to handle most of the OpenGL functions. When I try to draw the map it will only render at ...
• ### In Java, how would I print a 2d array that resembles a seating chart with an 'aisle' down the middle? [closed]

I am working on an assignment where I have to print a 2d array that resembles a seating chart. Each element has a number, and increases in number when you go through the array, and also has an "aisle" ...
• ### In Java, how do you generate every possible combination of an NxM boolean array?

I'm trying to create a function that computes all possible NxM combinations of a 2D NxM array. It would be able to take in any two integers between 1 and N inclusively (so performing this action for ...
• ### In Java, how would I print a 2d array that resembles a seating chart?

I have an assignment where I would have to print a 2d array (8 rows and 7 columns) that resembles a seating chart with an aisle going down the middle that cannot have any seats (these elements would ...
• ### NullPreferencesException 2d GameOject Array. Can't attach GameObject to GameObject 2D array [duplicate]

I want to attach prefabTile to prefab 2D array but it doesn't attach. When I try to access prefabTiles[0,0], it's null. Somebody helps me :(( NullPreferencesException in line 53
• ### In Java, how would I initialize an array in which elements in an even column or row are 0, and in odd columns or rows, the elements are 1?

I am working on an assignment where I needed to have two 1d arrays, send them to another method, and make a 2d array. I would then have to pass the array back to the main method (all of which I have ...
• ### how can I check for bounties from a saved position to the current position of the player

/** * Updates saveX and saveY to the current player position. */ def save(): Unit = { saveX = playerX saveY = playerY } /** * Returns the current save position as a tuple, in (x,y) ...
• ### Updating a Location of character in simple 2D Python game

Please help me to write the procedure updateLocn(x,y,state) so that the character at (x,y) in the map is changed to the chosen state. I tried writing on my own, but it doesn't work. Here is the code: ...
• ### Movement not working in c++ console game ( using _kbhit and _getch )

Im using an two dimensional array for coordinates. Creating and display board with random coordinates for the goal is working. But, movement is not working (it is w,a,s,d). Im using the functions ...
• ### Differently identify unity UI button click and touch

I am creating a drawing board using unity. below attached is a layout I am using line renderer to draw lines. red colored circles are the buttons using UI one button is used to erase the screen and ...
• ### how to solve array index out of range

This is my code below to check if the player is within the range of the field/board, the board is 10by10 so goes from 0-9 def al() { if(field(playerX - 1)(playerY) == false && playerX - 1 >...
• ### can't print first row or column of names in a 2D matrix in python without numpy. Will only print the float numbers in the matrix

I'm trying to print a 2D matrix in python. However, I can only print the float test scores and not the strings the correspond with the row and column headings. I'm trying to print this: studentName ...
• ### Verify power law in cellular automata

nx =10 ny=10 pmt = 7. SKH_ev = np.zeros((nx,ny)) H_ev = np.zeros((nx,ny)) SKH_ev [1:nx-1,1:ny-1] = 8*np.ones((nx-2,ny-2)) H_ev [1:nx-1,1:ny-1] = np.ones((nx-2,ny-2)) iterations= 100 reversal=0 ...
• ### Estimate slope on hexagonal neighborhood

dx = np.array([0,1,0,0,-1,-1,1]) #neighborhood dy = np.array([0,0,1,-1,0,1,-1]) for i in range (1,nx+1): for k in range (1,ny+1): theta = math.atan(((H[i,k]-(SA[dx[:],dy[:]]+SD[dx[:],...
• ### How to avoid mirroring canvas in unity

I want to attach my healthbar and manabar to the player, but i cannot figure out how to attach it to a player winhout mirroring (the whole canvas flips everytime, when the player model flips). Here ...
• ### Information about CGAL and alternatives

I'm working on a problem that will eventually run in an embedded microcontroller (ESP8266). I need to perform some fairly simple operations on linear equations. I don't need much, but do need to be ...
• ### Adding points to an existing geometry

I have the dxf file of a 2D geometry created in AutoCAD and I would like to add points on the lines of the existing geometry. The list of points to be added is present in a text file. For example, I ...
• ### Hexbin matrix 2d

nx = 100 #dimensione reticolo ny = 100 mu1, sigma1 = 2000., 100.0 #mean e standard deviation def KHead(nx, ny, mu1 , sigma1): KH0=np.zeros((nx,ny)) KH0[1:-1,1:-1] = np....
• ### how to turn 1D to 2D sandpile model

Hi, Could anyone please tell me how can i turn this model into 2d model?
• ### Is there a way to make a Input.GetButtonDown for all buttons but one in Unity?

In a game im making I want to make a quick time event, which can be failed should the wrong button be pressed. But I dont know how I can make it so every button triggers it. Surely there must be an ...
• ### 2D slope display Python

The question is the following: I have to create a matrix that has values corresponding to the slope inclination. angles between 34 degrees and 28 degrees. I would need to create the matrix and display ...
• ### 2 dimentional Sorting algorithm

Got H.W question that gos like this: A woodworker has wood panels with dimentions X and Y, he wishes to cut the pannels according to his cutlist I need to write pseudo algorithm to fit all parts in ...
• ### Repeating a function n amount of times in scala

class Game(wall: List[(Int, Int)], bounty: List[(Int,Int, Int=> Int)], var playerX: Int, var playerY: Int) private var field: Array[Array[Boolean]] = Array.ofDim[Boolean](10, 10) private var ...
• ### How do I to know on which GameObject I clicked on Unity?

I want to make a Simple Memory Game using C# on Unity. It is a 2D game. I am trying to make a game in which the PC player clicks in a card, and then the game needs to call the function memory(...