Hot answers tagged

28

Animations in which the character translates away from the origin are said to contain "Root Motion" - because the root bone moves. This allows the animator to directly author subtle non-uniformities in the movement speed, in a "what you see is what you get" fashion. Say the character slows down slightly as their foot makes contact with ...


4

Here's an example of how we can mimic this appearance in a Unity scene: My strategy is: First, compose the image that the POV display is trying to project. Render that image, with a shader filter that adds artifacts that look like a POV display. On the left is step 1. I've positioned some sprites representing my clock face and hands. That way it's easy ...


3

For HP, I'd recommend creating a Health component, something like this... public class Health : MonoBehaviour { public float maxHP = 100; public UnityEvent OnDeath; float _currentHP; void Start() { _currentHP = maxHP; } public void TakeDamage(float damage) { if (_currentHP <= 0f) return; _currentHP -= ...


1

You have a double-delta there. You have a delta on the position (you change the position relative to the current position, based on the angle), and you also have a delta on the angle (you change the angle relative to the previous angle). That is equivalent to having the position change every frame, but also having the velocity change every frame. What you ...


1

As DMGregory said in a comment: You don't need to write your own code to calculate and set positions of layout elements in this situation. You almost never need to do that with the Unity UI system. You can leave that job to the auto layout system. In this case the Grid Layout Group seems to be the layouting component of choice. You just set a cell size, and ...


1

First up, our triangle count is... int numTriangles = numLatitudeLines * numLongitudeLines * 2; (That's a middle section of (numLatitudeLines - 1) * numLongitudeLines quads, doubled to two triangles each, and a row of numLongitudeLines triangles around each pole) Triple that to get our ultimate count of vertex copies: Vertex[] vertices = new Vertex[...


1

You need to multiply your gap value by the i of your loop. Right now, 1 + gap is a constant value, whereas i * gap will increase when i increase. If you want to offset your objects, add some constant like c + i * gap and if you want to increase the gap, well increase your gap variable.


1

Doors and keys (or switches, or puzzles, or whatever is used to open them), have a very simple rule: The player must be able to reach the key without crossing the door. Ergo, if you decide, at random, that at some point there will be a door. There must be a path from the start position to the position of they that does not crosses the door. Furthermore, a ...


1

So after like 5 hours of debugging of course I solve it 3 minutes after I write up this answer (as always Stack Exchange is the best rubber duck). The clue is that SDL2.SDL.SDL_MinimizeWindow(Window.Handle) and all other SDL calls work perfectly fine. Turns out FNA is slightly different from XNA in that Window.Handle points to an SDL window, not a Win32 ...


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