I want to create a game 2d in unity. I have a simple (main) square shape. Then, when I click on the screen, should be added another square. At each addition of a new square, I have to get an intersect, and from this intersect I have to get a new form for main shape. That is, change the shape. How many times I click so many times should appear a new square. How can this be realized?
Related
a pink square suddenly appeared in tile palette, covering up half of my sprites, it is not a sprite, it appears when I try to place one of my sprites in the tile map, most sprites work, its just this one, when I select the image one pops up next to the name
I'm modeling some boxes with simple rectangles and I use the "on click" property to show information about its contents. However this only works for the 2D view, and I do need to have a 3D view where this functionality is also available because the boxes can be on top of each other.
I noticed that actual 3D objects do not have an "on click" property at all. Is it possible to make objects clickable in a 3D Window?
the only way you can click 3D objects is by adding some 2D element that is clickable on top of it, perhaps with transparent color, which will allow you to click the 3D object in a 2D animation.
Nevertheless in a 3D window, it's definitely not possible to interact with any object through mouse clicking
Nevertheless if you want to display information by clicking an object in 3D you can instead have a text object to display that information in 3D and you can make that object visible or not when you need.
Hi I am trying to create custom buttons on unity (trapeziums). I successfully created the visible area on Photoshop and imported it as Sprite 2D UI as per the following image:
The issue arises, when I'm trying to select one of the buttons in game, their border overlap each other, since the transparent area is still being considered as part of the clickable button area. How can I remove this?
EDIT:
Practically when I import I want the squared boxes to not be counted with the image. I need the edges of the orange area to be cut flush with that and not the entire area(i.e. including the transparent boxes).
You may achieve this by using Alpha Hit Test Minimum Threshold. Take a look at this nice video tutorial.
There is one extra step that is not shown in the video but mentioned in the comments: you have to change "Mesh Type" to "Full Rect" and not "Tight" as it is.
Hope that helps.
The clickable area is based on the Rect Transform component of the GameObject. Adjust the width and height to the clickable area you want. You may have to crop your image in photoshop accordingly. If you select 'Gizmos' in the editor you can toggle viewing the click region.
I am experimenting with Apple's GameplayKit, SpriteKit and Swift. I am trying to wrap my head around pathfinding through tiles which are passable from only one side.
The diagram below shows two problems:
On the left is a simple solution, I understand how to move from the green position to the red position as all I need to do is remove the wall nodes (the black outlined squares) from the graph and compute the path.
The right hand side of the diagram is puzzling me. Say I want to have tiles which have a wall along their left hand side (as illustrated in the diagram) but I still want to be able to navigate to a tile with a wall. How do I go about telling the graph that those tiles with walls on the left-hand side of the tile are only passable if approached from the top, bottom or right side and not the left?
In response to Alessandro's comment I will explain about the structure of the code. I'm using the new TileMapNode introduced to SpriteKit in iOS 10 to represent the tile map. Each tile is a SKTileDefinition. Custom properties can be set on SKTileDefinition (for instance I could set an Int to represent if there is a wall on the top, bottom, left or right of the tile). The actual representation of the map is less important than how you path find with GameplayKit. As far as I can see, GameplayKit only allows you to remove nodes from the graph that are impassable but what I want to do I mark some nodes as passable but only from a particular direction.
This strikes me as a common problem (as lots of games don't have to sacrifice an entire tile to represent an internal wall) but I don't have the faintest idea how to go about it.
You have a couple options:
1) Decrease your grid size. The presence of thin walls suggests your grid size could be smaller (on the order of the smallest obstacles)
2) Use a different graph type and abandon the grid altogether. GKObstacleGraph or GKMeshGraph are well suited to a game world that has a number of arbitrary polygonal obstacles.
I want to make an irregular shape display its colors from a different set of images. Currently, I have a flashlight represented by an irregular shape (kite shaped) that when casted over an area, certain objects appear. When the shape is removed, the items disappear. Now, I want to have the background that is within this irregular shape to display an altered version of the background.
I am planning to use a RenderTexture to get its info from a camera that views the flashlight's corrosponding location in the other world, and then use this image as the basis of the flashlight's altered background. However, when I try this, the flashlight shows black instead of the other world. When I texture a plane, the RenderTexture works properly. Anyone have any ideas how to accomplish this?