Building a Half-Edge Mesh from a Triangle List

The problem is to build a polygonal mesh from a triangle list efficiently. A solution is important specially when building or testing physics engines. The method below shows a possible solution. This can be done without needing the additional storage and processing cost of keeping a list of half-edges for a given face during its addition which would be linked at the end of the addition in that case.

Continue reading

Distance Constraint Derivation

Sometimes it’s desired to have a distance constraint. That constraint assumes a choosen separation distance for two points fixed in two bodies. I’ve written a derivation for it in 3D and shared here. An implementation should be pretty simple since we have minimally one Jacobian and solve a 1D linear system. Here is an example which you can use in your own projects.

Continue reading

Fast Segment-AABB Collision Detection

Let’s say we need to compute the intersection point and normal from a line segment to an axis-aligned bounding box (AABB) bounds, and we neither want to perform expensive plane computations nor keep the AABB boundaries as an intersection of 6 axis-aligned planes (as it is a waste of memory). A quick way to do that is by evaluating the slab plane equation for each axis-aligned plane of the AABB.

Continue reading

Keyboard Input for Fixed-Time Step Games

Suppose we’re using a fixed-time step to update the game and we’re at the begin of a new frame. Then, the keyboard input events that were fired are requested and handled via callbacks or similar, making a character to jump or shoot in an enemy. What is the problem with that?

Continue reading

Custom Mesh File (.bin)

Binary files are the game industry standard format for streaming data from disk to memory at engine run-time  because they can be easily interpreted.

Continue reading

Bounce Lite Update

I’ve added two joint types to Bounce Lite. Ball-in-socket, and revolute with angle limits. Bounce Lite is available at its repository: here. There is a video below showing how five revolute joints can be used to simulate a small ragdoll.

Continue reading

Reducing Reduntant Render State Changes from DirectX 11.0

I’ve been experiencing frame rate drops when rendering different meshes using my DirectX 11.0 based framework to debug physics and create testbeds. My GPU is a (very-old but still working) NVIDIA 8400 GS 512 MiB of VRAM, so I’ve noted that the problem was brute-force setting a bunch of render states before issuing a draw call.

Continue reading