# Tag Info

2

A vector to your camera's right is the same as the forward vector of a camera that's looking 90 degrees further in yaw, and at zero pitch. So you can modify your look vector code to give you your right vector. var rx = Math.Cos(yaw); var ry = 0; var rz = -Math.Sin(yaw); this._right = new Vector3(rx, ry, rz); (Here I used the identities that Sin(a + 90°) = ...

0

Other authors have already discussed how important complex numbers can be for object rotation. Here I am adding a couple of other examples where we can see the use of complex/ imaginary numbers A really cool application of complex numbers is Fractals which is used in procedural generations in game development. Some of the popular fractals such as Mandlebrot ...

1

Use break_infinity.cs for unity: https://github.com/Razenpok/BreakInfinity.cs call using BreakInfinity; at the top of your script. If you want to save the variables (BigDouble), convert them to strings (saveStringVariable = bigDoubleNum.ToString()) and load the back, do (bigDoubleNum = BigDouble.Parse(saveStringVariable)) EDIT: It limits up to 1e(9e15), so ...

1

Probably your intended nearplane and farplane variables mapped reversely.So it clipped out eveything that supposed to be rendered on the screen. Possible Reasons (Possible)There might be a transpose operation somewhere in your code. (Possible)There is chance which songho's tutorial displays projection matrix as a one way and its possible Opengl uses it as ...

0

Solved using this: // player world position const vPlayerPositionRelativeToWorld = new THREE.Vector3().copy(player.transform.position); // player position relative to enemy transform - includes rotation of the transform const vPlayerPositionRelativeToLocalEnemyPositionAndRotation = enemy.transform.worldToLocal(vPlayerPositionRelativeToWorld); ...

0

For a simple way of doing it, you’ll need two things: First, you’re looking for the Sutherland-Hodgman Clipping algorithm, or some other type of clipping algorithm. Sutherland-Hodgman is very easy to understand and implement, and it is used in some physics engines for this even today. This will clip your shapes given a clipping volume. The second thing ...

2

A spline key input is a bit like an index into the spline. A spline is generally formed from control points, similar to a Bezier curve. My knowledge on this is rusty, but the idea seems to be that the starting point has the value of 0.0f, and is increased by 1.0f (by default) per point, so a minimal spline out of two points goes from 0.0f to 1.0f while one ...

1

Well I'd say that every time you calculate your velocity, you should add your drag to it. Framerate independency is hard to achieve in Unreal, given its reliance on ticking components. So long as you use deltaTime every time you're calculating anything, you should be fine. Force = Mass * Acceleration. Acceleration = DragForce / ObjectMass Velocity = ...

2

Once I faced this particular problem. My approach was to make the code dumber. I hard baked the precomputed offsets for different load distances. And then I would just go over them, and add the offset to the coordinates of current chunk where the player is located. I had not to worry about any distance check because the offsets were precomputed for that. I ...

0

Now, while I wrote the question I had an idea and the solution was actually simple. But I thought I'd still throw it up here in case someone has a similar challenge. Be reminded, I selected the most optimal data structures - but if you find something to improve here, feel free to inform me! The solution is: Get all chunks in a rectangle as described in the ...

5

Complex numbers have an enormous range of applications, but here we'll stick with those in game development. Others have already noted how the "vanilla" 2-dimensional complex numbers $\Bbb C$ describe rotations in 2 dimensions, and the quaternions $\Bbb H$, a 4-dimensional "hypercomplex" system, describe rotations in 3 dimensions. Another, less famous ...

20

DMGregory already explained how Quaternions are often used for rotation in 3d space. But Quaternions are already 2 levels of understand above imaginary numbers. When you want to go one level simpler, then you might find it interesting that you can use Complex numbers for rotation in 2d space. When you want to rotate a set of 2d points by n degrees, then ...

112

One place that imaginary numbers get a lot of use in video games is in the use of quaternions to represent orientations and rotations of 3D objects. Like complex numbers $z = a + b \cdot i$, a quaternion consists of both a real part and an imaginary part. But instead of just one imaginary axis, quaternions have three! \\$q = w + x\cdot i + y \cdot j + z \...

0

Looks like a job for the Physics engine. I would give the boundary of your play area a Rigidbody, and when the enemy is hit you apply a force to their Rigidbody equivalent to the vector (force) of the projectile (or similar). The physics engine will try to move that enemy away, in the same direction as the projectile, but if they hit the boundary wall they ...

-1

Positive angles of rotation follow the “Right Hand Rule.” Place your right hand with palm at origin and fingers along positive x-axis. Curl your fingers toward the positive y-axis. The direction your fingers curl is a positive angle by convention.

2

Why have we arrived at the convention that rotations should be counter-clockwise then, even in engines where positive y is down? Have we? Let us try CSS: const box = document.getElementById("box"); function step(timestamp) { let deg = timestamp/10; box.style.transform = "rotate(" + deg + "deg)"; window.requestAnimationFrame(step); } ...

5

Spaces and Matrices First of all, as you know, we use matrices to represent and to do coordinate transformations. They can be any of the affine transformations. That includes translation, scaling, rotation, shear, and reflection transformations. We (traditionally) have these coordinate systems to work with: Model space (Sometimes called "Object space"): ...

1

Another user was struggling to implement this with the existing answer, so I thought I'd show a slightly deeper code example for folks in a similar situation. I'll use Unity C# syntax since it's what I use most often, but the same steps can be applied to any language/framework. CalculateVertexNormals(Vector3[] vertexPositions, int[] triangleIndices, ...

1

Let's attack this in parts: we'll find where to place the end of the first bone, then figure out where the other two go. Once we've arranged the first bone, what remains is a two-bone IK problem, which we already know how to solve analytically. The trick is to understand the constraints on where the end of the first bone can end up. It can't be further away ...

Top 50 recent answers are included