Code Zealot

Max Distance Constraint

in Constrained Dynamics, Game Development, Physics

As a follow up post to the Distance Constraint post, we can also create a maximum distance constraint using the same solution we found in the Distance Constraint post.

The previous solution created a fixed length distance constraint which forced a pair of bodies to be a given length apart. We can simply add an if statement to make this constraint a max length constraint.

A max length constraint only specifies that the distance between the joined bodies does not exceed the given maximum. So before applying the fixed length distance constraint just check whether the bodies have separated past the maximum distance. If not, then do nothing. Simple!

l = (pa - pb).getMagnitude();
if (l > maxDistance) {
  // apply constraint
}
// otherwise do nothing

1 Comment

Distance Constraint

in Constrained Dynamics, Game Development, Physics

The next equality constraint we will derive is the distance constraint. A distance constraint can be used to join two bodies at a fixed distance. It can also be used as a spring between two bodies.

Continue Reading »

6 Comments

A Few Services Ago

in Bible, One God

A few services ago we had one of our Youth Ministers preach. The topic wasn’t necessarily about the Biblical teaching of One God, however some verses used in the sermon really stand out:

John 14:26
But the Comforter, which is the Holy Ghost, whom the Father will send in my name, he shall teach you all things, and bring all things to your rememberance, whatsoever I have said unto you.

John 15:26
But when the Comforter is come, whom I will send unto you from the Father, even the Spirit of truth, which proceedeth from the Father, he shall testify of me:

It may seem like a contradiction, however, if you believe that the Father, the Son, and the Holy Ghost are one God (yet different manifestations), then this makes perfect sense. I like to look at it as Jesus speaking in the 3rd person in John 14:26 and 1st person in John 15:26 when he refers to sending the Comforter. Many times in the Bible when Jesus speaks, he changes they way that he speaks to fit those who he is talking to.

These particularly stand out to me since they are both words spoken by Jesus (red letter edition), they are within the same book, within one chapter of each other, and the same verse number.

In addition, it’s interesting to me because it resembles a logical proof. One method of proving a theory as true or false is to assume the opposite of what you are trying to prove is true and then find a contradiction. This does exactly that.

Anyway, just figured I would share this.

1 Comment

Point-to-Point Constraint

in Constrained Dynamics, Game Development, Physics

As the first entry after the Equality Constraints post, we will perform the derivation of the Point-to-Point constraint, which models a Revolute Joint, in 2D.

Continue Reading »

0 Comments

Equality Constraints

in Constrained Dynamics, Game Development, Physics

After the first release of the project, I felt that it would be good to pass along what I learned about constrained dynamics.

This is not an easy subject and aside from purchasing books there’s not much information out there about it for those of us not accustomed to reading research papers or theses.

In this post I plan to solve a velocity constraint generally. Later posts will be for the individual types of constraints.

Continue Reading »

8 Comments

EPA (Expanding Polytope Algorithm)

in Collision Detection, Game Development

In the last few posts we learned about using GJK for collision detection, distance between shapes, and finding the closest points. It was stated that GJK must be augmented, to find collision information like the penetration depth and vector, with another algorithm. One such algorithm is EPA.

I plan to cover the EPA algorithm and mention an alternative.

Continue Reading »

18 Comments

GJK – Distance & Closest Points

in Collision Detection, Game Development

The last installment talked about the GJK algorithm as it pertains to collision detection. The original algorithm actually is used to obtain the distance and closest points between two convex shapes.

Continue Reading »

14 Comments

GJK (Gilbert–Johnson–Keerthi)

in Collision Detection, Game Development

Today I’m going to talk about the other collision detection algorithm packaged with the dyn4j project. You can find a lot of GJK documentation but much of it is really technical mostly because they are research papers. I strongly recommend this and to be honest you may not even need to read any further after watching. But if you feel you need more information after watching the video please read on.

Continue Reading »

50 Comments

SAT (Separating Axis Theorem)

in Collision Detection, Game Development

This is a post I have been meaning to do for some time now but just never got around to it. Let me first start off by saying that there are a ton of resources on the web about this particular collision detection algorithm. The problem I had with the available resources is that they are often vague when explaining some of the implementation details (probably for our benefit).

I plan to explain the algorithm and also fill in some of the blanks that I had when implementing this myself.

Continue Reading »

74 Comments

GridBagLayout FTW

in Java

While working on a desktop project (which I hope to release a preview applet/jnlp soon) I decided to use a LayoutManager. Java provides many layout managers whose intention is to layout your controls (buttons, checkboxes, labels, etc) without setting sizes and positions. This post is introducing the GridBagLayout layout manager and why I choose to use this one over the others.

Continue Reading »

0 Comments