Tag Info

Hot answers tagged

6

It’s not always the best method, and it can be more computationally expensive (though this ultimately depends on how you store your data), but I will make the argument that lerping 2D values works reasonably well in the majority of cases. Instead of lerping a desired angle, you can lerp the desired normalised direction vector. One advantage of this method ...


4

The trick is to remember that angles (at least in Euclidean space) are periodic by 2*pi. If the difference between the current angle and the target angle is too large (i.e. the cursor has crossed the boundary), just adjust the current angle by adding or subtracting 2*pi accordingly. In this case, you can try the following: (I've never programmed in ...


2

I had to address this same problem, basically you're doing it the right way, updating at a set rate of updates per second, and thus a set speed per second and rendering as fast as possible independently of that speed. That way it doesn't matter how you measure things in your update as long as you keep it consistent it'll be the same speed regardless of how ...


2

Basically you have three ways to periodically invoke some code. have a infinite loop with sleeps. use setIntervall to perodically be waken use requestAnimationFrame for when the browser is idle Although this is about animation, it covers the basic crux of the problem: Animating In Code Using JavaScript


1

Yeh you can't create a static variable and have it accessible from the inspector panel that I know of. However, you could try this In your class that has the editable variable you could create a static instance variable of your script and have the editable variable as public so you can edit and access it like so. public class StaticVariable : MonoBehaviour ...


1

The functions use AJAX in the form of the XMLHttpRequest object (or "XHR" for short). Thus, by definition, they're asynchronous. Because JavaScript runs in a single UI thread in modern browsers, making such a network call synchronously would lock the browser UI while it waits for the file request to complete, making it unresponsive and causing an extremely ...


1

When laying out your tiles you can use their xy-coordinates to determine what z-index to give them. Just add together the x and y values then add one to produce the z value. Examples: (0, 0) = 0 + 0 + 1 = 1 (0, 1) = 0 + 1 + 1 = 2 (3, 3) = 3 + 3 + 1 = 7


1

It would be hard (and probably overkill) to try to provide anything besides casting, multicasting and broadcasting of generic messages for real-time multiplayer games. You could even make it more generic by creating simple key-value (string-JSON) room storage behind websocket service with operations like: set(key, value) get(key) observe(key) maybe ...


1

Ahahaha, problem solved, I'm such a math genius ^^: my math library had a typo in function that converts quaternion to a matrix : 1 - 2 * (this.y * this.y - this.z * this.z); - minus times minus makes plus, not minus, as in here: http://www.gameprogrammer.net/delphi3dArchive/quaternions_bestanden/quat1.gif


1

I think that tutorial actually contains all you need. It mentions that the order of rotations is Z, then X, then Y. I don't know Unity's quaternions, but you are either doing Z then Y then X, or the reverse. Try swapping x_rotation and y_rotation when you calculate your final rotation.


1

There's two issues in your code. Firstly, you update the lastRenderTime at each iteration so now - this.lastRenderTime has always more or less the same value (the time between now and the last iteration). Your assignation (this.lastRenderTime = now) should be inside your if brackets. Secondly, you're doing your comparison the wrong way. you should check ...


1

I love the other answers given. Very technical! If you want, I have a very simple method to accomplish this. We'll assume angles for these examples. The concept can be extrapolated to other value types, such as colors. double MAX_ANGLE = 360.0; double startAngle = 300.0; double endAngle = 15.0; double distanceForward = 0.0; // Clockwise double ...


1

Paul Bakaus shared some info in a 26 Oct 2012 comment on this Google Talk video. As creator of the engine, let me chime in. You are partially right in that we have never released the full blown iso engine, but we did in fact release individual components of it at https://github.com/zynga. Most notably our state-of-the-art build system Jasy ...



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