physics

Verlet Integration is blowing up my physics engine

I'm building a physics engine and i had some sort of "pseudo-verlet" thing going and i wanted to upgrade it to "real" verlet. So i found an article and set to work. After i added what i think is a good approximation, the engine doesn't work anymore. Can someone help me understand what i'm doing wrong? My main physics body class's update...

Order of calculation and iterations for physics engines

I'm writing a physics engine that uses Verlet integration, and i can't get some constraints to work right. Some (like a bond/weld constraint) are extra "soggy" and aren't stiff enough, while others (like an area constraint) are extra bouncy and send atoms flying. The code for my update ethod in my physics simulator is like this: Pr...

How to implement restitution coefficient into a simple physics engine?

I am writing a simple 2d physics engine that supports circle-circle collision and i can't figure out how to retrofit my collision resolution method to add restitution. How is a restitution coefficient property implemented in physics engines? ...

Area constraint blows up my physics simulation if a body slams into it too fast

I have a physics simulation and it allows you to place area constraints, so that the bodies within will not exit that area. However if an atom goes past one of the "walls" of the area constraint it blows up the physics simulation. Why does it do this? Update method: if (!atom.IsStatic) { Vector2 force = Vector2.Zero; bool x = fa...

How to make soft springs with constraints being iterated?

I'm trying to add springs to my physics engine, and while the algorithm itself works, they are incredibly stiff ( have to feed in values <= about 0.1 to get any visible motion out of it, and it has to be set extremely small in order to work properly). Any tips for improving the following code so it's not as stiff with values in the 0.1 t...

Broad-phase collision detection methods?

I'm building a 2D physics engine and I want to add broad-phase collision detection, though I only know of 2 or 3 types: Check everything against everything else (O(n^2) complexity) Sweep and Prune (sort and sweep) something about Binary Space Partition (not sure how to do this) But surely there's more options right? what are they? A...

Runge-Kutta (RK4) integration for game physics

Gaffer on Games has a great article about using RK4 integration for better game physics. The implementation is straightforward but the math behind it confuses me. I understand derivatives and integrals on a conceptual level but I haven't manipulated equations in a long time. Here's the brunt of Gaffer's implementation: void integrate(S...

Bullet Physics - Apply Torque Impulse in Body's Local Space

Hello, I'm currently evaluating the Bullet Physics Library for a 3D space game I'm writing using C++ and Ogre3D. I've gotten Ogre3D and Bullet integrated nicely by deriving from btMotionState and plugging in my SceneNodes, but now I'm having a lot of trouble calculating what values I should pass to btRigidBody::applyCentralImpulse and b...

Applying Coefficient of Restitution in a collision resolution method

I have a collision resolution method in my physics engine, that goes like this: Vector2 n1pos = n1.NonLinearSpace != null ? n1.NonLinearPosition : n1.Position; Vector2 n2pos = n2.NonLinearSpace != null ? n2.NonLinearPosition : n2.Position; Vector2 posDiff = n2pos - n1pos; Vector2 posDiffNormal = posDiff; posDiffNormal.Normalize(); float...

Finding the spin of a sphere given X, Y, and Z vectors relative to sphere

I'm using Electro in Lua for some 3D simulations, and I'm running in to something of a mathematical/algorithmic/physics snag. I'm trying to figure out how I would find the "spin" of a sphere of a sphere that is spinning on some axis. By "spin" I mean a vector along the axis that the sphere is spinning on with a magnitude relative to the...

Falling object in Box2D should rotate due to centre of mass?

I'm trying to simulate a falling balloon in Box2DAS3. What is important is that balloon falls the such that the bottom part were you blow it up rotates towards the bottom if it's knock sideways or is dropped at an angle. I've tried offsetting the center of mass of the body and also joining two bodies together with the denser one repre...

Farseer Physics XNA Geom 'Tripping'

Hello, I have an issue similar to http://farseerphysics.codeplex.com/Thread/View.aspx?ThreadId=72364 I have a rectangle player geom, and many rectangle tile geoms lined up next to each other. Occasionally when the player geom is crossing between them he seems to clip onto the corners of the tile geom and as a result rotate over. Even ...

Is there a method in Java that can do integration?

I am writing a program in java that models a carnot engine and I want to calculate the work done and I need to use integration. I have been looking around on google and haven't found quite what I am looking for, have any suggestions? ...

Triangle - Triangle Intersection Test.

I'd like to know if there is out there some tutorial or guide to understand and implement a Triangle-Triangle intersection test in a 3D Environment. (i don't need to know precise where the intersection happened, but only that an intersection has occurred) I was going to implement it following a theoric pdf, but i'm pretty stuck at the ...

Collision Detection between Accelerating Spheres

I am writing a physics engine/simulator which incorporates 3D space flight, planetary/stellar gravitation, ship thrust and relativistic effects. So far, it is going very well, however, one thing that I need help with is the math of the collision detection algorithim. The iterative simulation of movement that I am using is basically as ...

Consider a career in programming, would like advice on which degree to choose

Hi, as the title says I'd like advice on choosing a degree for a future career in programming. I recently attended a Mastering Physics workshop at the University of Nottingham, in which I attended several lectures. One of these lectures was dedicated to the benefits of taking a physics degree. The lecturer said that physicists were oft...

ePic - what’s the relations with physics ?

What is the relation with Physics and techniques ? I am interested in learning the algorithms followed in this 3d photo viewer ePic. Any other known physics engine ? ...

Need help deciphering a formula for Projectile Motion

I need to implement a bit of AI to figure out how to hit a target with projectile motion. I found this over at wikipedia: Angle required to hit coordinate Which looks like just the thing I need, especially since I have the added problem launching the projectile from above zero height. However, my maths skills aren't great so it all l...

Box2D body position always (0,1) on spawn

I'm creating a b2BodyDef with the position set to (10,10). Then I run world->CreateBody(&shDef); but the b2Body is created at position (0,1). How can I fix the body creation so that it spawns at the desired location? I know the body is in the wrong place because: A. The rendering system isn't rendering it in the right place B. Print...

radians translating radians to degrees

I notice that translating radians to degrees and vice versa is like translating a percentage to a whole number and vice versa. for example , to get 60 percent of 345 you do the following 60 * 345/100 to get 60 degrees in radians you do 60 * 3.14/180 There is a pattern there BUT. we use 100 to compare percentages to a numbe. so why ...