Resources for 2d game physics [closed]

Here are some resources I assembled a few years ago. Of note is the Verlet Integration. I am also including links to some open source and commercial physics engines I found at that time. There is a stackoverflow article on this subject here: 2d game physics? Physics Methods Verlet Integration (Wikipedia Article) Advanced Character Physics … Read more

Heap space out of memory

There is no way to dynamically increase the heap programatically since the heap is allocated when the Java Virtual Machine is started. However, you can use this command java -Xmx1024M YourClass to set the memory to 1024 or, you can set a min max java -Xms256m -Xmx1024m YourClassNameHere

How to calculate bounce angle?

You might think that because your walls are aligned with the coordinate axes that it makes sense to write special case code (for a vertical wall, negate the x-coordinate of the velocity; for a horizontal wall, negate the y-coordinate of the velocity). However, once you’ve got the game working well with vertical and horizontal walls, … Read more

Practices for programming in a scientific environment? [closed]

What languages/environments have you used for developing scientific software, esp. data analysis? What libraries? (E.g., what do you use for plotting?) I used to work for Enthought, the primary corporate sponsor of SciPy. We collaborated with scientists from the companies that contracted Enthought for custom software development. Python/SciPy seemed to be a comfortable environment for … Read more

Android accelerometer accuracy (Inertial navigation)

You get position by integrating the linear acceleration twice but the error is horrible. It is useless in practice. Here is an explanation why (Google Tech Talk) at 23:20. I highly recommend this video. It is not the accelerometer noise that causes the problem but the gyro white noise, see subsection 6.2.3 Propagation of Errors. … Read more

Why are my balls disappearing? [closed]

Your error comes from this line initially: var direction1 = Math.atan2(ball1.velocitY, ball1.velocityX); You have ball1.velocitY (which is undefined) instead of ball1.velocityY. So Math.atan2 is giving you NaN, and that NaN value is propagating through all your calculations. This is not the source of your error, but there is something else that you might want to … Read more

Ball to Ball Collision – Detection and Handling

To detect whether two balls collide, just check whether the distance between their centers is less than two times the radius. To do a perfectly elastic collision between the balls, you only need to worry about the component of the velocity that is in the direction of the collision. The other component (tangent to the … Read more