Elastic Collisions in Objective C

Posts: 27
Joined: 2011.04
Post: #1
In my game I am planning to have some simple elastic physics, so I am currently researching on it. The math isn't too complicated, and I have found this page: "http://freespace.virgin.net/hugo.elias/m..._snokr.htm". Can anyone verify if the information on this page is accurate? I am also looking for a math library that will allow me to do simple vector operations (adding, normalizing, dot product). I have heard of the Accelerate framework by apple, is this what I'm looking for?

A 14 year old app developer...god help me...
Quote this message in a reply
⌘-R in Chief
Posts: 1,277
Joined: 2002.05
Post: #2
No, Accelerate is not related. That's a different meaning of vector.

For simple vector math, you really just write your own.

Also: http://code.google.com/p/chipmunk-physics/
Quote this message in a reply
Posts: 1,487
Joined: 2002.09
Post: #3
My Chipmunk Physics library has a decent set of 2d vector operations defined for it. It would be pretty easy to separate them from the rest of the library if you wanted too. It's also pretty trivial to write them yourself.

You don't want to use the Accelerate framework for this sort of thing. Accelerate is good for things like image processing where you have an array of 100k numbers you want to add together, then multiply by another array of numbers. Basically it's taking advantage of SIMD instructions (also sometimes called vector instructions) of whatever CPU type it's running on to process this sort of data faster.

Scott Lembcke - Howling Moon Software
Author of Chipmunk Physics - A fast and simple rigid body physics library in C.
Quote this message in a reply
Posts: 27
Joined: 2011.04
Post: #4
Ok, thanks guys. Does anyone know whether the page I found is accurate?

A 14 year old app developer...god help me...
Quote this message in a reply
Posts: 1
Joined: 2011.05
Post: #5
The math isn't necessarily incorrect, but it is oversimplified and not how I would work elastic collisions in objectiveC, and the diagram is misleading as the resulting vectors c and d will only go that direction if the objects have the same mass and same speeds to begin with. As far as I can tell that pseudocode doesn't determine the directions of the resulting vectors. Taking the dot product also won't work for orthogonal collisions. Are you having two objects that are moving collide, or is it collisions between a stationary object and something bouncing into it?
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Sometimes collisions work, sometimes they don't. t3knomanser 5 5,726 May 13, 2006 03:00 PM
Last Post: Iceman
  More Collisions Nick 7 6,950 Oct 12, 2004 08:41 AM
Last Post: Nick
  Avoiding Collisions DM6 4 5,627 Jul 31, 2004 11:31 AM
Last Post: FCCovett