game-physics

What is the best location to find tutorials on physics in game development?

♀尐吖头ヾ 提交于 2019-12-04 12:17:51
问题 I'm very new to game development (iPhone/iPad specifically, if that matters at all) and am having a tough time with working with the physics part of animation. Specifically I'm trying to give several balls (circular UIImageView or CG circles) physical properties (gravity, weight, friction, etc). Are there any really good tutorials on getting started with physics in game development? The language of the tutorial really doesn't matter as the mechanics of the physical movement really don't

Spinning a prize wheel with touchesMoved in SpriteKit

徘徊边缘 提交于 2019-12-04 10:38:45
is it possible to use applyAngularImpulse but not exponentially increase the speed of the wheel? Ideally I'd like to have the wheel follow my finger, but setting node.zRotation += atan2f(y2-y1, x2-x1) spins my wheel out of control. here's what i settled on, but it feels pretty wonky: - (void) touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { UITouch *touch = [touches anyObject]; SKNode *node = [self nodeAtPoint:location]; CGPoint positionInScene = [touch locationInNode:self]; CGPoint previousPosition = [touch previousLocationInNode:self]; [node.physicsBody applyAngularImpulse:

How to improve character control for my 3D game?

﹥>﹥吖頭↗ 提交于 2019-12-04 10:38:24
Since I changed from the helper class CharacterControl to the new BetterCharacterControl I notice some improvements such as pushing other characters is working but my main character has started sliding over steps and can't climb higher steps. I must jump the step above which is not the right way of playing, it should be just walking over. The old helper class CharacterControl had a default way of not sliding, just walking over steps and I think it can be corrected by altering the code where I create the main character. private void createNinja() { ninjaNode = (Node) assetManager .loadModel(

Moving an object at a consistent speed from point A to B

我与影子孤独终老i 提交于 2019-12-04 08:28:06
I'm attempting to create my own primitive 2D graphics based game engine. The core component of the game is firing different projectiles at enemies. I need to get this component working before I can continue working. What I have now moves my projectile along a line going through the Starting point (x, y) and the Target point (x1, x2). I make use of the linear function y = mx + b . The problem is that how I update the position of the projectile causes an inconsistent velocity depending on the slope of the line. (greater slopes cause it to move away more quickly). Here's the core structure of the

2D orbital physics

那年仲夏 提交于 2019-12-04 08:25:07
问题 I'm working on a 2D physics engine for a game. I have gravity and masses working, using a simple iterative approach (that I know I'll have to upgrade eventually); I can push the masses around manually and watch them move and it all works as I'd expect. Right now I'm trying to set up the game world in advance with a satellite in a simple circular orbit around a planet. To do this I need to calculate the initial velocity vector of the satellite given the mass of the planet and the desired

Smooth fly movement like flappy bird or jet pack joy ride with gravity and Accelaration

北战南征 提交于 2019-12-04 04:27:36
问题 I am developing a simple game in which a character fly when you tap/click the screen. keep tapping the character will fly (some what similar to flappy bird and jet pack). However the movement is not smooth at all, as of jet pack. Here is sample of my code. Varaible Initilization maxSpeedLimit = spriteHeight/10; speed = maxSpeedLimit/2; //half of the max speed touch event public void onTapOrClick(int action) { if (action == UP) { sprite.up= true; } else { sprite.up = false; } } Sprite update

how to use the libgdx contactlistener

别说谁变了你拦得住时间么 提交于 2019-12-04 03:39:00
I've just began to work with the Libgdx's Box2d Engine but i simply do not understand when the methods of the Contactlistener should be called. There is on the one hand "begin contact" and on the other "end contact". Where should i call them, to get the Number of of a certain fixture touching others? And how do I implement the Contactlistener ? A redirec' to a Tutorial would answer my Question. I didn't find anything while searching google. This one helped me a lot but it is written for C++ and does not refer to the implementation into a main-gamecircle. Thx for helping me ;) Here's a short

Bullet Physics Simplest Collision Example

蓝咒 提交于 2019-12-04 02:49:02
I'm trying to use Bullet Physics for collision detection only. I don't need it to move any objects for me or handle rendering with callbacks. I just want to update object locations every frame and use it to tell me when I have collisions. To get the simplest example going, I'm trying to find collisions between objects with btBoxShape as their shape. Everything runs fine without crashes or apparent memory leaks, but I get no collisions so I must be making some mistakes somewhere. I'll try to keep this as brief as I can without leaving anything important out. Here's my world setup function:

Calculating angular velocity after a collision

天大地大妈咪最大 提交于 2019-12-04 01:40:55
问题 I've got the linear component of collision resolution down relatively well, but I can't quite figure out how to do the same for the angular one. From what I've read, it's something like... torque = point of collision x linear velocity . (cross product) I tried to incorporate an example I found into my code but I actually don't see any rotation at all when objects collide. The other fiddle works perfectly with a rudimentary implementation of the seperating axis theorem and the angular velocity

How to fix circle and rectangle overlap in collision response?

旧街凉风 提交于 2019-12-03 21:54:27
Since in the digital world a real collision almost never happens, we will always have a situation where the "colliding" circle overlaps the rectangle. How to put back the circle in the situation where it collides perfectly with the rectangle without overlap? Suppose that the rectangle is stopped (null velocity) and axis-aligned. I would solve this problem with a posteriori approach (in two dimensions). In short I have to solve this equation for t : Where: is a number that answers to the question: how many frames ago did the collision happen perfectly? is the radius of the circle. is the center