background preloader

Favoris

Facebook Twitter

Unity3D. Programming for fun: Aiming a projectile at a moving target. To hit a moving target by shooting a gun you have to lead it, aiming at the spot where the target will be when the bullet reaches it. In this article we consider three successively harder versions of this problem. To simplify the math, express the target's position and velocity relative to the shooter's, so that the shooter is effectively stationary at the origin. Assume that the target moves in a straight line, if it is moving. Also assume no air drag. Motion without gravity Without gravity, bullets travel in a straight line at constant velocity. Variable definitions: Equation for the time when the target and bullet are equidistant from the shooter: Square both sides: Expand: Group terms by powers of t: Examine the equation above.

Code for solving this quadratic might look like this: double time_of_impact(double px, double py, double vx, double vy, double s){ double a = s * s - (vx * vx + vy * vy); double b = px * vx + py * vy; double c = px * px + py * py; double d = b*b + a*c; return t;} 3D & Textures. Fun with Shaders and the Depth Buffer | Chris Flynn's Blog and Such. Recently, I read this presentation by Kuba Cupisz and Ole Ciliox and I wanted to try my hand at implementing some of the techniques mentioned in the slides. So far, I’ve written two successful shaders: Rendering the depth buffer and highlighting intersections (the scan field). Since there is no source code to accompany the presentation, I had to do a bit of digging to get everything to work. The End Result Here is a quick video of what these two shaders accomplish. Both cubes use the Depth Shader, while the sphere and the plane use the Intersection Highlighting Shader First Things First In order to read the depth buffer, we have to tell the camera to write to it.

Luckily, that is as easy as flipping a switch: Simply put this script on the camera and everything should be good to go. The Depth Shader The main reason I wrote this shader is to verify that I was accessing the depth buffer correctly. Like this: Like Loading... MySpace France - Aujourd'hui sur MySpace. Supertoinette +50000 recettes de cuisine en photos, cuisine facile ! Le top des jeux corsés, énervants et addictifs ! Tablature, Partition, Guitare et Basse : tout pour la musique.

Le cinéma sur Cinéfil : Sorties, horaires, bandes-annonces. Wikipédia, l'encyclopédie libre. Un article de Wikipédia, l'encyclopédie libre. Sur les autres projets Wikimedia : accueil, sur le Wiktionnaire L'accueil est une cérémonie réservée à un nouvel arrivant, consistant généralement à lui souhaiter la bienvenue et à faciliter son intégration. Dans le monde du travail, l'accueil consiste à orienter un patient, un client ou un visiteur et à l'aider dans ses démarches. Le passage à l'accueil (qui peut être le secrétariat ou la réception) est parfois obligatoire afin de contrôler l'identité d'une personne extérieure ou de la diriger vers les seuls lieux qui lui sont autorisés. L'accueil peut désigner le service chargé de ces prestations, le lieu où ce service travaille.

En art, l'accueil fait référence à la manière dont une œuvre a été acceptée lors de sa sortie par le public et les critiques. Naruto Manga Series (Chapters 1-400) Médiathèque Pierre Mendès France.