physics

2D Spaceship movement math

Hi, I'm new here. I'm trying to make a top-down spaceship game and I want the movement to somewhat realistic. 360 degrees with inertia, gravity, etc. My problem is I can make the ship move 360° with inertia with no problem, but what I need to do is impose a limit for how fast the engines can go while not limiting other forces pushing/p...

Determining if and where a photon will collide with a polygon in 3D space.

The problem is straight forward: 1) We have a photon traveling from Point 1 (x,y,z) to Point 2 (x,y,z), both of which could be located anywhere in 3D space. 2) We have a polygon that is both rotated randomly on the x-axis and/or y-axis and also located anywhere in 3D space. 3) We want to find: a) if the photon will collide with the p...

Making Billiards in Box2D

As a quick overview: I'm trying to make a game of pool using Box2D as a basis. Now my question: How should I set up the billiard balls and edges so that they act normally? The balls sometimes seem to stick to the edges for no apparent reason. I've got four static wall objects with a restitution of 1 around the edges of the table. Ea...

Do physics libraries have things I might be able to use for geometry culling?

I always hear the relationship between collision detection and the different space partitioning techniques. Do any physics libraries contain common data structures like maybe a frustum class or anything that would make it easier to implement octrees, quadtrees, etc? ...

Accelerometer gravity components

Hi, I know this question is definitely solved somewhere many times already, please enlighten me if you know of their existence, thanks. Quick rundown: I want to compute from a 3 axis accelerometer the gravity component on each of these 3 axes. I have used 2 axes free body diagrams to work out the accelerometer's gravity component in the...

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

Python/Biomolecular Physics- Trying to code a simple stochastic simulation of a system exhibiting conditional behavior!

*edited 6/17/10 I'm trying to understand how to improve my code (make it more pythonic). Also, I'm interested in writing more intuitive 'conditionals' that would describe scenarios that are commonplace in biochemistry. The conditional criteria in the below program I've explained in Answer #2, but I am not satisfied with the code- it wor...

Help starting a bobblehead effect?

I have no working code at all, but I'll post my method of display the image I need to bobble. public void onDraw(Canvas can){ can.drawBitmap(bobbleHead , xpos, ypos, p); } I have xpos and ypos declared. ...

Position elements without overlap

I have a number of rectangular elements that I want to position in a 2D space. I calculate an ideal position for each element. Now my problem is that many elements overlap as very often the ideal positions are concentrated in one region. I want to avoid overlap as much as possible (doesn't have to be perfect, though). How can I do this? ...

How would one use Cocos2d to create a game like this.

http://itunes.apple.com/us/app/angry-birds/id343200656?mt=8&ign-mpt=uo%3D6 So I am getting started with this all game dev thing on iphone and I decided that I will start playing with Cocos2d as my starting engine. Now just so i have a goal in mind, I picked angry birds as my initial target of what sort of game play would I like to...

Finding a stable placement of an irregular (non-convex) shape

Given an image of a 2-dimensional irregular (non-convex) shape, how would I able to compute all the ways in which it could lie stable on a flat surface? For example, if the shape is a perfect square rectangle, then it will surely have 4 ways in which it is stable. A circle on the other hand either has no stable orientation or every point...

AI Behavior Decision making

I am running a physics simulation and applying a set of movement instructions to a simulated skeleton. I have a multiple sets of instructions for the skeleton consisting of force application to legs, arms, torso etc. and duration of force applied to their respective bone. Each set of instructions (behavior) is developed by testing its ef...

Box2D: How to manually render a body

Hi, I'm getting crazy... I succeed installing box2d into my project. But how can I draw a body? Of course I need an engine to draw with, but that doesn't matter now (SDL). I just want to reach that I can get all the coordinates of the points that represent the body-polygon, to draw it with the engine. (Not relevant for circles) If you ...

What mathematics is needed for a lunar lander game?

I'd like to build a game to learn cocos2d. Lunar lander is the first exercise coming in my mind. Any pointer/source code/tutorial of the physics calculations required will be appreciated. Thanks! ...

Reflecting a circle off another circle

Working with iPhone and Objective C. I am working on a game and I need to correctly reflect a ball off a circle object. I am trying to do it as a line and circle intersection. I have my ball position outside the circle and I have the new ball position that would be inside the circle at the next draw update. I know the intersect point of...

Cocos2D Asteroids

Hello. For school I have to make a game for my iPod touch, I chose to do an asteroids game. I have just started with cocos2d but have read the wenderlich blog. I wanted to use chipmunk in my game, i want realisitc motion of the ship. Is there a tutorial on creating the asteroids motion? Thanks. ...

Ballistic curve problem

Ok i know this is quite off-topic for programmers but still I need this for app, so here it is: Ballistic curve (without wind or any other conditions) is specified by these 2 lines: So, there is a problem that you got 3 unknown values: x,y and time t, but only 2 equations. You can't really compute all 3 with just these values, I go...

Projectile hit coordinates at the apex of its path

Hi, I have a projectile that I would like to pass through specific coordinates at the apex of its path. I have been using a superb equation that giogadi outlined here, by plugging in the velocity values it produces into chipmunk's cpBodyApplyImpulse function. The equation has one drawback that I haven't been able to figure out. It onl...