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
18
votes
1 answer

2D soft bodies: Gelly and moldable?

I am using Matter.js physics in an attempt to create soft bodies. I was able to create a body like this: However I am not sure if this is the "soft body" I want. It is true that this body is not entirely rigid and has that bouncy feel when it…
Kunis
  • 576
  • 7
  • 24
18
votes
4 answers

Applying physics to Android View objects

I currently have an android application that utilises the native android views for the UI (e.g. imageviews/buttons etc) Although this app is not a game, nor requires any heavy graphics or OpenGL, I would like to incorporate a little physics-related…
Kurian Vithayathil
  • 807
  • 2
  • 7
  • 20
18
votes
7 answers

Continuous collision detection between two moving tetrahedra

My question is fairly simple. I have two tetrahedra, each with a current position, a linear speed in space, an angular velocity and a center of mass (center of rotation, actually). Having this data, I am trying to find a (fast) algorithm which would…
x26
  • 181
  • 1
  • 5
17
votes
2 answers

Find phase difference between two (inharmonic) waves

I have two datasets listing the average voltage outputs of two assemblies of neural networks at times t, that look something like this: A = [-80.0, -80.0, -80.0, -80.0, -80.0, -80.0, -79.58, -79.55, -79.08, -78.95, -78.77, -78.45,-77.75, -77.18,…
Doa
  • 1,965
  • 4
  • 19
  • 35
17
votes
6 answers

Bullet physics engine, how to freeze an object?

Using Bullet 2.76 I'm trying to freeze an object (rigid body) so that it instantly stops moving, but still responds to collisions. I tried setting it's activation state to DISABLE_SIMULATION, but then it's virtually nonexistent to other objects.…
sunside
  • 8,069
  • 9
  • 51
  • 74
16
votes
9 answers

2d Platformer physics

It was a long holiday weekend, so I got the coding bug again and started playing around: Mario http://gfilter.net/junk/tileengine.jpg I wrote a basic tile engine, but having never attempted this before, I am really struggling with handling sprite…
FlySwat
  • 172,459
  • 74
  • 246
  • 311
16
votes
2 answers

applyForce(0, 400) - SpriteKit inconsistency

So I have an object that has a physicsBody and gravity affects it. It is also dynamic. Currently, when the users touches the screen, I run the code: applyForce(0, 400) The object moves up about 200 and then falls back down due to gravity. This only…
Max Hudson
  • 9,961
  • 14
  • 57
  • 107
16
votes
4 answers

Writing a faster Python physics simulator

I have been playing around with writing my own physics engine in Python as an exercise in physics and programming. I started out by following the tutorial located here. That went well, but then I found the article "Advanced character physics" by…
mooglinux
  • 815
  • 1
  • 11
  • 27
15
votes
6 answers

Open source physics engines

I have been using the Open Dynamics Engine (ODE) for the last few weeks with great success. It has a very simple API and its simulations at least look realistic. (I sometimes wonder about my collision joint parameters, but whatever.) My only…
Frank Krueger
  • 69,552
  • 46
  • 163
  • 208
15
votes
2 answers

KDTree Splitting

I am currently writing a KDTree for a physics engine (Hobby project). The KDTree does not contain points. Instead it contains Axis Aligned bounding boxes which bound the different objects in the environment. My problem is deciding on how to split…
shaleve
  • 153
  • 1
  • 1
  • 4
15
votes
2 answers

2D orbital physics

I'm working on a 2D physics engine for a game. I have gravity and masses working, using a simple iterative approach (that I know I'll have to upgrade eventually); I can push the masses around manually and watch them move and it all works as I'd…
David Given
  • 13,277
  • 9
  • 76
  • 123
15
votes
2 answers

Open source, pure Java physics / dynamics library

I'm looking for a lightweight, pure Java physics engine to do some simulations for robotic motion control. My requirements: Rigid body physics Joint constraints and forces Convex object collision detection Lightweight, pure Java so it can be…
mikera
  • 105,238
  • 25
  • 256
  • 415
15
votes
1 answer

Open quantum system modelling

I have been working for a long time now on modelling an open quantum system using the Lindblad Equation. The Hamiltonian is the following: However, two other matrices are added to the Hamiltonian. One of them has all the diagonal terms equal to…
TanMath
  • 598
  • 1
  • 9
  • 27
15
votes
3 answers

Breaking a concave polygon into convex ones

I'm using a game physics library (Box2D) which only supports convex polygon shapes. However, I'd like the level builder to be able to just specify concave polygons without having to worry about that. So, how can I automatically break apart a concave…
Bart van Heukelom
  • 43,244
  • 59
  • 186
  • 301
15
votes
3 answers

Need help with circle collision and rotation? - Game Physics

Ok so I have bunch of balls: What I'm trying to figure out is how to make these circles: Rotate based on the surfaces they are touching Fix collision penetration when dealing with multiple touching objects. EDIT: This is what I mean by…
RadiantHex
  • 24,907
  • 47
  • 148
  • 244