Questions tagged [physics]

Refers to real-world physics. For simulation of physics in games use the [game-physics] tag instead, for questions using an existing physics engine use [physics-engine]. Physics is a science that studies the interactions of energy and matter. Questions with this tag concern the simulation or implementation of real-world physics concepts in programming.

The physics tag should be used for questions about how physics can be simulated or implemented in programming. Please ask questions about physics in a non-programming context on the Physics site. Also consider that questions specific to a simplified or approximate physics engine for use in games might receive better answers if asked on Game Development.

3476 questions
11
votes
2 answers

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

Important note: this question has utterly no relation to "PhysX", which is a computer-game-physics system (useful for the physics in arcade games such as ball games, etc); PhysX is a system built-in to Unity3D and other game engines; PhysX is…
OldBerkay
  • 171
  • 1
  • 2
  • 13
11
votes
3 answers

Why gravity acceleration is 0.0004 in PhysicsJS?

Or, perhaps, better, what does it mean? What the units are supposed be? If I'm trying to simulate friction against the "background", like this: return this .velocityDirection .mult(mu * this.mass * g) .negate(); I expect to use g as…
slacktracer
  • 6,262
  • 6
  • 28
  • 33
11
votes
1 answer

JavaScript - Separating Axis Theorem - Collision working, but not Response?

So, I am trying to apply response to my SAT, Circle - Poly, Poly - Poly collisions. I ported this code on this article to JavaScript: http://rocketmandevelopment.com/blog/separation-of-axis-theorem-for-collision-detection/ Now, the detection works…
user2039981
11
votes
2 answers

How are fluid simulations integrated into Rigid Body phisix engines?

1) Is there any proof that simulations that mix Rigid Body phisix and fluids (say SPH) can provide modeling for real world? 2) How does a frame of such mix work? Say we have a woden swing inside a box with 2 difrent liquids (oil and water) and a…
DuckQueen
  • 772
  • 10
  • 62
  • 134
11
votes
2 answers

Function for rotating 2d objects?

Is it possible to write a function in python that could rotate any 2d structure with the arguments being only the coordinates (x,y) of the points in the structure? Additional arguments would be included for axis, speed and direction. To my…
11
votes
1 answer

SpriteKit: How to create Basic Physics Joints

I am trying to create simple Joints between two SKPhysicsBodies. But, they are acting weirdly. I am well aware of the fact the anchor points should be on scene coordinate. Please have a look at the Source code attached. For Example this is how a…
Bavan
  • 1,021
  • 1
  • 10
  • 24
11
votes
3 answers

SpriteKit - Set Scale and Physics

What is the correct way to "zoom out" on your scene. I have an object that I apply an impulse to fire it across the screen. It for example will fire about 100 px across., this works as expected - increase the force it flys more, increase the density…
DogCoffee
  • 19,820
  • 10
  • 87
  • 120
10
votes
6 answers

Python alternative to Java applet?

Is there an alternative to making educational Java applets for physics simulations like projectile motion, gravity, etc?
hershey92
  • 783
  • 2
  • 6
  • 17
10
votes
3 answers

Are there any well known algorithms to count steps based on the accelerometer?

I'm implementing an accelerometer-based pedometer, and I was wondering if there was any known algorithms to handle that.
Bassel Alkhateeb
  • 1,584
  • 5
  • 19
  • 35
10
votes
1 answer

Cocos2D Bezier curve around object as if by gravity

I'm trying to manipulate an object. When it gets near another object, let's say a globe, I want the globe to have a gravitational pull on the original object. I know I'm supposed to use CCBezierTo, so this isn't so much a programming question as it…
switz
  • 24,384
  • 25
  • 76
  • 101
10
votes
4 answers

Algorithm to control acceleration until a position is reached

I have a point that moves (in one dimension), and I need it to move smoothly. So I think that it's velocity has to be a continuous function and I need to control the acceleration and then calculate it's velocity and position. The algorithm doesn't…
Damian
  • 5,471
  • 11
  • 56
  • 89
10
votes
4 answers

Wave Simulation with Python

I want to simulate a propagating wave with absorption and reflection on some bodies in three dimensional space. I want to do it with python. Should I use numpy? Are there some special libraries I should use? How can I simulate the wave? Can I use…
kame
  • 20,848
  • 33
  • 104
  • 159
10
votes
2 answers

Why are computer/game physics engines often non-deterministic?

Developing with various game physics engines over the years, I've noticed that on the same machine I observe widely different results in physics simulations between runs. Most recently, the Unity engine does this, even though physics are calculated…
10
votes
3 answers

Calculate x/y point that 2 moving balls will collide

I'm trying to make what is (essentially) a simple pool game, and would like to be able to predict where a shot will go once it hits another ball. The first part is, I believe, to calculate if the cueball will hit anything, and if it does, where it…
user352151
  • 127
  • 1
  • 6
10
votes
2 answers

Calculate moment of inertia given an arbitrary convex 2D polygon

I've been researching this question for hours and for some reason I haven't been able to find the solution. Given a convex polygon that is defined as an array of points in clockwise order around the polygon's centroid, how can I calculate the…
Parker Hoyes
  • 2,118
  • 1
  • 23
  • 38