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
7
votes
1 answer

Improve movement of space aliens

I code a mini Android game scenario inspired by Space Invaders and Moon Patrol. It is possible to shoot an alien horizontally (see above). It is also possible to shoot an alien vertically (see below). But adding aliens doesn't "scale", it will…
Niklas Rosencrantz
  • 25,640
  • 75
  • 229
  • 424
7
votes
2 answers

How to detect collision between object made of bezier curves and a circle?

So I've wrote a microbe animation. It's all cool, but I think that it would be even better, if the microbe would be able to eat diatoms, and to destroy bubbles. The issue is that the microbe is made of bezier curves. I have no idea how to check…
7
votes
2 answers

requestAnimationFrame JavaScript: Constant Frame Rate / Smooth Graphics

According to several developers (link1, link2) the proper way to have a constant frame rate with requestAnimationFrame is to adjust the "last rendered" time within the game loop as follows: function gameLoop() { …
Marc
  • 13,011
  • 11
  • 78
  • 98
7
votes
3 answers

AABB collision resolution slipping sides

So, I am currently reinventing the wheel (and learning a lot) by trying my hand at making a simple physics engine for my game engine. I have been searching the internet, trying (and failing) to fix my current problem. There are a lot of resources…
Tim Eriksen
  • 113
  • 1
  • 8
7
votes
1 answer

Detect OnTriggerExit when disabling gameobject

I am facing a very simple problem about Triggers, but I don't see any way to solve it. I just want the OnTriggerExit function to be called when an object inside the trigger gets disabled. Here is the way to reproduce the problem in an empty scene…
Hellium
  • 7,206
  • 2
  • 19
  • 49
7
votes
3 answers

Multiple instances of btDefaultMotionState, all ignored, but one

To summarize the problem(s): I have two bodies in my world so far, one being the ground, the other one being a falling box called "fallingStar". 1) I do not understand why my bullet world is not aligned with my drawn world unless I set an offset of…
user4063815
7
votes
1 answer

How to implement a physical effect in SimCity 5, that a building swings when it is being moved?

It is hard to describe in plain text, so I recorded a GIF to demonstrate. https://public.lightpic.info/image/2B1F_582465841.gif I am currently working on a project that requires such effect. Up to now I have finished a similar effect on iOS with…
Source
  • 81
  • 7
7
votes
0 answers

GKGoal Avoid Boundary Obstacles

I am seeming to have difficulty keeping my sprite nodes inside a map boundary that I have set up in the following way: I have an SKNode *enemy that moves around an SKScene by goals and behaviors courtesy of GameplayKit from iOS 9. Currently the node…
Will Von Ullrich
  • 2,129
  • 2
  • 15
  • 42
7
votes
1 answer

Swift: Set velocity for distance

I'm trying to make a moving platform on Swift and, in order to make the player move together with the platform, I needed to change the self.moveByX(), which was much simpler, to the physicsBody?.velocity (and add some friction to both platform and…
Sergio Toledo Piza
  • 793
  • 1
  • 6
  • 27
7
votes
3 answers

Calculate Torque Required To Align Two 3D Vectors with Constant Acceleration?

I'm currently building a simplified Reaction Control System for a Satellite game, and need a way to use the system to align the satellite to a given unit direction in world-space coordinates. Because this is a game simulation, I am faking the system…
Jambax
  • 151
  • 1
  • 8
7
votes
2 answers

Incorrect behaviour with SKPhysicsJointPin when shouldEnableLimits is true and lowerAngleLimit and upperAngleLimit set

I currently have a ragdoll figure, which consists of a parent node (with no physics bodies attached), and lots of child nodes which each consist of a circle body. The circles are connected to each other using an SKPhysicsJointPin between each…
Robert
  • 5,735
  • 3
  • 40
  • 53
7
votes
1 answer

Sprite Kit physicsBody.resting behavior

I am using Swift and Sprite Kit to develop a game on XCode Beta 6. In order to detect if all nodes are sleeping, i check their physicsBody.resting property. In update method i print out the result. import SpriteKit class GameScene: SKScene,…
Sifeng
  • 713
  • 9
  • 23
7
votes
2 answers

Pause SpriteKit game with Physics SKSpriteNode child

I have a SKSpriteNode with a dynamic physics body on a SKNode *_fgLayer. Now, when I pause or unpause the game I want that SKSpriteNode to remain in place and not rotate or fall down. If I simply use _fgLayer.paused = YES; the SKSpriteNode does not…
7
votes
4 answers

How to Prevent RigidBody from passing through other colliders

I've got a coin RigidBody and walls around it with box colliders. For trial purpose I've applied the following code to the coin. private void OnMouseDown() { rigidbody.AddForce(30.0f, 0f, 5.0f, ForceMode.Impulse); } But, sometimes the coin…
Ashish Beuwria
  • 975
  • 6
  • 13
  • 17
7
votes
2 answers

How to calculate the blast area of a bomb?

I'm developing a game, let's say player a put a bomb in location x=100,y=100 and the explosion radius is 100 units... It is pretty easy for me to find all the "items" in the game that were hit by the blast of the bomb (just need to check that their…
OopsUser
  • 4,642
  • 7
  • 46
  • 71