Unity 2d jumping script

Usually for jumping people use Rigidbody2D.AddForce with Forcemode.Impulse. It may seem like your object is pushed once in Y axis and it will fall down automatically due to gravity. Example: rigidbody2D.AddForce(new Vector2(0, 10), ForceMode2D.Impulse);

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

Cosmic Rays: what is the probability they will affect a program?

From Wikipedia: Studies by IBM in the 1990s suggest that computers typically experience about one cosmic-ray-induced error per 256 megabytes of RAM per month.[15] This means a probability of 3.7 × 10-9 per byte per month, or 1.4 × 10-15 per byte per second. If your program runs for 1 minute and occupies 20 MB … 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

Is it possible to make realistic n-body solar system simulation in matter of size and mass?

I did program sol system simulation too so here are mine insights: rendering I use OpenGL with 1:1 scaling. All units are in SI so [m,s,kg,…]. The problem gets started with Z-buffer. The usual Z-buffer bit wide is 16/24/32 bit which is nowhere near what you need. I am rendering from 0.1m up to 1000 … Read more

tech