Tag Info

Hot answers tagged

4

Totally normal thing to do. You can also render your 3D to one render target and your 2D to a different render target and then draw those over each other in a later pass. That lets you do all sorts of fun tricks, like rendering the 3D in a lower and faster resolution while keeping your 2D in a higher and crisper resolution. This sort of thing is also ...


2

I've recently been implemented something like this in the MonoGame.Extended library. Creating a letterbox / pillarbox viewport in MonoGame is actually kinda tricky. I'll do my best to provide a good answer here. There's basically 3 parts to it. The first is creating a scaling matrix to pass into the SpriteBatch.Begin call. The variables represent your ...


1

The way that common physics engines work is that they deal with collision responses for each pair of colliding objects independently. In your case that means when the three circles are overlapping it would try to do something like push the circles apart in each colliding pair by just a little bit. Since dealing with pairs at a time isn't going to give a ...


1

Prefab your Canvas and a Button and add this script to the test_manager gameobject using UnityEngine; using System.Collections; using UnityEngine.UI; public class TestManagerScript : MonoBehaviour { public GameObject canvas; public GameObject button; void Start () { GameObject newButton = Instantiate(button) as GameObject; ...


1

You can create a script attached to the object you want to drag and adapt your code to work inside OnMouseDown() & OnMouseDrag()


1

Looks like you're mixing 3D & 2D physics. You're using OnCollisionEnter2D, which triggers when 2D colliders hit each other. But then you're using Physics.Raycast, which casts rays against 3D colliders - so it won't be able to detect the two colliders that triggered the event, or any similar colliders in your scene. Maybe you want Physics2D.Raycast?


1

Many 2D games are actually 3D with most objects fixed in certain planes (Unity 2D for example). If this were the case, you could quite literally just move the camera backwards as a quick fix. However, you mentioned processing! Processing utilizes affine transformations, and has a built in transformation stack. It's hard for me to remember exactly what the ...


1

The question is what pixel format are you converting your JPG and PNG images to for the DDS, and with what tool? Many of the older tools, including the legacy DirectX SDK texture tool, will default to using a 24bpp format D3DFMT_R8G8B8. The problem with this format is that there is no DXGI format that is 24bpp. The DDSTextureLoader in DirectX Tool Kit is ...


1

Do not use full screen quads for your light volumes. A simple way is to draw a sphere for each light, in the position that the light occupies and of the same radius. This way, only the fragments actually affected by the light will be affected and your fragment shader will not be executed for the entire screen surface.


1

In the Enemy script Update //assuming a as half of your vision cone angle //pseudo code foreach target { if (Vector3.Angle(target.position-trasform.position,trasform.forward) < a){ //then target is inside vision cone //next you can check vision distance ... //next you can check obstacles with a raycast ...


1

Usually when a texture is hidden in a 2D game, it's because it goes "in the back" of the screen. When you do lookAt(target), you have to remember that a Vector2 is just a vector3 with z=0 (thus, if you have z=1 for your background for example, it might go behind).


1

at the base of some perlin noise implememntatio there's a perturbation array private static int[] p = {151,160,137,91,90,15, 131,13,201,95,96,53,194,233,7,225,140,36,103,30,69,142,8,99,37,240,21,10,23, 190, 6,148,247,120,234,75,0,26,197,62,94,252,219,203,117,35,11,32,57,177,33, 88,237,149,56,87,174,20,125,136,171,168, ...


1

As Menno Gouw mentioned, you could use a noise function although you can actually use any PRNG. You will need to seed it every frame though, based off some predictable, relative value, such as the player position. If the player only moves horizontally, then this is simple. seed = player.x I don't suggest a noise algorithm in this case, since the ...


1

Stated that your examples clearest statement is "Some Code to be Performed" ... You must do some things: Not confuse classes with objects Search all objects ( istance not class) like this public GameObject[] targets; targets = GameObject.FindGameObjectsWithTag("tagName"); foreach (GameObject target in target) { // get collider of each object if ...


1

If you have the height of each corner you can easily find which tile to use. For example on the following drawing, the tile number 1 has hills on its top corner and left corner. The tile number 2 has a hill on its left corner. To know which tile to use you would write something like that : if (top_corner_height == LOW && bottom_corner_height == ...


1

Your point selection rules can be satisfied by a Poisson-Disk sampling distribution & can be solved in O(n) with Bridson's algorithm. Basically, the algorithm divides the output region into a grid of cells sized relative to the minimum allowable distance, such that only one point can appear in each cell. Then, when you consider adding a new point, you ...



Only top voted, non community-wiki answers of a minimum length are eligible