# plainoldcj

Member

51

1068 Excellent

• Rank
Member
1. ## Calculating UV coordinates of a point in a convex 4-sided polygon

Hey, maybe reading this helps with your scewed texture problem: [url=http://www.xyzw.us/~cass/qcoord/]the q-coordiante[/url]

3. ## Find the missing edges of a voronoi map inside a square

I'm not entirely sure I understood your question correctly, but to me it sounds like you want a ,,bounded voronoi diagram''. Or, put differently, you want the intersection of the vornoi diagram and a rectangle. If that's what you want, I'll gladly tell how I've done it in one of my projects.
4. ## Problem with Quaternion. Instantiate does not work properly

Okay, I'm tired and maybe I'm missing something. However, it appears that you simply adopt the orientation of firePoint for the newly instantiated game object. I assume firePoint is the tip of the gun and its a child of the player game object. So, I'd say you turn the player in direction of the mouse, the firePoint turns accordingly and then you instantiate the bullet with the same orientation. What you want to do is shoot the bullet in direction (mousePos - firePoint.pos). If I recall the Unity API correctly, you could simply assign that direction to transform.forward. Alternatively, there is a method Quaternion.LookRotation.
5. ## Give me your Java and Python code

Hey guys, great links, thanks! I find pygame.org especially useful, because it shows screenshot of the games.
6. ## Give me your Java and Python code

Hey, at the moment I'm heavily procrastinating, so I thought it's a good time to refresh my language knowledge Therefore, I'm asking if one of guys has a small game (around 10k loc maybe) written in Java or Python that I can tinker around with. Ideally, the game has only a few library dependencies. Also, the code should be "java-ish" or "python-ish" (as opposed to translated from, say, C), so I get to learn common idioms and standard libraries. Open source games are fine, too. So, any suggestions?
7. ## Filling in the gap: What to do while waiting on the game to finish an action ?

That's interesting, I haven't thought about it this way before. I don't know much about SC2, but I've played WC3 a lot (lot). In WC3, there are research queues. Both games focus on micro-management of single units or small groups of units. That's a design decision that forces you to have little automation (including AI) of movement and casting, because that's how players compete. I like the idea, that most of what happens is caused by direct player input. I agree that the player has to carry out a lot of tasks, but I don't think they want to keep the player busy clicking. The assignment of drones to minerals, for example, has been automated in SC2, simply because it's a boring task with no consequence for the outcome of a match.
8. ## When to use pointers or objects in 'Composition'?

I prefer method 2 for composition, although I sometimes use method 3 for the following reasons. 1. using pointers, you can forward declare class Graphics in the header to reduce dependencies, which in turn reduces compile times when you modify class Graphics 2. using pointers, you can put all the initialize() work in the constructor and you don't have to worry about your object being in invalid state. (in cases where you can't use initializer lists)
9. ## Keep 3D Game Object 'Stationary' On Screen

It sounds like the weapon is rotated around it's center and then translated, so maybe the order of transformations is a problem and you can try to change translate * rotate to rotate * translate.   In general, you want the weapon to have a fixed position in camera space. Therefore the easiest way is to not transform the weapon at all.   If you transform all your objects by the same "world" matrix, however, you want to give the weapon a local transformation that cancels this effect. that is the weapon matrix is the inverse of the world matrix. Try using a standard Invert() method first and see if it gives the desired results.   After that you can try to replace the Invert() call with a product of translation and rotation matrices.
10. ## OIT (Order Independent Transparency)

Maybe it's already sufficient for your application to sort the individual triangles back-to-front. You can store the vertices statically on the gpu and issue a sorted list of indices in every frame, for example. It's not too bad.   If you really need perfect transparency you may consider depth peeling. It's a multipass technique and runs on older hardware.   The cheapest trick is to draw in any order and tell everyone it's correct. Most people don't notice alpha-blending errors anyways :)
11. ## Panning camera so object is at edge of screen

Think in terms of frustrum planes, not view rays. You could try something like this, again using the right frustrum plane for example: 1. get the plane equation 2. cast ray R along x-axis to find object-plane distance 3. move camera along x-axis so that distance is 0 depending on the object or which bounding geometry you use you should sample the distance at every vertex and use the minimum or something like that. im not really sure what you are trying to do. after the camera translation the object should still be outside the camera view, right?
12. ## Panning camera so object is at edge of screen

In the example above the right plane of the viewing frustrum should be a supporting plane of the object. that is the object and the plane must intersect and the object must lie on one side of the plane.
13. ## Problemas with glTranslated

Does your problem look similar to this: https://dl.dropboxusercontent.com/u/56764397/screendump0.png ? When you talk about the camera losing pixels and objects moving into the screen this could be a clipping problem.
14. ## Orthographic projection causes artifacts

Hmm. To my surprise the problem disappears when I choose a sufficiently large negative value for the near clipping plane. So before I set (znear, zfar) = (0.1, 100.0) for both the perspective and the orthographic projection matrix and the error occurs. When I choose (znear, zfar) = (-100.0, 100.0) for the orthographic matrix everything looks fine. I have no idea why. Since setting znear = -100.0 essentially doubles the viewing volume I would guess the error becomes even worse!
15. ## Orthographic projection causes artifacts

Hey guys,   I observe strange artifacts in my application when I switch from perspective projection to orthographic projection. Here's an image of the problem: https://dl.dropboxusercontent.com/u/56764397/projection_bug.png It looks to me like some sort of z-fighting.   Now, I'm using depth peeling for transparency and the artifacts disappear when rendering with another transparency technique, so maybe the issue is how I read and write the depth textures.   It's pretty strange, though, because the projection matrix is not referenced in any fragment shaders.   Any ideas what I can do to isolate the problem?