Tag Info

Hot answers tagged

7

I was going to write this as a comment, but it ended up being rather long winded so I've turned it into an answer. The current answers are mostly correct, but a few things mentioned are misleading/wrong. In general, most game-play related tasks will go in Update. For example, you don't want to be polling for input in FixedUpdate (not because of ...


5

Some more options to consider: Convex Polygons: If you're OK generating only convex polygons, a fairly painless approach is to generate some number of random points and find the convex hull. Example here: http://bl.ocks.org/mbostock/4341699 (Fairly easy to intuit that the fewer points you generate, the less "rounded" the hull will be.) Concave Polygons: ...


4

The Update function is called every frame. Its frequency depends on how fast the computer is able to render images. On a slower computer, Update is called less frequently than on a faster one. If you do time-based calculations, you can normalise them using Time.deltaTime which tells you how long it has been since the last time Update has been called (caveats ...


3

Welcome to the wonderful world of continuous state motion planning. A few years ago I wrote a Gamasutra article on this topic. Here are some solutions to your problem: Navigation Meshes This works by constructing a graph of nodes and edges of your scene based on some simple rules. For instance, you can construct a Visibility Graph of the scene, which is ...


3

It's hard to know exactly what's happening without hands on but: OnMouseUpAsButton is only ever fired after Unity has performed its own successful ray cast (this happens in the background, during each frame so that Unity knows which objects to call the various OnMouse???? methods on). OnMouseUp() is called when releasing the mouse button over a collider. ...


2

From: http://unity3d.com/learn/tutorials/modules/beginner/scripting/update-and-fixedupdate The time-step used in FixedUpdate is not variable. If your game starts to lag, when it catches up, you don't want >10seconds of physics in one update, so it is typically done in FixedUpdate which is called on a fixed-interval. For example: Update(float ...


2

The problem is basically this: The LineRenderer is trying to connect the red dot positions. It's creating the green vertices to make a mesh. So the top line segment looks great. But then the LineRenderer tries to be economical, it reuses the vertices from the end of one line segment in the end of the second line segment. When there's a sharp angle, you ...


2

Just winging it, here's two possible approaches... Constructively Build in such a way that lines cannot intersect. For example, take points spaced evenly alone a circle, and then randomize their radii. Could also randomize their angular position, within their pie wedge. This won't make all possible polygons, the ones it makes will be ...


2

Update is called as fast as possible. The variable 'Time.deltaTime' is set to the actual amount of time that passed since the last call. If lag or something similar slows down the game, Update will still be called only once once the lag is over, with a high value of deltaTime. FixedUpdate is called at regular intervals. It will never be called more often ...


1

First, find the center: p0 = (C + D) * 0.5 Now, take the relative vector from the center to the point in question: p1 = (X - p0) Finally, take the dot product with the normals you might want: d0 = n0.dot(p1) d1 = n1.dot(p1) ... etc. Then, check to see if its greater than zero abovePlane0 = d0 > 0 abovePlane1 = d1 > 0 ... etc.


1

It's definitely possible to have a common code base if you use cross-platform technologies such as Unity or HTML5 frameworks. Though you'll always need some platform-specific work (Facebook app creation, distribution on the app stores, integration with the payment services,...) Choosing the framework highly depends on your skills and preferences. If you ...


1

I found this nice tutorial on DelphiGameDev.net: " So, the first thing we need to do is actually add our background. Previously we set this up in our DXTimer component, redrawing it before each animation. This limits us however and to be able to effectively scroll our background we need to set up a special class of sprite called TBackgroundSprite, much as ...


1

Simply choose the facing for the character that is closest to the angle of the shot. 8 sets of sprites would be nice for that, but I imagine just the 4 cardinal directions would look fine too. Character faces North for any shots between NW to NE, character faces East for any shots between NE to SE, etc.


1

About 15 years ago I was quite satisfied with this algorithm for my Scorched Earth clone in Quick Basic (my first proper game). Generate the landscape from left to right, pixel-column by pixel-column. Start at a random height value between your desired minimum and maximum height and with a random steepness value which is a negative or positive value in ...


1

I also though about overlaying a texture and using a cutout alpha mask, but that would not translate well considering that the visible polygon is updated every frame and the mask has to be premade(?). I'd consider to dynamically build a mesh with the calculated polygons and draw it before everything else. It works occluding the rest of the scene ...


1

I agree with @Christian (though I wouldn't call it a hack). Detect the condition when the object should look different and then just draw it different. Every single thing in the game doesn't have to be a "model" of how it works in "nature". That's a mistake I've made many times and so it's become something of a mantra for me. Ask yourself this: what ...


1

I think you should break this up into multiple questions and try again. Offhand, I see 3 questions that all warrant their own detailed answers, but there are probably more that you can ask to get the detailed answers you wish for: Using 3D to generate 2D Sprites You can just use 3D as a way to render Sprites, i.e. by creating your animations, then ...



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