game-physics

Materials science for game programming

Does anybody know of a good resource for programming the behaviors of various materials interacting? Game programming physics resources usually cover collision detection, momentum, intertia, etc., but they seem to deal with a sort of idealized "material". I'm interested in simulating behavior of, say a projectile striking metal, which ...

Quaternion from Orthogonal Basis

I have a projectile object that is moving along a velocity vector. I need to ensure that the object is always facing in the direction of the velocity vector. Furthermore, I am representing object rotation using quaternions, not matrices. I know that the first step is to find an orthogonal basis: forward = direction of velocity vector...

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 ...

how to synchronize physics model, audio, game rendering, frame display and input

What is a good processing sequence and/or threading model to use to give a user impression of well synchronised physics model, audio, video, sound and input in an application, assuming the application prepares no "predictive" frames or sound? EDIT My question assumes no "networked game" concept, just a standalone machine. ...

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...

Simulate 3D space in 2D

I'm starting to code my first game and I want to make simple 2D sprite game. However I want to simulate 3D space & physics and am searching for some tutorial/guide/algorithms that would teach me the basics... but so far without luck. Do you have any recommendations? Books? I don't care about programming language, any language will do as...

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...

magnetism simulation

Hi Say I have p nodes on a n by m pixel 2D surface, I want the nodes to be attracted to each other such that the further they are apart the strong the attraction. But if the distance between two nodes, say d(A,B) is less than some threshold say k then they start to repel. Could anyone get me started on some code on how to update the co-...

Farseer or Box2D? Top-down shooter physics implementation

Which one of these would fit a top down shooter better? I've heard that Box2D performs faster, but I've also noticed that it lacks wider community support for XNA (it rather seems to be used for flash - for a reason unknown to me). Farseer is however built for XNA, and seems to fit it and perform pretty fine. Farseer's advantage in my ...

How to parse image for border vertices? Complex object geometry (farseer physics)

How could I create body vertices by scanning image and detecting it's shape (of it's non-transparent pixels)? I wanna create complex geometry, and I actually have no real idea where to start, so any advice would be highly appreciated. Accepted answer would most likely be the one that explains the topmost idea. Thanks in advance ...

Sliding Response after a Point-Square Collision

In general terms and pseudo-code, what would be the best way to have a collision response of sliding along a wall if the wall is actually just a part of an entire square that a point is colliding into? The collision test method used is a test to see if the point lies in the square. Should I divide the square into four lines and just cal...

The physics of turning in a boat

I am writing a small simulation of a boat (a sailboat under power rather than sail). It has a rudder and a keel and I have most of the physics working for the thrust and drag. I have modelled the drag across the boat to be higher than along the boat to reduce the sideways slip. However it doesn't behave quite right. Am I right in sa...

[Physics] Why is Verlet integration better than Euler integration?

Hello! Can someone explain me why Verlet integration is better than Euler integration? And why RK4 better than Verlet? I don't understand why it is a better method :/ ...

Android Accelerometer Gravity Compensation

How do you accurately compensate gravity such that I can know the magnitude of the acceleration due to my hand movement in the x-y-z component using the accelerometer data ? ...

Kalman Filter for Android

Is there a Kalman filter implementation I can use to fliter my gyroscope and acceleration data from an Android Phone? ...

Bouncing a ball off a surface

Hi all, I'm currently in the middle of writing a game like Breakout, and I was wondering how I could properly bounce a ball off a surface. I went with the naive way of rotating the velocity by 90 degrees, which was: [vx, vy] -> [-vy, vx] Which (unsurprisingly) didn't work so well. If I know the position and veocity of the ball, as we...

Game Development: Open source project like Crayon Physics?

Hi, Crayon Physics is a wonderful game because of the real motion of all the objects. Gravity and collision are two very important things in that game. I know that is the reason why it costs $19.95 Damn, this is quite difficult to write down my question!! But, is/are there (an) equivalent open source project(s)? I'm very interested in ...

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. Furthermore, if objects "collide" with it when it's disabled, strange things begin to happen...

Vertical circular motion : time(x/y) versus velocity equation

Hi, I wanted to simulate the following through animation : A ball starts with a certain velocity at the bottom most point of a vertical circular loop and keeps rolling in it until its velocity permits. For this, I wanted to find velocity/x/y vs. time equation. For e.g. if the ball had mass : 5Kg, radius of the circular loop = 10m, and...

2D platformer gravity physics with slow-motion

Hi all, I fine tuned my 2d platformer physics and when I added slow-motion I realized that it is messed up. The problem I have is that for some reason the physics still depends on framerate. So when I scale down time elapsed, every force is scaled down as well. So the jump force is scaled down, meaning in slow-motion, character jumps v...