Questions tagged [game-physics]

Game Physics is about implementation, creation, optimization and any other thing related to physics in games. Physics controls the interaction of every physical object in a game, where any 2d or 3d model interacts with any other 2d or 3d model of an object in a game. Physics is used to give realistic effects of this interaction.

Game Physics is about implementation, creation, optimization and any other thing related to physics in games. Physics controls the interaction of every physical object in a game, where any 2d or3d model interacts with any other 2d or 3d model of an object in a game. Physics is used to give realistic effects of this interaction.

3864 questions
8
votes
2 answers

gravity simulation

I want to simulate a free fall and a collision with the ground (for example a bouncing ball). The object will fall in a vacuum - an air resistance can be omitted. A collision with the ground should causes some energy loss so finally the object will…
Vert
  • 81
  • 2
8
votes
2 answers

didBegin contact not being called in Swift

I have two nodes, and I want to detect a collision between them, but for some reason func didBegin(_ contact: SKPhysicsContact) { is not being called. It is a ball and a paddle: ball.physicsBody?.categoryBitMask =…
Will
  • 81
  • 2
8
votes
2 answers

C++ time measurement looks too slow

I am programming a game using OpenGL GLUT code, and I am applying a game developing technique that consists in measuring the time consumed on each iteration of the game's main loop, so you can use it to update the game scene proportionally to the…
Jaime_mc2
  • 673
  • 5
  • 18
8
votes
3 answers

The time-corrected Verlet numerical integration formula

There is a commonly used verlet-integration formula on the web by Johnathan Dummer, called Time-Corrected Verlet. However I've read several forum posts, that people get weird or unexpected results with it in certain conditions. Formula by Johnathan…
8
votes
3 answers

SpriteKit SKPhysicsBody bodyWithTexture is Upside Down

Hi I'm trying to fix this bug with spritekit's physics shape appearing upside down. [SKPhysicsBody bodyWithTexture:monsterTexture size:monsterTexture.size] The first time the monster appears the phsyics body orientation is correct. But the second…
8
votes
2 answers

Linear movement stutter

I have created simple, frame independent, variable time step, linear movement in Direct3D9 using ID3DXSprite. Most users cant notice it, but on some (including mine) computers it happens often and sometimes it stutters a lot. Stuttering occurs…
Demion
  • 857
  • 1
  • 14
  • 27
8
votes
2 answers

Drag div by leading point (like a boat in water)

I'm try to get a div to drag much like a boat through water, but I'm having some trouble getting the rotation right. Here is what I have so far: jsFiddle JS var start, stop; $('#canoe').draggable({ containment: '#board', cursor: 'none', …
apaul
  • 16,092
  • 8
  • 47
  • 82
8
votes
3 answers

How to handle multiple simultaneous elastic collisions?

I'm computing the result by colliding pairs of 2D convex objects (without rotation), using the basic equations on wikipedia. However, when there are dependencies, like two objects hitting another object at the same time: Such as here, with objects…
8
votes
3 answers

XNA - Simulated snow

This is more of a question as to request some advice on which pattern/approach I should use. I have done some investigations into this problem - with poor results. Essentially I have an idea for a game, in which the key gameplay mechanic is based…
Dave Bish
  • 19,263
  • 7
  • 46
  • 63
7
votes
4 answers

Vectors, calculate movement forces with max speed

Im building a small space shooter game. I have how ever stubbed on a math problem when it come to the space physics. Describing this with words is following: There is a max speed. So if you give full full speed you ship will move with this over the…
Jonas Lindahl
  • 752
  • 10
  • 24
7
votes
1 answer

Handling strafing / side stepping in a 3D game

I am quite new to game development and have successfully modelled a 3D terrain, and have a camera that is able to freely move around in the game world, I have however run into a snag that I am unable to figure out. Currently, to move forward /…
chrisburke.io
  • 1,497
  • 2
  • 17
  • 26
7
votes
3 answers

moving an object from point to point in a linear path

I'm trying to move a sprite across the screen in a straight line, towards on the location where've I touched the screen, what i did was upon the update() in each loop , it checks to see if the current sprite's location x y is == to the destination x…
Shizumaru18
  • 129
  • 1
  • 2
  • 8
7
votes
1 answer

Javascript multiplayer game - requestAnimationFrame for game/physics logic?

I'm developing a Javascript based multiplayer game. So far I have the basic server, client and networking ready. I did have an issue where my player was moving faster on a 120Hz screen as opposed to a 60Hz screen. I've fixed this by multiplying the…
Paul
  • 675
  • 1
  • 5
  • 26
7
votes
1 answer

How to prevent floating point error in point-polygon sliding collision detection

I'm trying to write a function to handle movement within a game I'm programming. What I have nearly works, but there are a couple situations where it breaks down. I've coded up a minimal demonstrative example, presented below. In this example, I'm…
7
votes
1 answer

Calculate Impulse/Torque for both bodies in a 3D fix joint constraint

I have 2 rigid bodies (a & b) and 1 fix joint constraint (with relative transformation rela). My objectives are to achieve :- No. 1. b.transform = a.transform * rela No. 2. Center of mass (a+b) doesn't change. No. 3. (3rd Newton rule)…
javaLover
  • 6,347
  • 2
  • 22
  • 67