# Tagged Questions

Relating to the motion of objects through space and time. Including concepts such as acceleration (thrust and gravity), mass, collision response, friction and more.

4k views

### Get GameObject to bounce of colliders [duplicate]

I am making a Atari Breakout game with unitys 2d tools and I need to get the ball to bounce of colliders in the scene. If you havent played the game before how it works is if the ball hits the wall at ...
1k views

### Throw object towards predefined place? [duplicate]

I have a 2D side-view game with object attributes such as x, y, speedX, etc. Now I want to throw a given object from any place on the screen onto a defined goal place, in such a way that its ...
604 views

### In 2d game logic, should I use pixels or world coordinates?

Currently in my game I handle the logic (collisions, movement) using pixels but I find it very limiting espiecially when thinking about variable speed. For example Box2D requires you to use ...
7k views

### How to implement explosion in OpenGL with a particle effect?

I'm relatively new to OpenGL and I'm clueless how to implement explosion. So could anyone give me some ideas how to start? Suppose the explosion occurs at location \$(x, y, z)\$, then I'm thinking of ...
10k views

### which is the best physics engine for flash as3? [closed]

i am a game programmer and i use actionscript to do all my collision checking, boundary checking etc...but recently i noticed there are things called "physics engines" that help me concentrate more on ...
229 views

### How to change the gravity with a click

How to change the gravity of a ball upward with a click Then change it again downward with another click And so on In unity
150 views

### Character animation in physics-simulated environment

What are the standard solutions for animating characters in physics-simulated environments? Let me explain what I mean - in most games characters are pretty much excluded from physics simulation - ...
837 views

### How to Calculate Velocity in a 2D space game

I am currently using screenpos.X = (float)(screenpos.X + velocity * Math.Sin(r)); screenpos.Y = (float)(screenpos.Y - velocity * Math.Cos(r)); For my Movement with r being the Rotation in Radians. ...
319 views

### Perpendicularity of a normal and a velocity?

I'm trying to fake angular velocity on my vehicle when it hits a wall by getting the dot product of the normal of the edge the car is hitting and the vehicle's velocity: Vector2D normVel =...
848 views

### Implementing distance joint

I would like to implement something that behaves much like a distance joint / revolute joint in Box2D, however I do not want to throw a whole physics engine at this problem. I'm curious where I might ...
3k views

### collision resolve sphere-aabb and aabb-aabb [closed]

I am currently working on a basic physics engine which does not consider rotations. At the moment I work on collision resolving between aabbs and spheres. Unfortunately I have no idea what a collision ...
153 views

### Anybody remember this webpage? [closed]

I remember visiting a webpage some time ago (1 year ago maybe) It contained many java applets, describing how certain mathematical functions like sin, cos, arcsin, exp would make an object move, with ...
719 views

### Variable physics step, bad idea?

Currently, when I update the entities I calculate the time passed since the last update, and then pass that to their update function. They will in turn pass that duration to all their components. ...
2k views

### Collision Detection for 2D

I am working on a simple game, where I need to do a collision detection of two Texture2D. The code I have written is: bool perPixelCollission = false; Texture2D texture1 = sprite1.Texture;...
107 views

### Performing movement per game tick

Assume we have a player on a map, whereby the grid is represented as a floating point. When a player is moving, they have an x and y velocity. How to do you properly apply their movement each ...
45 views

### 2D circle against a corner change in direction

I have a 2D Ball that might go against a wall. If the Ball goes against the wall perpendicularly, it will just invert its direction (assuming no air resistance and no bounces that should make its ...
85 views

### 2D sunrise in Unity

I see a lot of guides on how to create sunrise in 3D space, but I can't find much information on how to do it in 2D. In 3D, you rotate a lightsource around itself, but in 2D, I need to move the object ...
99 views

### Acceleration problems

Im trying to make a car game, but i cannot get the acceleration code right. With this code: if(gas){ speed += 3; }else if(break_ && !(speed < 6)){ speed -= 3; ...
508 views

### Testing Unity 2D Physics

I am looking to push the 2D physics in Unity to the extent where when so much is going on that there becomes noticeable lag in a game. This is for testing purposes, so that when so much is going on ...
316 views

### Simulation of ball movement in a 3d landscape. The easiest way?

I have a landscape(generated via Perlin noise) and a ball. I want the ball to move along the geodesic(implementation of basic physics: gravitation, friction). I thought to do raycast around the ball ...
362 views

### Estimate the time it takes for an object to travel from point A to point B

I have an object with vec2 position, velocity, and destination with 2 variables maxspeed and acceleration. In each step, its position is calculated as follows: vec2 desiredVel = destination - ...
34k views

### Simple collision detection in Unity 2D

I realise other posts exist with this topic yet none have gone into enough detail for me. I am attempting to create a 2D game in Unity using C# as my scripting language. Basically I have two objects, ...
263 views

### AABB vs Rectangle

I'm trying to wrap my head around 2D physics and stumbled upon Axis Aligned Bounding Boxes, and I have a couple of questions regarding them. In all AABB structs I could find out there, people prefer ...
107 views

### Box2D relations

As far as I know, the unit in Box2D is meters. When I use Box2D in Processing with JBox2D, I set the "world size" as the window size specified in the setup(). Now I'm wondering if there is any ...
104 views

### How to reduce the time it takes to speed up an object?

I have a body that I am applying a force to every step. However, I it takes a significant amount of time for it to speed up, which I do not want. Is there some value I can adjust to help with this?
1k views

### How to move around a player in a curved tunnel?

In a scenario where the player moves freely along the walls of a tunnel (like this), what is the best way to move the player along the walls of the tunnel? I'm using Unity3d game engine. I've tried ...
2k views

### Box2d contant speed before and after collision

I want to make my body fly at constant speed, how to make it fly at constant speed before and after collision? I set restitution of my body to 1.0 but after some direct and powerful collisions my ...
295 views

### Gravity independent of game updates per second

Edit Just for clarification, my sprite's 'movement' isn't the problem. If I set my Time variable to 4 seconds, then it will cross the screen in exactly 4 seconds regardless of logic updates rate per ...
442 views

### How can I manage large numbers of objects in a physics engine? [duplicate]

MY friend and I are programming a game and I decided to give the physics engine a try. I was able to get a class working where it would calculate out the total force on a model and apply the correct ...
219 views

### Distribute circles evenly on Screen - circle packing

I want to evenly distribute a random amount of circles with random diameter on the screen for. This level doesn't scroll so the users screen resolution sets the limits. Further I would like the ...
199 views

### Collision detection for Monotouch [closed]

What I want to have for my Monotouch 2D projects: simple collision detection and collision polygons working with UIViews Sounds simple, isn't it? I've evaluated a lot of engines available on the ...
385 views

### What different ways are there to model restitution in a physics engine?

In my physics engine I give a body a value for restitution between 0 and 1. When two bodies collide there seems to be different views on how the restitution of the collision should be calculated. To ...
1k views

### Calculating angle between two vectors to steer towards a target

I have been trying to implement a path following steering behaviour for AI in a 2D racing game. I have two vectors: futurePosition represents the predicted future position given the car's current ...
3k views

### Best 3D Physics Engine to use with Ogre [closed]

I am looking for a good physics engine to use with an Ogre game I'm writing. I would prefer for it to be free, open source, mature, simple to use, easy to learn, and flexible. I'm currently thinking ...
341 views

### Calculating the force of an impact?

I'm trying to figure out a way to determine the force two objects collide in. I have two vectors defining their linear velocity at the time of impact, their mass and their angular velocity. Keep in ...
26 views

### What is a good practice for deciding when to use transforms instead of applying force?

I was making several games. I don't understand when I should use addTorque instead of rotate. AddForce instead of position The latest game was a pinball game. I wasn't sure the best way to active ...
40 views

### Gravity wells that go with finger [duplicate]

I have a simple particle game, where all the particles are arranged in a grid. This game is for touch devices so to take advantage of it I am trying to have a multitouch gravity field thing going on. ...
89 views

### Calculating the angular momentum of rigidbody in Unity3D

Knowing that angular momentum in 3D is L = Iω (moment of inertia times angular velocity), how do I calculate it in video game world? In unity3d I have the diagonal inertia tensor rigidbody....
2k views

### Invalid AABB aabb

Invalid AABB aabb UnityEditorInternal.InternalEditorUtility:CalculateSelectionBounds(Boolean, Boolean) I've got this error ...
170 views

### LOVE Physics - Breaking Joint Chains (LUA / Box2D)

Wasn't sure whether to post here or on SO so please move if needed. I've been having a look into the box2D physics API provided by LOVE to try and create a swinging flail or weighted rope but I'm ...
151 views

### Calculate intersect point / aim point

I'm working on a simple game, and I need to calculate the position to aim. Since my math days are a bit behind me, I put together a simple example to illustrate: So given that I know the position ...
477 views

### Leapfrog integration vs Euler integrator

I am looking at various integration methods for my n-body simulation and I'm slightly confused about actual implementation of leapfrog integration. According to the wikipedia page leapfrog method is ...
130 views

### What is the purpose of integration in physics engines?

All online resources seem to assume that you know what this means and/or state that this is related to object movement in some way. How does this differ than just position.x++ and position.y++ and ...
325 views

### Wandering motion in Unity

I am trying to come up with a smooth wandering motion for my game-object using Unity. What I currently doing is rotate the object by some random angle calculated every 1.5 second delay. But I am ...
96 views

### Reflection velocity

I'm trying to get a moving circular object to bounce (elastically) off of an immovable circular object. Am I doing this right? (The results look right, but I hate to trust that alone, and I can't ...
624 views

### How can I get the force of a collision in Love2D?

Is it possible to get the force of a collision between two objects in Love2D/Box2D? If so, how?
77 views

### Controls: Rolling on a ceiling

Currently I'm writing an iOS game where the basic movement is rolling. Technically you make the player turn clockwise or counterclockwise. When you tilt the device to the right, you will rotate ...
1k views

### Need to translate a Rotation Matrix to Rotation y, x, z OpenGL & Jitter for 3D Game

I am using the Jitter Physics engine which gives a rotation matrix: M11 M12 M13 M21 M22 M23 M21 M32 M33 And I need it so OpenGL can use it for rotation GL.Rotate(xr, 1, 0, 0) GL.Rotate(yr, 0, 1, 0)...