I have iOS game where I have a bouncing character. Everything is being handled by box2d. The problem is when the character hits a wall of another character it's velocity changes, but I don't want this. I need the velocity to stay constant even after collisions.  I was thinking the only way to do this was to keep setting the velocity after each collision unless there's another way to do this that I'm not aware of?
124115
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 objects begins to slow, I want it to fly same speed as before. I heard this can be done by setting liner damping of the object, I think it can prevent only from fast flying objects not slow.   Thanks in advance.  Edit* I can simply modify velocity of the object every frame, is it a solution?  var velocity:b2Vec2=b.GetLinearVelocity(); var speed:Number=velocity.Length(); var ratio:Number=circleSpeed/speed; velocity.Multiply(ratio); b.SetLinearVelocity(velocity);
40395
I'm making a billiard game and I have two questions:  How do I find the velocity of two balls when they collide with each other and how do I apply it to both balls?  I already know the angles that they're gonna move, I just need to find the velocity that they'll move in those directions.  My game is in 3D, and I'm using Unity. I don't want to use Unity's built-in physics to compute the result in this case, I'd like to know how to compute it myself.
50325
I am working on a game in JavaScript and my current implementation of collision uses the shortest distance to push the intersecting object away, which isn't always correct. I've made this diagram of the ideal collision. The red box represents the starting position, the green box represents the proper position and the black box represents the static object it is colliding against. The blue arrow is the velocity vector. With my current implementation, the object would be placed in its final position and pushed out (and in this case it would be pushed left)    How can I fix this?
85491
I'm a programmer and a game developer, not a mathematician or a physicist. So please go easy on the math :)  I know two things:   How to find the new velocities of two objects after an . How to find the velocity of the new object formed by two objects in an .   However what I need to know is: given the mass, the velocity, and the 'angle' the two objects are going two be when they collide - how can I know if I need to compute an elastic or an inelastic collision?  I need this for the 2D game I'm developing, that tries to simulate relatively-realistic physics. Thanks for your help
32726
I've set up the physics of a swinging wrecking ball and set the animation to run for 240 frames.  This was not long enough for the entire "swing" of the ball-and-chain.   I'm unable to reset the timeline, but I can set the end frame to (say) 1000 frames, but when I try to play the animation, the animation progress halts at frame 240 and I cannot get it to go any further.   There are no markers or keyframes in the timeline.  What should I do to "force reset" the animation-timeline, to allow changes to the length?
12446
With the help of the Stack Overflow community I've written a pretty basic-but fun physics simulator.    You click and drag the mouse to launch a ball.  It will bounce around and eventually stop on the "floor".  My next big feature I want to add in is ball to ball collision.  The ball's movement is broken up into a x and y speed vector.  I have gravity (small reduction of the y vector each step), I have friction (small reduction of both vectors each collision with a wall). The balls honestly move around in a surprisingly realistic way.  I guess my question has two parts:   What is the best method to detect ball to ball collision? Do I just have an O(n^2) loop that iterates over each ball and checks every other ball to see if it's radius overlaps? What equations do I use to handle the ball to ball collisions? Physics 101 How does it effect the two balls speed x/y vectors?  What is the resulting direction the two balls head off in?  How do I apply this to each ball?     Handling the collision detection of the "walls" and the resulting vector changes were easy but I see more complications with ball-ball collisions.  With walls I simply had to take the negative of the appropriate x or y vector and off it would go in the correct direction.  With balls I don't think it is that way.  Some quick clarifications: for simplicity I'm ok with a perfectly elastic collision for now, also all my balls have the same mass right now, but I might change that in the future.    Edit: Resources I have found useful  2d Ball physics with vectors:  2d Ball collision detection example:     Success!  I have the ball collision detection and response working great!  Relevant code:  Collision Detection:  for (int i = 0; i &lt; ballCount; i++)   {       for (int j = i + 1; j &lt; ballCount; j++)       {           if (balls[i].colliding(balls[j]))           {             balls[i].resolveCollision(balls[j]);         }     } }   This will check for collisions between every ball but skip redundant checks (if you have to check if ball 1 collides with ball 2 then you don't need to check if ball 2 collides with ball 1.  Also, it skips checking for collisions with itself).  Then, in my ball class I have my colliding() and resolveCollision() methods:  public boolean colliding(Ball ball) {     float xd = position.getX() - ball.position.getX();     float yd = position.getY() - ball.position.getY();      float sumRadius = getRadius() + ball.getRadius();     float sqrRadius = sumRadius * sumRadius;      float distSqr = (xd * xd) + (yd * yd);      if (distSqr &lt;= sqrRadius)     {         return true;     }      return false; }  public void resolveCollision(Ball ball) {     // get the mtd     Vector2d delta = (position.subtract(ball.position));     float d = delta.getLength();     // minimum translation distance to push balls apart after intersecting     Vector2d mtd = delta.multiply(((getRadius() + ball.getRadius())-d)/d);        // resolve intersection --     // inverse mass quantities     float im1 = 1 / getMass();      float im2 = 1 / ball.getMass();      // push-pull them apart based off their mass     position = position.add(mtd.multiply(im1 / (im1 + im2)));     ball.position = ball.position.subtract(mtd.multiply(im2 / (im1 + im2)));      // impact speed     Vector2d v = (this.velocity.subtract(ball.velocity));     float vn = v.dot(mtd.normalize());      // sphere intersecting but moving away from each other already     if (vn &gt; 0.0f) return;      // collision impulse     float i = (-(1.0f + Constants.restitution) * vn) / (im1 + im2);     Vector2d impulse = mtd.normalize().multiply(i);      // change in momentum     this.velocity = this.velocity.add(impulse.multiply(im1));     ball.velocity = ball.velocity.subtract(impulse.multiply(im2));  }   Source Code:     If anyone has some suggestions for how to improve this basic physics simulator let me know!  One thing I have yet to add is angular momentum so the balls will roll more realistically.  Any other suggestions?  Leave a comment!
69278
Suppose a sticky substance is thrown at wall. The initial momentum of the wall and substance system is only due to velocity of the substance but the final momentum is 0. Why is momentum not conserved?
94308
Let us assume I have a brick wall (rigid body) that I want to get smashed with an object (in a rigid body simulation). I want this object to be invisible in the render. Is that possible? How do I do that?
34243
You may be familiar with ryhtm games as , , or even . They have something in common : every single action in the game is synchronized with the music. My purpose is to make a game like Geometry Dash where the player has to do some actions in rythm while the character scrolls automatically in the level. I have a few questions about this type of game :   Do I have to keep my FPS constant as it has to be always synchronized with the music ?  How can I build my levels with a music in mind to make sure that it will be synchronized ?   I am working on Unity using C#.
4011
I want to animate a character in a realistic but easy way. I was thinking that I could use videos of me performing the actions I want to have on my characters, however I can't find a way of placing the videos and make the character to follow my movements in an automated way, like motion tracking. How can I animate automatically using this technique? Are there any Plug-ins to work like this? Is this mehod actually more useful than standard animation techniques?
102152
I played around with it for a while, but I simply can't figure it out.  I made a tank that fires missiles, and when the missiles hit the walls, I want them to bounce off, but I want them to bounce off to the right angle.  Right now I haven't got any obstacles, the missiles just bounce off when they get outside the viewportRectangle I made.  Is the solution I'm looking for quite advanced?  Is there a relativly simple way to do it?
11114
Possible Duplicate:          Layman alert...I last did physics in high school, and am just trying to understand something my son is working on.   To keep a box moving across the floor at a constant velocity I need to apply a force equal and opposite to that of the  force working on it.  If I start applying a force greater than the kinetic friction force, the box will speed up. Will it keep speeding up indefinitely, or will the kinetic friction force I need to overcome increase as the box gets faster?
59672
I want to randomly generate reachable platforms on the fly for a 2D game.  Right now, I am just creating platforms at random x,y positions.  Only 4 platforms can exist at once, so once the 5th one is generated the 1st one is removed (fifo).  So, I want to ensure that the player can jump from his current platform to at least one other at any given time.  I was thinking of using some variant of the distance formula to calculate the location of the next platform being generated.  I was hoping someone could help me out with the formula for calculating the next platforms possible x,y positions.  The player variables I am assuming will be important are speedX, speedY, and gravity.  From here, I should be able to calculate the maximum distance to plug into the distance formula.    However, I am thinking that some variation of the distance formula that contains a variable for slope would be better in my case.  I want to ensure that the player will never get stuck on a platform with no where it can jump.  Also, I want to ensure that platforms aren't generated on top of each other.  Formulas/images/code are a huge plus.  Here is how jumping is currently working.  Field speedY:Float = 4 Field GRAVITY:Float = .05  Method Update:Void()     If KeyDown(KEY_SPACE) And not jumping Then         dy=-speedY         jumping = true     EndIf       If jumping         dy += GRAVITY         local tempY:Float = y + dy         y = tempy     Endif End Method   Edit: I now understand that the formula is just the displacement of basic projectile motion.     Except, in my case, we don't care about cos/sin because the angle will always be the same.
39822
My group of students is helping produce a a 2D platformer. We tried making a pixel-based collision system which fell through. Now I am trying this physics engine on for size and see new ways to create and control my player. Like the obvious circle body player:    I was using a different type of player movement system like .  What system would work for a player that needs to be able to jump and move in mid-air (as in the above link), and can run up slopes like the circular body example?  I guess that the circular body can be made to do anything, but would like community input.
119717
Dear Blender Community,   i would like to build a very simple carriage kind of vehicle, that is simply pushed or dragged over a surface and has the possibility to react to it. My first idea was to use the rigid body settings for it and just build it how i would build it in real life and push it with a cage like box over the surface. but whenever i start to push it, it simply explodes! I applied all the locations/sizes/transformations whatever and the objectcollision shapes are all set to "mesh". I realy don't get it and can't believe that it is so hard. Maybe someone has an idea how this kind of a model can work and react to an uneven surface, that there is this carriage vibe to it? Would be great!   this is how my model looks now, it doesn't need to be much more complex concerning the design:
87740
Some spells can push the target X feet away (like thunderwave, which pushes 10 feet away on a failed save). I was wondering what happens if the target, while being pushed, encounters a wall or other rigid object. Does it take (bludgeoning) damage? To me it seems logical that it would: it is like falling, sudden force applied to a creature due to encountering resistance from an object.  I couldn't find any rules about this in the Player's Handbook nor online.
92666
Seem to have exhausted google looking for an answer to a VERY bullet simple code that should work.  void onCollisionEnter(Collision col) {     print ("hit " + col.gameObject.name);     Destroy (gameObject);     }   Bullet object has the above script, SphereCollider (radius a lot bigger than object), RigidBody, not a trigger, not kinematic, is travelling slow. All checked during runtime.  When it hits a wall (Box collider), it just bounces off but no collisionEnter code is ran.  Debug console bubble is on.