teodron
Reputation
2,504
Top tag
Next privilege 3,000 Rep.
 Apr 22 comment Smoothing a rotation vector @TobiasW: mathematically, the results is not exactly a correct average (unless, I think, the axis of rotation is the same). Nevertheless, it works well enough if the quaternions are close to each other. Depending on the obtained results and input data, you and the OP might not have anything to worry about. The OP still needs to convert to quats, then back to rotation vectors. Apr 22 comment Smoothing a rotation vector @Chiquis you can convert a rotation vector to a quaternion. I assume that your rotation vector is `v = angle * unitDirection`; therefore, compute the angle as the norm of `v` and recover the normalized `unitDirection`. You should be able to convert that to quaternion form. Apr 22 comment Smoothing a rotation vector Actually, computing the weighted average of n quaternions is not going to amount to that pseudocode and it cannot be done analytically. It requires a "gradient descent" iterative process, computing the exp and log maps to switch back and forth between the unit hypersphere and the tangent plane where you actually estimate the average. This is a reference for that: hal.inria.fr/hal-00789164v2/document. Apr 19 comment Does it make sense to use both TCP and UDP at once? To make the answer a bit "meatier", could you provide a short (very short) list of options/references for UDP-based transport libraries? (perhaps ENET, RakNet, zeroMQ, UDT?). As per my comment above, I am sure I have seen a discussion on these somewhere on this site, but it might be worth replicating a fragment of that informaiton. Apr 19 comment Does it make sense to use both TCP and UDP at once? Be sure to read the rest of the threads on this site concerning udp and tcp. You will find several details that essentially deal with your questions. As a hypothesis: I suspect there are hybrid protocols over UDP that try to get the best out of both worlds, i.e. lower latency, contention strategy, load balancing and delivery guarantees. As suggested, search for related questions on the topic and narrow down your question to something that you feel was not addressed here yet. Mar 11 comment How do I determine if one polygon completely contains another? @BrandonKohn it should work fine for endpoint intersection depending on how you implement `PointInsidePolygon()`. For the edge overlap, one must check whether the `innerEdge` is completely contained in the `outerEdge`. It is perhaps the time to update the answer to account for this discussion. Dec 16 comment Leapfrog integration vs Euler integrator You got a downvote without an explanation. Let us consider the referred wikipedia page. These are the equivalent update equations - upload.wikimedia.org/math/b/a/a/…. The main difference is that you're not using \Delta t /2, you're using 2*\Delta. Apart from that, maybe the whole thing can be done in one update call.. Dec 16 comment Leapfrog integration vs Euler integrator Indeed, what you wrote is called semi-implicit or symplectic Euler. Both Verlet/Leap-frog and the Semi-implicit Euler methods are symplectic (which is a special class of integrators that preserve the energy of the system if conservatory forces are used - e.g. without friction). Here's a quick and dirty (not mathematically ladden) reference codeflow.org/entries/2010/aug/28/… Dec 10 comment Is there ever a time when creating a level/world editor with your game is a bad idea? @Almo yes, I remember that one :). That's a notable exception and a good example of where to start. Jun 19 comment How to simulate cylinder shape in collision detection? @JamesAMD I'm not sure about Bullet, but last time I meddled with Havok, I think the actual collision between two cylinders boils down to treating them as convex solids and using GJK (which is indeed more expensive). But since Havok is not open source, judging by how the cylinder shape is formed, one can only hypothesize that GJK or anything else as general is the way to go. See here: transporter-game.googlecode.com/svn/trunk/inc/physics/Physics/… Jun 19 comment How to simulate cylinder shape in collision detection? @JamesAMD to answer your question accurately, I should look into specific implementation details of those collision queries and preferably benchmark them on different processor architectures. Looks like finding the exact collision point is tricky, involving a bit of conjugate gradient search, as detailed by Eberly: geometrictools.com/Documentation/IntersectionOfCylinders.pdf . Aside from that, as I said, one needs benchmarks to see how much the "early-out" tests help avoid the "expensive" part :). Jun 11 comment Quaternion Slerp and Lerp implementation (with overshoot) This is a nice little gem. May 22 comment Can I render 3D objects in Ray Casting engines? Probably objects as NPCs and other things were displayed as sprites since it was easier to represent them as quads anyway without having to complicate the ray cast queries. The term istelf, ray casting, is broad (see en.wikipedia.org/wiki/Ray_casting). Are you referring to non-recursive ray tracing in this context? The very short answer to your question is a definite yes. The details and drawbacks are sufficient to fit in a (large) book discussing ray tracing and its history and related methods. Apr 13 comment Circle-Circle collision resolution Remark: answers that are not answers, but dialog, should be comments. Alternatively, use the chat for detailed, more private discussions. When people read the "answers" section, they expect something a bit different. Apr 1 comment How is game logic usually distributed around files To actually understand what an answer to your question may look like, just consider the fact that people have actually written (fairly good) books on the subject: amazon.com/Game-Engine-Architecture-Jason-Gregory/dp/1568814135 and amazon.com/Game-Engine-Design-Interactive-Technology/dp/… being two well-known titles. You could read at least parts of them and then judge by yourself what best fits your personal style and needs. Apr 1 comment How is game logic usually distributed around files It's improbable there's a panacea design that can serve as a proper answer to your question. Granted, C++ may tempt programmers to adopt certain ways of organizing files (due to separate .h, .cpp, .inl etc. meanings its source files have). There are many open source projects that you can analyze for what you're looking. There's an SO question similar to yours: stackoverflow.com/questions/14477110/… . The takeaway is: a game is just a program with logic like any other. It also uses design patterns and best practices as other products do. Mar 29 comment How do 3D games create the illusion of depth? Probably the technical answer is simply perspective projection" (Google has a lot on the topic). You are most likely interested in *monocular depth perception (en.wikipedia.org/wiki/Depth_perception). Besides the Mathematics behind the technical explanation, depth perception is very close to being an art: photographers have a gut feeling of it and make use of different strategies when composing their photos. So, technical answer: perspective projection 3D to 2D. Nontechnical: the touch of an artist. Mar 20 comment What is better? Lots of small TCP packets, or one long one? So, the best things that you can do are: indeed, use TCP just for crucial operations OR use an UDP based software protocol implementation (with Enet being simple and UDT being well tested). But first, measure the loss and decide whether UDT would bring you an edge. Mar 13 comment Moving OBB vs. triangle intersection test these are quite promising suggestions.Again, there's a "however" involved: it is not at all sufficient to do the intersection of the prism's "curvy" edges with the OBB/AABB. Simply imagine a translation of a triangle that intersects the box by first hitting a corner. Or if the triangle is simply larger than the box. I do have a somewhat working solution involving Dave Eberly's suggestion, but with totally different separating axes. BTW, thanks a lot for your comments and answer, I appreciate them a lot! Mar 11 comment Moving OBB vs. triangle intersection test I appreciate your description of a potential solution. However, I am considering a slightly more complicated situation where the OBB is moving (a so-called shape-cast) and the triangle is stationary. What I would like point out is that the plane-triangle intersection leads to too many false positives, besides working only for stationary objects.