# Tag Info

0

I believe it is as simple as accelerating until you are a square root closer and then decelerating to 0. This is because the final distance is equal to the square of the number you begin to decelerate at. If you begin to slow right after 3 pixels, you will end up at 9 pixels from your starting point. If you stop after 20 pixels, the final result will be 400. ...

0

Let me put this simply. (Or I will try to) First of all, you should read up on Vectors, find out what these are: Vector Magnitude; Vector X,Y coordinates; Normalised Vector; After this, you should read up a bit on physics, especially Newtons three laws; kinetics; momentum; and collisions. After a week or so you should start to understand these ...

0

It kinda depends on what you're making. If you're making a game about physics, you could conceivably write your own physics engine, however I do not recommend it. There are many 2D and 3D physics engines already out there that you can use that will save you months of work. My first time using Box2d was intimidating, and I'll admit it has a fair learning ...

0

First, you need to know the screen bounds: int screenHeight = getScreenHeight(); int screenWidth = getScreenWidth(); Then, you have to initialize the velocity vector for your bouncing square. In this example it'll be <1,1>: BouncingSquare bouncingSquare = new BouncingSquare(); bouncingSquare.velocity.x = 1; bouncingSquare.velocity.y = 1; Also, for ...

0

What you want to do is register collision callbacks for each kind of body. // You have a map from bodies to functions of bodies. Map<BodyData, Function<BodyData> > collisionCallbacks; // Invoke the function associated with that kind of body. collisionCallbacks[firstBodyUserData].Invoke(secondBodyUserData); // An example collision function void ...

0

To keep a character level with a moving "ground" without its x position being affected by the physics engine, it would seem the best solution might be to place an SKConstraint on the character. Specifically: character.constraints = [SKConstraint.positionX(SKRange(constantValue: 0.0))] If you have any weird bugs from SpriteKit's physics engine, you might ...

2

You're in luck. I did a full translation of Randy Gaul's 2D physics engine into C# and XNA. He hasn't really explained things well for beginners like me. For your answer, you should just multiply the cross product with the inverse of the inertia of the body. This is from my translation: angularVelocity += inverseInertia * Vector2D.Cross(contactVector, ...

1

Your density calculation is correct. Either the weight of the human is too much, or you have got to make the human bigger. In real life your human would have more volume or less mass. Which one to select is entirely up to you. And since this is top-down, you can expect to get the wrong density of the human with that formula. If it was a side view game, it ...

3

Whatever collision be, angular momentum is conserved. ie Iw = constant with the coefficient of restitution (in translation, i dont know if its said the same in rotation) u define, and with the moment of inertia, you should be able to figure it out. And i think this would similar to collisions in 1D, since only one axis is used :) Goodluck :)

Top 50 recent answers are included