Tag Info

New answers tagged

0

It is now quite some time after the original question was asked; Chipmunk shapes have a property called "elasticity" which is a number from 0 to 1. Setting it to 1 for both bodies you want to collide will ensure perfectly elastic collisions. However, you mentioned that you want to "keep moving bodies moving at a constant speed". This is physically incorrect ...


0

Your velocity is 0 when the ball stops, so the velocity must be 0 at the point where it would "overshoot" (when there's a direction change required in the paddle). You can set your velocity to 0 and change paddle direction when your paddle has reached the y coordinate of the ball.


0

I was able to achieve a precise gravity simulation by applying the 'correction' said in this article: http://www.niksula.hut.fi/~hkankaan/Homepages/gravity.html Basicaly it consists in dividing the gravity by 2 in the very first frame/iteration when adding it to velocity.


3

It's because of the discreet time and the way you integrate. Because you step time forward at 1/50 of a second you're not guaranteed to hit the actual apex of 4.0, the delta is just not granular enough. (Try setting the delta time to 1/5000 and you'll see that it gets closer to 4, obviously that won't work for your game but it will show you the effect). ...


1

It does not stop, if you don't have friction and gravity, that in normal world slow you down. When applying force, you are really not adding force at all and in fact i am bit surprised that it actually moves at all. You should apply more force, to get your object moving. Try something like this. Vector2.right = Thats the direction of the force Multiply by ...


1

Consider reading books about realworld physics. "In physics, a force is any interaction which tends to change the motion of an object." - Wikipedia. So... By applying force you make it accelerate and decelerate. You need to have friction or don't use physics at all to make it stop at the end of button press.


2

The intent of your code is unclear; adding comments would help us know what you're trying to do, and making sure that we don't have to scroll horizontally would really help. The first thing I notice, though, is that you check your system AND your update it at the same time, which could result in the behaviour you have: For balls A and B, if you inspect a ...


0

I have found the solution to this somewhere else. Adding a bigger if statement such as this : private int elapsedTime = 0; //Declared at class level public override void Update(GameTime gameTime) { elapsedTime += gameTime.ElapsedGameTime.TotalMilliseconds; if (elapsedTime > 500) { elapsedTime = 0; birdbox3.X += 5; birdbox3.Y -= 5; ...



Top 50 recent answers are included