New answers tagged

1

Let's update your function to return the time of intersection if there is one, or a negative value otherwise. This will treat rays that start inside the box as non-intersecting, but you can output max(tmin, 0) instead of tmin if you want to count the ray origin inside the box as an honorary intersection. function intersection(b, r) { var t1 = (b.min[0] - ...


1

There are a few ways you could accomplish this effect, likely more ways than I can list here: 1. Manual Tiling Open your tiled felt texture in an image editor like Photoshop, tile it manually to the size of the overlaid texture, producing a single texture, like so: Then, simply apply this one texture to your model. This approach shouldn't be too expensive ...


2

The polygon count you can get away with depends on a ton of details: How many objects you have in the scene How many different objects you have in the scene How many non-baked light sources shine on them How computationally complex your shaders are What minimum hardware configuration you intend to target The only way to find out how close you are to ...


0

You basically want the vector <1, 1, 1> to be rotated to point up <0, 1, 0> - or rather <0, k, 0> where k is some constant. Copying the matrix I use in domain-rotating noise functions the opposite direction, and transposing to invert (works because rotation matrix <=> orthonormal matrix), you can use this to transform each vertex. $$\...


0

The Unity Lightweight Render Pipeline recently got a couple neat additions for 2d lighting. Among them are: Normal mapping on 2d sprites, which can give objects a 3d impression with moving light sources HDR bloom 2d realtime shadows Lit areas in arbitrary shapes, either defined by polygons ("Freeform Light") or by textures ("Sprite Light"...


0

You can try this asset from Asset Store [Disclamair: I am NOT affinity of it's author]: https://assetstore.unity.com/packages/tools/particles-effects/smart-lighting-2d-112535


1

The correct answer, based on the decompiled source code, is that a 16 x 16 spatial grid is used, dividing each level into 256 lists of surfaces that cross into the space and are candidates for collision depending on the space Mario occupies, which is a single point in space between his feet. Object to object collisions use cylinder to cylinder collision ...


2

It's 100% not possible to shade a normal at all. As discussed in this link from the comments, the message was chosen to stop people from being able to research it, to tempt them into asking about it, and outing themselves as pirates. This was counting on players not knowing what a polygon normal actually was. :)


0

Use Vector3.Reflect(...) function to get a movement vector for the enemy that is a reflection of the player's movement vector. First argument of the function is your player movement vector, in your case it should be rigidBody.velocity. The second argument is a vector that represents the normal of the plane from which the player's vector will be reflected. ...


0

You can achieve this by using Asset Bundles in Unity https://learn.unity.com/tutorial/introduction-to-asset-bundles this is the link to the official tutorial of unity describing to create asset bundles and load them from local path or a remote path


0

It sounds to me like what you want is something like a BuildingManager that keeps track of what has been built where. When a new scene loads, the BuildingManager can look through its list of building placements, and spawn the appropriate prefabs for the current time period in those locations. This could look something like this, using a static list to ...


2

When your game scene becomes so large that you run into performance and/or memory problems, then it can make sense to divide your world into separate scenes and only load those around the player. By loading a scene with LoadSceneMode.Additive you can load the content of a scene into a current scene, so both scenes coexist at the same time. And when you use ...


1

You most likely will not run into that problem. If you're doing a personal project, my gut feeling is that if you are having performance problems in your level then you're probably facing more issues with LOD optimization or bad shaders/lighting. Unity should be plenty powerful for what you're envisioning. However, It definitely depends on just how visually ...


0

EDIT: My first approach is still below, but I found a problem with it. If the large empty region is on a border (outside the convex hull of your points), it won't be detected. Putting points on the border like I did with the corners doesn't help because the triangles can be made bouncing from your points to those new points. Another approach, which ought to ...


0

If the tile is sqrt(2) times taller than wide, then multiply z-axis motion by sqrt(2)


0

I'm missing a bit on how player movement works, but this image further down the reddit thread clarifies the setup a lot for me. When they say that the floor is tilted 45 degrees away from the camera, that's referring to the floor plane of the entire world, not individual tiles or sections. Now as for the stretching issue, the easiest way to understand might ...


1

Given a plane with normal vector \$\vec n\$ and any arbitrary point \$\vec p\$ on that plane, then for any other point \$\vec p^\prime\$ in that plane the following equation holds: $$\vec n \cdot \vec p ^ \prime = \vec n \cdot \vec p$$ Now let's take your off-plane point \$\vec q = (q_x, q_y, q_z)\$. We're going to slide it along the y axis to a new point \$\...


Top 50 recent answers are included