Skeleton bone in incorrect spot in game yet, blender rig, skeleton mesh and physics asset are all correct and behave properly I've made a custom character and rigged it in blender. Then exported imported into ue4. It behaves properly in the PHAT and the skeleton mesh looks fine and it all behaves properly in the simulations. In the BP and in game the physics all behave fine except 1 single bone rises above the rest and appears to quot flip quot the root bone for unknown reasons. Almost like all the sudden the root does a 180 and then one specific bone attached rises as a result, not sure if it rises and that flips the root or the root is flipping for some unknown reason. What I don't understand is why everything is fine until it is in game bp. Maybe I'm misunderstanding how physics work with skeleton mesh? I've been banging my head on the wall trying to figure out phat, skeletons and how physics work in ue4 for about a month now and there is basically 0 docs tutorials on this. As much as I love being stuck on this problem forever if anyone has an idea on what is going wrong that'd be great.


How often should I calculate the position of a bullet? In game's like Battlefield or Arma, how many times per second is the position of a bullet calculated?


How can I easily implement swinging in a platformer game? I'm developing a game in which player can use ropes to swing (just like what Spiderman or Bionic Commando did) and I'm having problem implementing this behavior. Can anyone help me how to do this, I mean physics formulas and etc. Till now I've come up with 3 ideas. One is using spring, but it consumes a lot of time and sometimes it is jumpy. The other two are trying to calculate next step (one via calculating potential energy and one via calculating torque) and both of them almost crash whenever the actor is trying to swing. Here is the code I wrote to calculate torque float dx Runner gt getPosition().x ancher.x float dy Runner gt getPosition().y ancher.y float t0 atan2(dy,dx) my current angle float k ((dy) vx (dx) vy) (dx dx dy dy) previus angular velocity k gravity cos(t0) dt new angular velocity (gravity is positive) t0 k dt acc cos(t0) dt dt 2 rotate the rope float dx1 r0 cos(t0) new position (r0 is rope length) float dy1 r0 sin(t0) vx (dx1 dx) dt calculate velocity vy (dy1 dy) dt


Should the bullet trajectory calculated by server or by client? In a FPS game like Battlefield or Arma, when playing online, should the bullet trajectory be calculated by the server or by the client?


Can someone explain Flappy Bird's physics to me? I am having a difficult time trying to understand the Flappy Bird physics. I know it seems simple but I kind of suck at math. I am trying to see if I can make a simple game like this but it is just the dang physics that are throwing me off. I have something like gravity effecting the bird but when you click the screen and I add some amount to the y position but it doesn't look good. You guys have any ideas? Stuff like velocity 9.8 Gdx.graphics.getDeltaTime() position.y 0.5 velocity That is falling but when I tap the device I would like to know how to add upward force but when it loses it continue falling.


Godot How do I get the id mask for a physics layer by name? I would like to figure out whether a collider is in a physics layer by the name (string) I set in project settings func physics process(delta) var collision move and collide(direction delta speed) if collision and (collision.collider.collision layer amp get collision layer("Walls")) ! 0 direction direction.bounce(Vector2.LEFT) more behaviors based on other layer tests Walls is the name of the physics layer and I am trying to find get collision layer. I am using Godot 3.2.1. self is a KinematicBody2D amp colliders are StaticBody2D's amp also KinematicBody2D's. I have figured out the collision id (as an int) but still think it would be cleaner to use layer names, preferably using a built in function.


What does maximum normalized frictional force mean in this tutorial? I tried following this tutorial https nccastaff.bournemouth.ac.uk jmacey MastersProjects MSc12 Srisuchat Thesis.pdf, but in page 19 I ran onto a problem I don't understand the step 4. It is also not explained before. Could somebody explain what is it and what values may be used?


Simple physics for modelling ship submarine movement for a first iteration of my sim, I need a very basic physics model for ship submarine movement. I'd guess it might be a good approach to use vectors here (ship heading but also considering sea states etc.). Basic acceleration and that stuff should be taken into account I do not need any 3D stuff...the 'client' for that 'ship movement' physics is only the 2D rendering of a navigation map. I've found some papers on the net but they are far too complex for my needs. Anybody does know some 'simplified' vector algorithms etc. for that? Thanks a lot. EDIT To be clear I do not want to simulate ship movement ocean physics in detail, because this is not the focus of my (naval) simulation. It 'just' must be somewhat believable in that sense that if you have different sea states(wind waves currents) that the vessel is somewhat believable influenced (on the navigation map) by those forces. The main issue for me is how I model calculate those forces (wind etc.) by simple vectors and (eg. for a given wind velocity like 50kn) in an easy way withouth studying physics ).


Physics engine recommendation which can simulate pool game correctly? I'm making a pool game like game. This game requires correct (or very accurate) reflective bounces. I tried Box2D and Bullet Physics, but they both have this problem. If there is a wall on top of this image, red line is expected course of a real ball in a pool game. But the engines often shows green line course. Especially, This happens after a slowly moving ball hits the wall. Sometimes a rapidly moving ball get slower suddenly. I'm finding a physics engine which can simulate pool game accurately as much as possible without these problems. Can I get some recommendations? Now I'm digging Newton Game Dynamics, but I am not sure the engine will show what I want. I'm considering the PhysX engine as a next trial, and have to make my own if nothing works. But it's obvious it'll take very long time, so I wish I won't do that. I'll be very appreciated if you save my time. And of course, solution with Box2D Bullet Physics are also welcomed. I am working with C C Objective C on iOS. I attach my configuration with Box2D. Walls static box shape linear angular damping 0.1 restitution 1.0 friction 100 density 10 bullet false fixed rotation false inertial scale 1.0 Balls dynamic sphere shape linear angular damping 0.1 restitution 1.0 friction 100 density 20 bullet true fixed rotation false inertial scale 1.0


What physics engine support force fields and bodies represented as points? I need a game engine that supports force fields in 2d or 3d, but suitable for 2d calculations, like bullet. Each body I want to simulate is represented as a set of points. Each point has positive mass and can accept force. Force field is updated every tick. Engine should accept force applied to every point and return point speed values and coordinates. Each body made of particles should move as a whole thing in result, relative position of particles must persist, hence this is a rigid body. If engine does not support setting body as a set of points it should allow setting density function, or some other means to let have non uniform density. Is there any that can do that, preferably cross platform.


Fixed timestep without physics? I read Gaffer's Fix Your Timestep article many years ago, and have since had the impression that game code should have a fixed timestep, with only non gameplay related tasks outside of that in the main loop. However, I recently reread the article, along with several others, and realized the emphasis is on physics. Which makes sense, but now I'm wondering if it only applies to physics. What about games which don't use a real physics simulation? People talk about 60fps games, doesn't that imply a fixed timestep? What about multiplayer where you have regular updates to and from the server? The only alternative I know of is variable rate with time delta, but that sounds like it wouldn't be any better, and less exact. What method is typically used?


How to bounce a 2d point particle off of a circular edge In a prototype I'm building, a particle can spawn anywhere within a larger, confining circle. Important to note is that the particle will not spawn in the origin of the larger circle, but anywhere within it. This particle will essentially be given a random x and y velocity and set on it's way. When the particle hits the edge of the confining circle, I want it to bounce back inwards appropriately. Unfortunately I'm extremely new to vector math, and have never really directly dealt with it before. Given that I'm treating the particle as a point, and I don't care about any loss of force or friction, what should I ultimately do to the particle's x and y velocities after the bounce? I will know the particle's x and y velocity, it's x and y coordinate when it hits the outer circle, the radius of the outer circle, and the x and y coordinates of the origin of the outer circle (since its origin will likely not be 0,0). My brief research on vector math tells me I need to find the normal velocity at the point where the particle hits the outer circle and then negate that, but unfortunately I'm not sure how to do that exactly.


Roguelike movement system I'm trying to implement a roguelike movement system for my game. I'm using the ECS architecture. The requirements are entities will have a mass, on which should slow down the entity movement accordingly. fatty ones move slower there will have different terrains, that should apply different friction types, eg ice will decelerate the entity slower a quicksand will almost stop the entity immediately and so on. optionally there will have different weathers that should also impact on the entity movement, eg sandstorm would push the entity to it's direction rains will diminish the friction coefficient a little bit etc... If the two first requirements are solved, the third will probably be as well, I think. How would you do this?


Altering Animation Playback Given Terrain Information Say my character has a jog animation. Assuming Y is vertical, his feet leave the ground at Y 0 and hit the ground again at Y 0. This works fine in a world like that of Minecraft, where every surface the player could traverse is flat. Now say the character is jogging through hilly terrain. Without any transformations, the animation would break through the ground at certain points. (As the character's foot is lifted and moved forwards, it would go straight through the hill.) How do I remove this artifact? Do I ask the artists to create separate animations depending on the grade of the terrain? Is there a standard system to resolve animation world collisions that I'm unfamiliar with? Or is there another more logical approach I haven't thought of yet?


How can I avoid type checking in the physics side of collision handling? I have a class responsible for handling the physics side of collisions. When the collision detector spots a collision, it notifies both entities in the collision to take care of gameplay. It also notifies the PhysicsGenerator to take car of the physics of the collision. I don't know if it's possible to avoid type checking in the handleCollision() method of PhysicsGenerator. What I wanted to do is apply a force on both entities in the collision to push them backwards. But I can only do this if they are MovingEntities. What if one of them is a StaticEntity? In this case it should be treated differently. I don't know how I can do that without using instanceof quite a lot. How is this usually handled?


Physics based rotation with an array of pixels Say I have a simple system, that has a large array of pixels with their own weight, velocity, coordinates etc. (by using classes) if each of those pixels can be connected to 4 other pixels (top, bottom, left, right) how could I let that object rotate, according to physics. An example of this is where I might have an array of pixels that makes a circle, and a slope, if I put the circle at the top of the slope, how would I compute the circle rotating while going down the slope?


Adding physics to a Blueprint actor in UE4 I am trying to create a dice in ue4 and be able to read off what value it gives. I've made a mesh in Blender and created a texture, imported them and created a blueprint actor and added the static mesh to it. When I start the game the dice just floats in the air and isn't affected by gravity. I have tried just using the static mesh and I can get that to be affected by gravity. However, I need to add scripts to the object so I can give it a random rotation and read its value, so I created a blueprint actor. I've looked online for a way to give this actor physics, nut nothing. Does anyone know how I can add physics to a blueprint actor? Also if anyone has any info on giving the actor a random rotation and reading the value of the dice that would be great.


finding the angle to launch a projectile at a 3d coordinates I have a game where the user can shoot a bullet and the bullet flies through 3 dimensional space and eventually hits the ground somewhere. My question is how can I calculate the pitch of the angle to make the bullet hit a specific coordinates with possibly different elevations. My known factors are The gravity force The initial projectile velocity The shooting position The target position In my case I do not need to factor for target movement, I am trying to make something similar to an artillery weapon that fires into the sky and have the bullet land somewhere else at a target. Because I am trying to make an 'artillery like' weapon I need the weapon to aim up at the sky, not directly at the target.


Tracking Object Position Firing on a Trajectory How can I calculate the position of an object after "firing" it from a fixed point? I am to create a small game most likely with canvas (pure HTML, JS based) or Adobe Flash in which the player fires objects at other obstacles in order to clear them.


Constant orbit using Rigidbody in Unity I'm trying to make a few game objects (moons) orbit a planet in unity. Basically just picture a planet in the center of the screen, and a few small moons that orbit the planet with a constant velocity. I have gotten this to work nicely using transform.RotateAround(), but I wanted to take advantage of the physics engine that unity provides for realistic "bouncing" of the game objects relative to others as they collide. I have tried a few things such as Hinge Joints, Configurable Joints, and even just adding forces to try to get it to move in a spherical manner. I can't seem to get it to work correctly though. The configurable joint is the closest that I've come, but it's a bit off and it doesn't stay orbiting. It's likely my lack of knowledge with using rigidbodies in 3d, but I figured someone out there could help get me on the right track. Thanks in advance for any help!


Should I be sharing data between graphics and physics engine in the game? I'm writing the game engine that consists of few modules. Two of them are the graphics engine and the physics engine. I wonder if it's a good solution to share data between them? Two ways (sharing or not) looks like that Without sharing data GraphicsModel some common for graphics and physics data like position some only graphic data like textures and detailed model's verticles that physics doesn't need PhysicsModel some common for graphics and physics data like position some only physics data usually my physics data contains A LOT more informations than graphics data engine3D gt createModel3D(...) physicsEngine gt createModel3D(...) connect graphics and physics data e.g. update graphics model's position when physics model's position will change I see two main problems A lot of redundant data (like two positions for both physics and graphics data) Problem with updating data (I have to manually update graphics data when physics data changes) With sharing data Model some common for graphics and physics data like position GraphicModel public Model some only graphics data like textures and detailed model's verticles that physics doesn't need PhysicsModel public Model some only physics data usually my physics data contains A LOT more informations than graphics data model engine3D gt createModel3D(...) physicsEngine gt assingModel3D( amp model) will cast to PhysicsModel for it's purposes?? when physics changes anything (like position) in model (which it treats like PhysicsModel), the position for graphics data will change as well (because it's the same model) Problems here physicsEngine cannot create new objects, just "assing" existing ones from engine3D (somehow it looks more anti independent for me) Casting data in assingModel3D function physicsEngine and graphicsEngine must be careful they cannot delete data when they don't need them (because second one may need it). But it's rare situation. Moreover, they can just delete the pointer, not the object. Or we can assume that graphicsEngine will delete objects, physicsEngine just pointers to them. Which way is better? Which will produce more problems in the future? I like the second solution more, but I wonder why most graphics and physics engines prefer the first one (maybe because they normally make only graphics or only physics engine and somebody else connect them in the game?). Have they any more hidden pros amp contras?


How do I combine multiple squares into one Tetris block? I am learning Phaser by making a simple game mdash Tetris. I'm having difficulties Can I use simple rectangles as tetrominoes or they should be sprites? I don't know how make the figure's block from simple rectangles and apply physics to it. How I can join 4 separate squares into one tetromino?


Physics for movement in a topdown 2d game? I'm implementing player movement for a simple topdown game, how would I handle more "advanced" concepts in physics to make my player movement feel more natural? Right now I have something like this void update(double delta) dx dy 0 if (left) dx 1 if (right) dx 1 if (up) dy 1 if (down) dy 1 if (dx ! 0 dy ! 0) x dx delta y dy delta How would I go about implementing things like friction, acceleration, drag, and so on?


How to make an object oscillate left and right? I can't seem to make an object move left and right, back and forth, on room start whilst on solid ground. Codes I used Step Event if image index is greater than 5, then physics apply force (0,0,100,0) for the right if image index is less than 5, then physics apply force (0,0, 100,0) for the left


I'm looking for a paper from Teknikus.dk I'm looking for this great paper about Verlet integration http www.teknikus.dk tj gdc2001.htm I've found this link on many websites, forums, blogs, everyone is recommending it ! The website is down for more than one week.


(Fat) ray cast with MPR OR GJK? I know that it's possible to see if a line segment or a swept shape (to make a "fat" line segment) intersects objects using MPR and GJK. Is it possible in those situations to find out the distance down the ray cast that the collision occurred? Thanks!!


Will my game engine be compatible with physics engines? My engine supports scene handling, cameras, and has a renderer. Also, it has a class called Drawable, which has the position, the shape and the picture of an object. The picture property has width, height, rotation and a draw method. All game objects are supposed to inherit from this Drawable class, and are added to the scene, along with a map (a collection of Tiles, that also inherit from Drawable), lights, and so on and so forth. The shape property of a Drawable is a Polygon, a collection of user defined vertices around the position of a Drawable. This is a relative coordinate system, so 0, 0 is the position of the Drawable. With this setup, will the users of my engine (which will probably only be me) still be able to integrate physics engines such as Box2DJS into their games?


How do I handle moving platforms in a platform game? I don't want to use box2d or anything, I just want simple moving platforms (up down, left right, diagonal and circular paths). My question is to handle the update order control hierarchy so that the player stays fixed to the platform solidly, without bouncing or wobbling?


How to implement a slight skid in a car game I have a top down car game, where I'm trying to allow a slight skid I've tried the following code to calculate the X and Y, but there is no skid whatsoever radians rotation Math.PI 180 aX (momentum Math.cos(radians)) aY (momentum Math.sin(radians)) newX playerX aX, newY playerY aY I can get skid by introducing a velocity variable for example radians rotation Math.PI 180 aX (momentum Math.cos(radians)) aY (momentum Math.sin(radians)) velocityX velocityX aX velocityY velocityY aY newX playerX velocityX newY playerY velocityY This introduces far too much skid, like the car is on ice. I've tried reducing the amount I increase the velocity by velocityX velocityX (aX 3) Which sort of works initially, but still ends up ice skating and uncontrollable after playing around for a few minutes. Are there any techniques for introducing a slight skid without this extreme side effect?


How to collapse a structure after procedural destruction When considering this temple structure with procedural damage in pink How can I efficiently determine the collapse of such structure as below? Even if the model is defined on a voxel grid, it would still require possibly wide ranging searches for connected ness? In the 2D case, flood filling and labeling disconnected components is probably doable, but what about the 3D case? Can this be done without traversing the entire world space, every frame which I imagine, wrecks havoc to a data cache? Lastly, what is the technical term for this problem of "making stuff fall down after procedural damage?"


Problem with calculating velocity for a car with multiple gear ratios I hope this is the right place for this but I have a problem with calculating velocity for my car game. The higher the gear, and therefore lower the gear ratio, the lower the top speed. Given that Acceleration Forward Force Drag Rolling Resistance Velocity Acceleration dt and Wheel Torque Engine torque Gearbox ratio Differential ratio Forward Force Wheel Torque Wheel Radius I feel like I am missing something because if we decrease the gear ratio we decrease the torque and therefore the forward force causing lower acceleration so the car cannot gain additional velocity, and actually loses it due to resistive forces.


How to avoid ai hands or any body part going inside wall or ground? (Unreal Engine4) Whenever my character get killed near wall his hands or any body part its goes through the wall making it look like half of the hands front of wall and another half through back. but i dont like it.. i want it look like modern game where if i killed him near wall it should be realistic where his body part should change posistion according to it. like lifiting his hand because he cant put his hands through wall and also i made a little mistake in my death animation making the hands below the ground so whenever he get killed his hands go through ground.. so how to make this work?


A ball hits the corner slightly, where will it deflect? I am currently making an iOS Game but I have a small problem. The game is simply a ball which you can control to avoid obstacles and find the food. When the ball hits, e.g. the top or the bottom of an obstacle, it's easy, the y speed is just inverted. Same with left and right, where the x speed is inverted. But what happens when the mass point of the ball doesn't touch a side of the obstacle, but its surface is? Where will it be deflected? What's the maths behind that? Here's an image to illustrate the problem Thanks in advance for help!


Predicting physics trajectory for pool billiards games I'm thinking of making a quick proof of concept of a billiard style game mechanic, where the player has perfect information of what is about to happen. Here's a good example I'm only mildly familiar with physics in both Unity and Flixel Box2D, and I can't really off the top of my head imagine how to do this. Should I even use physics at all, or should I just use basic math?


Clothing and physics asset collisions not working I quot m making a character in Blender where there's a character mesh and a simple skirt. The skirt has a different material slot, which allows me to use the Unreal Clothing tool. I created the clothing data, applied it, painted it so the top part isn't moving at all and bottom has 100 quot dynamics quot . I also created a physics asset, however no matter what settings I try, the skirt will always poke through the thighs like they don't exist. All the colliders are capsules. I also get the feeling that the hip collider actually works. But only that one! The skirt works perfectly with the wind, which makes it even weirder. Does anyone know what can cause this?


Which Box2D like physics engine parameters need pixel conversion? The official guide does not have any useful details on the matter http www.box2d.org manual.html Position is an obvious one. What about velocity? Density? Anything else? Update the context is wrapping interfacing a physics engine to make it more usable. E.g. units of measure in the game editor should be consistent.


how to ignore physics collision of some objects in box2d I know this sounds silly but I would like some objects to follow physics while others not to collide each other. I tried to achieve them by setting their position exclusively. But then it will ignore all physics. Is what I am trying to do even possible?


Understanding Tensors I don't seem to be able to visualize tensors. I am reading The Morgan Kauffman Game Physics Engine Development and he uses tensors to represent aerodynamics but he doesn't explain them so I am not really able to visualize them.


Should I be sharing data between graphics and physics engine in the game? I'm writing the game engine that consists of few modules. Two of them are the graphics engine and the physics engine. I wonder if it's a good solution to share data between them? Two ways (sharing or not) looks like that Without sharing data GraphicsModel some common for graphics and physics data like position some only graphic data like textures and detailed model's verticles that physics doesn't need PhysicsModel some common for graphics and physics data like position some only physics data usually my physics data contains A LOT more informations than graphics data engine3D gt createModel3D(...) physicsEngine gt createModel3D(...) connect graphics and physics data e.g. update graphics model's position when physics model's position will change I see two main problems A lot of redundant data (like two positions for both physics and graphics data) Problem with updating data (I have to manually update graphics data when physics data changes) With sharing data Model some common for graphics and physics data like position GraphicModel public Model some only graphics data like textures and detailed model's verticles that physics doesn't need PhysicsModel public Model some only physics data usually my physics data contains A LOT more informations than graphics data model engine3D gt createModel3D(...) physicsEngine gt assingModel3D( amp model) will cast to PhysicsModel for it's purposes?? when physics changes anything (like position) in model (which it treats like PhysicsModel), the position for graphics data will change as well (because it's the same model) Problems here physicsEngine cannot create new objects, just "assing" existing ones from engine3D (somehow it looks more anti independent for me) Casting data in assingModel3D function physicsEngine and graphicsEngine must be careful they cannot delete data when they don't need them (because second one may need it). But it's rare situation. Moreover, they can just delete the pointer, not the object. Or we can assume that graphicsEngine will delete objects, physicsEngine just pointers to them. Which way is better? Which will produce more problems in the future? I like the second solution more, but I wonder why most graphics and physics engines prefer the first one (maybe because they normally make only graphics or only physics engine and somebody else connect them in the game?). Have they any more hidden pros amp contras?


How do I implement deceleration for the player character? Using delta time with addition and subtraction is easy. player.speed 100 dt However, multiplication and division complicate things a bit. For example, let's say I want the player to double his speed every second. player.speed player.speed 2 dt I can't do this because it'll slow down the player (unless delta time is really high). Division is the same way, except it'll speed things way up. How can I handle multiplication and division with delta time? Edit it looks like my question has confused everyone. I really just wanted to be able to implement deceleration without this horrible mass of code else if speed gt 0 then speed speed 20 dt if speed lt 0 then speed 0 end end if speed lt 0 then speed speed 20 dt if speed gt 0 then speed 0 end end end Because that's way bigger than it needs to be. So far a better solution seems to be speed speed speed whatever number dt


2D Motocross physics I'm looking into making a 2D motocross bike game with plausible physics. It should look like this For a first try, I've created only the player (a motocross driver) and the map (consisting of only straight lines no curves, to keep it simple). How should collisions between the motocross bike and the track affect the bike's position and velocity? The bike should rotate if only one of the wheels touches the ground and speed up if the back wheel touches the ground. Pretty standard bike game stuff. How do I achieve this behaviour?


how to calculate initial Y velocity required to reach target? I am trying to calculate the y velocity necessary for my player character to jump up and reach a y position within 1 second. Given that my game engine is at 60fps, I am doing velY (targetY playerY) 60 .. However, I need to account for gravity which is being applied to the character on every update, so I am doing velY ((targetY playerY) 60) (gravity 60) This results in the player character always jumping significantly higher than expect. UPDATE Attempting to try the Equations of Motion approach, I am setting a timestamp when the player character should begin moving to the target position... So then in my update loop, I am calling a function with currentTime timestamp. update function(paceFactor) paceFactor in this game engine is how many nominal 60FPS game ticks have elapsed. So if the game is running at 30FPS, then paceFactor will be 2.0, if it's 60FPS, then 1.0 will be passed in. this.timer paceFactor (1 60) if (this.setVelocityAt) this.setVelocityFor(this.timer this.setVelocityAt, this.targetPoint) this.position.x this.vel.x this.speed paceFactor this.position.y this.vel.y this.speed paceFactor this.position.y (gravity (paceFactor paceFactor) 0.5) this.vel.y gravity paceFactor , setVelocityFor function(time, target) if (time gt 1) time 1 this.setVelocityAt undefined this.character.vel.x (target.x this.character.position.x) time this.character.vel.y (target.y (0.5 GRAVITY time time) this.character.position.y) time , Then later the position and gravity is applied to the character as described in the previous update. However, the velocity being set is a huge number which is... wrong.


How to move 2D objects based on mouse movement with pointer locking? I'm using pointer locking for a 2D game (where you perform calculations based on the delta in mouse positions from frame to frame). I'm having some basic math logic issues with accomplishing what I want. I'd like the player to be able to send the character in the direction they last moved their mouse (so if they stop moving the mouse, the character continues to travel in the direction they last moved in). The issue I'm experiencing is the movementx and movementy values are integers. If the player moves the mouse quickly so that from one mousemove event to the next many pixels are traversed, the direction to move the character is reasonably precise. Every other scenario results in the last movement having movementx or movementy only being 1 0 1. If the character only moves based on the last movement of the mouse, it very often only moves in one of 8 directions. How can I be more precise than 8 directions even on slow short mouse movements while ensuring the last bit of movement of the mouse is always what's being used? My first thought was to average out the last n movement values, but that can easily result in the character not always moving in the direction the mouse moved last. I've not really had too many other thoughts though, so I came here for assistance.


How can I model the physics of an air blower? I want to model simple lottery machine, it has got a bottom blower. Do you know how can I get force applied to object above blower by air from blower, or equations to model this behavior? Red arrow is blower "wind"


Steer a flock towards a target? Like in pikmin? Can a flock be steered towards a target ? I've seen that flocking behavior has the alignement behavior, but can it be directed and steered toward a goal ? http www.youtube.com watch?feature player detailpage amp v BKJyv4uqsWI t 305


How to implement deceleration and stopping over a certain distance So I have a a character, say a spaceship. It needs to move distance R, and in direction T (Theta). So say if The object is at (0,0), and it needs to get to (4,3), it has R 5 and T about 36 degrees. Essentially I know where the endpoint is, and the distance away. I want my spaceship to start decelerating when R becomes 8, and the object come to a halt when it reaches the location. How can I do this. (Kinematics in answers is welcome)


game physics contact constraint and relative velocity For two rigidbodies (2D boxes), A and B, I have been colliding A with B and finding the collision normal pointing towards A i.e. the direction that would separate A from B. When it comes to calculating the relative velocity for the contact constraint, does it matter which body has the edge that the collision normal is perpendicular in terms of which velocity to subtract from which?


Colliders for moving inside a spaceship when the whole spaceship is made of a single mesh (in Unity) I've begun to study a unity engine in one purpose I have a great multi player game idea! The main essence In space there are two (or even more) huge spaceships with crew consisted of players (all real humans). Ships are very powerful dreadnoughts with a lot of features (radar system, many weapons, missals, refinery factory, gravity generator, indoor light system, shields generators, engines and so on), but all systems are broken at the beginning of the game. Crew should decide, which systems are more important in battle and repair it. They should extract materials from asteroids and revive their spaceship. Then, they should locate second ship, and try to destroy it. Whose spaceship will be in a whole skin during one minute after destroying another, will be the winners. If there are more then two spaceships, surviving crew from destroyed ship can move to another alive ship. I've already draw detailed 3d model of spaceship, but I faced with a problem during importing model to unity. The problem with mesh collider. Players should get into a ship and walking in it, HOW can I do that? I can't use non convex mesh collider in unity 5, and I cannot put one collider to another. It would solve the problem, if I draw ship piece by piece, but not as entire. But ship is really complex, to assembly it from prepared parts take really long time and ship will be messily. Is there another way to solve my problem?


How do I set an object's speed to arrive in X seconds? I want to move an object to a point in the game world, I have the distance value which is far the player should move. I want to complete the movement in X seconds. I have tried many equations and formulas to no success. Speed Distance Time This one doesn't seem to give me the right result. Thing is the game is updated 60 times a second and the movement is affected by delta time. I'm pretty sure I am not taking the framerate in consideration. What am I doing wrong? Edit This is how I calculate the speed int dst 500 int time 2 in seconds float speed dst time Doing it this way is making the movement instant and the game object is not traveling the distance in 2 seconds. Every frame each game objects gets updated this way p.x dir.x speed deltaTime p.y dir.y speed deltaTime The dir vector holds the direction of movement which is calculated on mouse click Vector2 dir new Vector2(mouseX, mouseY).subtract(objectX, objectY).normalize() Delta time calculation long time System.nanoTime() float deltaTime (time lastTime) 1000000000.0f lastTime time Please note The game object stops upon arrival.


Specific path for ai for follow I have an entity's following details x, y vx, vy angle to x axis its target I want to reach the target by a parabolic path, how to implement an ai that follow a particular path from any given point to another like parabolic or sine wave.


Should I used Box2D for a Flash platformer or use something for gaming like Fixel or Flashpunk? I'm trying to make a platformer with Flash AS3 and have been looking for something to help with some of the collision etc. I've look at a few engines and Box2D WCK seems the most sophisticated. Do I need that level of sophistication or should I just stick to something simple like Fixel or Flashpunk? OR should I just do everything myself?


What is closing and separating velocity in Ian Millington's game physics book? I'm working on a physics engine in C and chose Ian Millington's Physics Engine Development book as a guide and reference to help me out understand physics concepts and how to implement them. Yesterday I was reading through the Hard Constraints chapter, particularly the simple collision resolution section and came across an explanation of a physics formula that I couldn't fully comprehend. Millington says quot The closing velocity is the total speed at which two objects are moving together quot and it is calculated with the following formula V c dot P a cdot( widehat P b P a ) dot P b cdot( widehat P a P b ) Where V c is the closing velocity, P a and P b are object a and b respectively. Also he further discusses another formula called the separating velocity which is written as follows V s ( dot P a dot P b) cdot( widehat P a P b ) Where V s is the separating velocity. Now I don't really understand what these formulas actually are or what they represent in the physics world. I also have trouble wrapping my head around why we need these formulas to perform collision resolution since he used the separating velocity formula to resolve the velocity upon collision and why we need the dot product. It would be really helpful if someone can provide visual explanation that would significantly help me understand what's going on.


Lunar lander why is my descent module crashing I've been reading this awesome simulation of the actual Apollo 17 descent http www.braeunig.us apollo LM descent.htm I've been trying to make my own simulation using Euler integration, with a time step of 100ms. The problem is my descent module is crashing during the first two minutes with a vertical speed of 220 m s. During the initial stage of the descent (braking), the lander is tilted 90 and almost all the thrust is spent in the horizontal component, with no force to counter gravity. In my simulation the vertical speed quickly builds up while the pitch is 80 90 , and then gravity does it job. Here's a trace t 0 s x 0 y 17234.6112 vx 1697.1264 m s vy 20.4216 m s ax 1.2995855485404475 m s2 ay 1.6121564579144938 m s2 pitch 90 throttle 0.1297 fuel 8874.2Kg t 10.015 s x 17062.974621379497 y 16948.14950433809 vx 1710.2669538608811 m s vy 36.64853435841286 m s ax 1.3247309786564347 m s2 ay 1.628484797082333 m s2 pitch 90 throttle 0.1297 fuel 8855.501190599978Kg t 20.019 s x 34239.89169813059 y 16498.912567960208 vx 1723.6514116543285 m s vy 53.026163503416676 m s ax 1.3509707026458686 m s2 ay 1.6456786784409965 m s2 pitch 90 throttle 0.1297 fuel 8836.82291908347Kg t 30.026 s x 51527.03405575163 y 15884.74450896862 vx 1725.5675762461628 m s vy 69.5834660661016 m s ax 0.9584923539027193 m s2 ay 1.663174744204344 m s2 pitch 90 throttle 1 fuel 8756.011226046036Kg t 40.041 s x 68759.3217349438 y 15103.315677459259 vx 1715.7571868391299 m s vy 86.32821281208818 m s ax 1.0003892381595199 m s2 ay 1.6806337716945954 m s2 pitch 90 throttle 1 fuel 8611.841531365935Kg t 50.502 s x 86651.75776002374 y 14107.047450672597 vx 1705.0564069549016 m s vy 104.00697912916615 m s ax 1.0452064683102156 m s2 ay 1.6991809596193168 m s2 pitch 90 throttle 1 fuel 8461.251498809865Kg t 134.865 s x 226365.92349700694 y 5.915270639694082 vx 1602.384872970266 m s vy 225.9485740506923 m s ax 1.382111636427434 m s2 ay 1.224439728661491 m s2 pitch 78 throttle 1 fuel 7246.814359289593Kg FINISHED at t 2.24775 minutes However, in the original simulation, vertical speed never exceeds 20 m s. I don't know how could this be possible, as there's no drag due to atmosphere. And I've coded initial acceleration and velocity values exactly as in this very same page. You can check the original trace here http www.braeunig.us apollo LM descent.pdf Here we can see the Moon's gravity is aprox. 1.5 m s which heavily influences ay in my simulation. However in the real descent trace it was kept to lower values ( 0.1) most of the time, even during the first minute when there was no vertical thrust due to the engine. I must be making very stupid mistakes but right now I can't see where. BTW this is how I update my vars in each step Calculate acceleration as a function of mass, velocity, thrust and gravity ax vx vx (y MOON MEAN RADIUS M) (thrust x mass) ay (vx vy (y MOON MEAN RADIUS M)) g (thrust y mass) This would be the acceleration for a flat moon. Don't work either. ax thrust x mass ay g (thrust y mass) Update velocity as a function of acceleration and time. vx vx ax dtSecs vy vy ay dtSecs Update position x x vx dtSecs y y vy dtSecs Any hint would be appreciated. Thanks in advance.


Constant orbit using Rigidbody in Unity I'm trying to make a few game objects (moons) orbit a planet in unity. Basically just picture a planet in the center of the screen, and a few small moons that orbit the planet with a constant velocity. I have gotten this to work nicely using transform.RotateAround(), but I wanted to take advantage of the physics engine that unity provides for realistic "bouncing" of the game objects relative to others as they collide. I have tried a few things such as Hinge Joints, Configurable Joints, and even just adding forces to try to get it to move in a spherical manner. I can't seem to get it to work correctly though. The configurable joint is the closest that I've come, but it's a bit off and it doesn't stay orbiting. It's likely my lack of knowledge with using rigidbodies in 3d, but I figured someone out there could help get me on the right track. Thanks in advance for any help!


Numerical stability in continuous physics simulation Pretty much all of the game development I have been involved with runs afoul of simulating a physical world in discrete time steps. This is of course very simple, but hardly elegant (not to mention mathematically inaccurate). It also has severe disadvantages when large values are involved (either very large speeds, or very large time intervals). I'm trying to make a continuous physics simulation, just for learning, which goes like this time get time() while true do new time get time() update world(new time time) render() time new time end And update world() is a continuous physical simulation. Meaning that for example, for an accelerated object, instead of doing object.x object.x object.vx timestep object.vx object.vx object.ax timestep timestep is fixed I'm doing something like object.x object.x object.vx deltatime object.ax ((deltatime 2) 2) object.vx object.vx object.ax deltatime However, I'm having a hard time with the numerical stability of my solutions, especially for very large time intervals (think of simulating a physical world for hundreds of thousands of virtual years). Depending on the framerate, I get wildly different solutions. How can I improve the numerical stability of my continuous physical simulations?


3D Physics in Marmalade SDK I am trying to make an 3d game in Marmalade. I am completely new to Marmalade. How to add 3d physics, gravity, dynamic object, sensors, colliders in Marmalade. I was going through the API and did not find anything. Can you guys let me know how to accomplish these things


Confused about calculation of steering force I'm reading Programming Game AI by Example, by Mat Buckland. What I don't understand there is why the individual behaviors return a vector representing change in velocity, but the combined result is treated as a force vector. Here's the excerpt from the update function Vector2D SteeringForce m pSteering gt Calculate() Acceleration Force Mass Vector2D acceleration SteeringForce m dMass update velocity m vVelocity acceleration time elapsed make sure vehicle does not exceed maximum velocity m vVelocity.Truncate(m dMaxSpeed) update the position m vPos m vVelocity time elapsed And m pSteering gt Calculate() returns the weighted sum of different steering "forces", like Seek Vector2D SteeringBehavior Seek(Vector2D TargetPos) Vector2D DesiredVelocity Vec2DNormalize(TargetPos m pVehicle gt Pos()) m pVehicle gt MaxSpeed() return (DesiredVelocity m pVehicle gt Velocity()) So, how come steering functions like Seek just return change in velocity and don't take mass into account, but still get used as force? Here's the source code


Car movement in arcade racing game I am finishing a very basic 2D racing game with top down perspective. I can't get the appropriate formulas to make the movement of the cars fun and addictive... Do you have tips on how to achieve that arcade feeling a lot of games have? Do you know of any guide tutorial on this topic? Right now, these are the formulas I am using (speed changes linearly according to the user input) direction turnAmount.Value Vector3 pos Position new Vector3(speed.Value (float)Math.Cos(direction), 0, speed.Value (float)Math.Sin(direction)) I have tested other, more complex options but this is the best I have got so far...


How can I recreate the movement of arrow in air? Given two Particles A and B which forms the arrow itself, A.P an edge of it and the opposite one B.P. Like so A.P B.P. const float DistArrow 60 Where I have structure Particle struct Particle struct Complex P Position struct Complex F Gravitational Force struct Complex V Velocity float m Mass At the start each particle, A and B has a starting Velocity of like (40, 70). And I am adding a value of force to A.F(0, 9.21) and B.F(0, 9.81). So that the B.F has much more weight on it, so it drags the A to down kind of. I want the arrow to move like this And I am tried to figure out how to make till I was stuck with this(I am trying to calibrate in a way the arrow to the initial DistArrow A erA gt B (D(AB) DistArrow) 2 A where erA gt B(unit vector) (B A)D(AB) B erB gt A (D(AB) DistArrow) 2 A where erB gt A(unit vector) (A B)D(AB) The problem is that it just rotates 180 degree, dunno why it does, if it will infinitely fall it should be A at the top of B, a line perpendicular with oX. I am seeking a good solution not involving to much physics, any advice will be highly appreciated.


What are the parameters for btHingeConstraint setLimit? What does each parameter in btHingeConstraint setLimit do to the hinge constraint? void btHingeConstraint setLimit ( btScalar low, btScalar high, btScalar softness 0.9f, btScalar biasFactor 0.3f, btScalar relaxationFactor 1.0f )


When and how should I apply forces in a Cocos2D Box2D game? I have some small circles just rolling across the bottom of the screen in my Cocos2D Box2D iOS app. The bodies are dynamic... so I make them roll by applying a horizontal force to the center of mass (when the linear velocity is below the max velocity). Currently I apply this force in (void) tick (ccTime) dt. Is this the best place to apply it? Or should I subclass something and implement an update function somewhere? Please keep in mind I'm very new to Cocos2D Box2D.


Collisions between sprites in SpriteKit I'm making a game in XCode using SpriteKit. The game has a player and different types of projectiles that he has to avoid. When the player collides with the projectiles, the score changes and the projectile disappears. However, when two projectiles collide, they kind of bounce away. I want to make that every time two projectiles collide, they act like nothing happened and they keep going in their original path. What should I do? Note This is not the whole code, it's just what matters. import SpriteKit struct Physics static let player UInt32 1 static let missileOne UInt32 2 static let missileTwo UInt32 3 class GameScene SKScene, SKPhysicsContactDelegate var player SKSpriteNode(imageNamed "p1.png") override func didMoveToView(view SKView) physicsWorld.contactDelegate self player.position CGPointMake(self.size.width 2, self.size.height 5) player.physicsBody SKPhysicsBody(rectangleOfSize player.size) player.physicsBody?.affectedByGravity false player.physicsBody?.dynamic false player.physicsBody?.categoryBitMask Physics.player player.physicsBody?.collisionBitMask Physics.missileOne player.physicsBody?.collisionBitMask Physics.missileTwo var missileOneTimer NSTimer.scheduledTimerWithTimeInterval(1, target self, selector Selector("SpawnMissileOne"), userInfo nil, repeats true) var missileTwoTimer NSTimer.scheduledTimerWithTimeInterval(1.2, target self, selector Selector("SpawnMissileTwo"), userInfo nil, repeats true) self.addChild(player) When contact happens func didBeginContact(contact SKPhysicsContact) var firstBody SKPhysicsBody contact.bodyA var secondBody SKPhysicsBody contact.bodyB if ((firstBody.categoryBitMask Physics.player) amp amp (secondBody.categoryBitMask Physics.missileOne)) CollisionWithMissileOne(firstBody.node as SKSpriteNode, missileOne secondBody.node as SKSpriteNode) else if ((firstBody.categoryBitMask Physics.player) amp amp (secondBody.categoryBitMask Physics.missileTwo)) CollisionWithMissileTwo(firstBody.node as SKSpriteNode, missileTwo secondBody.node as SKSpriteNode) else if ((firstBody.categoryBitMask Physics.missileOne) amp amp (secondBody.categoryBitMask Physics.missileTwo)) CollisionBetweenMissiles(firstBody.node as SKSpriteNode, missileTwo secondBody.node as SKSpriteNode) For Player and MissileOne func CollisionWithMissileOne(player SKSpriteNode, missileOne SKSpriteNode) missileOne.removeFromParent() For Player and MissileTwo func CollisionWithMissileOne(player SKSpriteNode, missileTwo SKSpriteNode) missileTwo.removeFromParent() For MissileOne and MissileTwo func CollisionBetweenMissiles(missileOne SKSpriteNode, missileTwo SKSpriteNode) ???WHAT SHOULD I CODE HERE???


Help interpreting the physics of a rolling ball I'm using this article for reference. I understand handling the collision aspect, but I can't figure out how to calculate the new velocity once the ball collides with the ramp. Without it the ball just slides down the slope and stops at the bottom, with no horizontal velocity generated from the descent. The equation mentioned is tangentialVelocity velocity (velocity normal)normal Which I've tried as ball.velocityX magnitude ( magnitude normalX) normalX ball.velocityY magnitude ( magnitude normalY) normalY to no avail. Here is what I've done so far, which finds how far the ball is intersecting in the ramp and moves it outside. var distance int FP.distance(circleWorld.x, circleWorld.y, ball.x, ball.y) var penetration int distance ball.radius worldRadius if ( penetration gt 0) var componentX int circleWorld.x ball.x var componentY int circleWorld.y ball.y var normalX Number componentX distance var normalY Number componentY distance ball.x normalX penetration ball.y normalY penetration


How are physical model programmed in simulation games? Being a Gran Turismo fan, I'm wondering what are the algorithms used to compute realistic behavior for friction, aerodynamism, velocity, curves etc. Also, are there sophisticated ways to simulate fluid mechanics in flight simulation which are trivial enough for an amateur project ? If I wanted to build a flight simulator, neglecting the parameters which have the littlest effect (temperature, pressure, humidity, friction of the air on the wings, gravitational center of the plane, etc), are there some kind of physical formulae or programming models I should know about ? Or does physics engine feature such kind of simulation dedicated calculation ?


Creating shattering effects without having to use actual physics? For certain effects like glass shattering and falling objects cracking to reveal their inner contents, are there any tricks or ways to implement these fracture physics without having to use actual physics simulation? Also, what are the trade offs if I don't use real physics simulations? Since the effects don't really require exact simulation, an actual physics simulation may be too expensive and wasteful.


How can I add an impulse to specific rigid bodies at rest? Scenario Rocks falling down a rocky slope, with a flat surface at the bottom. When they land on the surface, the rocks move slightly before coming to a rest. GLESDebugDraw shows the bright orange outline turning to a slightly darker orange once a rock comes to a rest, until the rock is agitated by another falling rock. Question I would like to add an impulse to the rock once it reaches the rest state. How would I implement that?


Moving CCNode with constant speed in cocos2d I want to move the object (CCNODE) with constant speed in any direction , what i have did till now is applied a force to object at start to get it moving and set elasticity as 1 and friction as 0 to every object which it will collide . After some time speed goes on increasing , is there any way so i can check if speed increased so that i can control it or to apply velocity instead of force . Thanks !


Writing an autopilot for a 2d game with newtonian physics The subject says it all. I am making a 2d space game with newtonian physics and I need pointers on how to write an autopilot for it. The requirements are best explained by an example. There is a target object which has speed and position vectors and there is a spaceship that is controlled by the autopilot. This spaceship also has speed, position and maximum acceleration. The autopilot needs to control the ship so that it either collides with the target or intercepts the target with matching speed and position. Could someone give me some pointers how to achieve this behavior or perhaps even a ready implementation? I am sure someone has written something like this before and there is no point in reinventing the wheel.


Pathfollowing with acceleration centripetal force I'm implementing A waypoint pathfinding with some twists. One of the problems I'm encountering is because I do not change velocities of the agents directly but rather I do so through forces. Which gives me the following problem let's suppose the path consists of three nodes, P0 the starting position P1 node 1 P2 node 2 When the agent starts moving, it's first target position is P1. The agents moves in that direction because I let a force F act on it's velocity F normalized(targetPos agentPos) agentAccel agentMass The agent reaches P1. Now the agent's target position is P2, and upon it will act a force in the direction of (targetPos agentPos). However, this is a centripetal force, meaning that the agent will most likely orbit around P2 instead of popping the next node off the path (unless the angle between P0,P1 and P1,P2 is small) Stopping the agent at each node is not an option (would look unnatural) What should really happen is the velocity of the agent gradually shifting towards 100 the direction of targetPos agentPos , and the velocity should be completely 'shifted' before a certain distance(dX) is laid off, starting from the previous node position In order to solve this problem, only one parameter is adjustable F dir the direction of the force acting upon the agent, that's supposed to lead the agent to the next node. The values of the following parameters are known agentAcceleration ( the magnitude of the force vector) agentVelocity agentPosition node positions targetPosition ( the next node on the path) I've been trying some different strategies with trial and error to prevent this, but it seemed rather messy, so my question is, what is a decent approach to this problem?


Sliding loose dirt shader material effect Im sure there is some sort of technique with a name I don't know or didn't think to search, but how would I go about making an effect similar to loose dirt sliding down the face of a slope when something disturbs it? I guess I think of it as a mini avalanche or something. I have attempted it a couple times with pretty poor results, but some of the properties i tried to replicate was the sliding dirt spreads out the further it gets from its start position depending on the surface shape, angle of repose, rocks or larger pieces of debris causing even more dirt to slide(quasi recursion?), loose dirt 'sliding' over other dirt, etc. I assume id need to combine the right ratio of shaders, particles and textures to look right but I cant seem to find any real info on this type of effect. Would something like this be too intensive to do real time?


Should a bowling game use a 2d or a 3d physics engine? I'm creating a bowling game in flash as3. I'm new to physics engines, so, to start I've begun to learn Box2D since I've heard it's one of the most popular physics game engines. Currently, I'm not sure if it's the best solution. I'm not sure even if I should use a 2D physics engine or if I should move to 3D physics engine. As you can see in the attached screenshot of my game, the ball should move on the lane until it hits the pins. The game has some amount of 3D behavior. Please advise.


Ideas for 2D Water Simulation I am looking for any input on simulating water in 2D, against a rather large (call it) blocked not blocked array (viewed from the side). I have come up with the following ideas Cell Automata Do a massively parralel simulation on the CPU, using cell automata. With rules as simple as If there is a cell open to the bottom move to it. Check the left and right cells, choose a random one out of the two and move to it. Pros Simple to implement. Meaningful deterministic in a multiplayer system. Cons Probably really slow. Not convincing. Fluid Dynamics on the GPU Perform a rough approximation of fluid dynamics on the GPU against a texture like the following R G B A vX vY NULL Density Pros Probably really fast. Could be quite convincing. A further pixel shader could render it directly. Cons Difficult to implement. Difficult to tweak. I can't allocate a single texture the size of my level. I could overlap the grid areas, but this would add further complexity. Particles Use particles to simulate the water. During rendering using additive blending and then apply a multiplication function to the alpha channel to give the water crisp edges. Pros Will probably look nice. Easy to implement. Easy to render. Meaningful in a multiplayer system, although would require quite a bit of bandwidth to transfer. Cons Inter particle effects will probably be slow (neighborhood lookup). Could lead to water 'leaking' through solid spaces (because the solid space is small, e.g. 1px). Could lead to strange holes in the water depending on the particle size. Both of the above could be mitigated by allowing particles to drift closer together than their real size, however would cause problems with the inter particle and particle landscape performance. Any further ideas? Note This is an approximation, I am not looking for physically correct water here just something that 'is good enough' (bonus points for quick and dirty). The game is multiplayer, so unfortunately the whole level needs to be simulated continuously.


Physics based dynamic audio generation in games I wonder if it is possible to generate audio dynamically without any (!) audio assets, using pure mathematics physics and some input values like material properties and spatial distribution of content in scene space. What I have in mind is something like a scene, with concrete floor, wooden table and glass on it. Now let's assume force pushes the glass towards the edge of table and then the glass falls onto the floor and shatters. The near realistic glass destruction itself would be possible using voxels and good physics engine, but what about the sound the glass makes while shattering? I believe there is a way to generate that sound, because physics of sound is fairly known these days, but how computationaly costy that would be? Consumer hardware or supercomputers? Do any of you know some good resources videos of such an experiment?


Will my game engine be compatible with physics engines? My engine supports scene handling, cameras, and has a renderer. Also, it has a class called Drawable, which has the position, the shape and the picture of an object. The picture property has width, height, rotation and a draw method. All game objects are supposed to inherit from this Drawable class, and are added to the scene, along with a map (a collection of Tiles, that also inherit from Drawable), lights, and so on and so forth. The shape property of a Drawable is a Polygon, a collection of user defined vertices around the position of a Drawable. This is a relative coordinate system, so 0, 0 is the position of the Drawable. With this setup, will the users of my engine (which will probably only be me) still be able to integrate physics engines such as Box2DJS into their games?


How can I simulate a rigid body bounced from a wall in 3D world? How can I simulate a rigid sword bounced from a wall and hit the ground (like in physical world)? I want to use this for a simple animation. I can detect the figure and the size of the sword (maybe needed in doing bounce). Rotation can be controlled by quaternions matrix euler angles. It should turn the head and do rotations and fly to the ground. How can I simulate this physical process? Maybe what I need is an equation and some parameters? I need these data, and would combine them into my movie file, I use Mathematica to do the thing that generate the movie file(If I have the data, I can also export it into a 3DSMax script for example).


How do I detect ledges? In my game, I'd like my character to be able to grab and hold onto ledges, and to be able to pull themselves up if there's room to do so. How do I detect if there's a ledge, and if the character has enough space to climb up?


How to collapse a structure after procedural destruction When considering this temple structure with procedural damage in pink How can I efficiently determine the collapse of such structure as below? Even if the model is defined on a voxel grid, it would still require possibly wide ranging searches for connected ness? In the 2D case, flood filling and labeling disconnected components is probably doable, but what about the 3D case? Can this be done without traversing the entire world space, every frame which I imagine, wrecks havoc to a data cache? Lastly, what is the technical term for this problem of "making stuff fall down after procedural damage?"


Why are we not using integers in game physics? We can use integer for game physics (or without physics, simply object representation) mass, position and rotation, where the integers represent, for example, the number of milligrams, millimeters or (1 56000) of a degree. However, almost all game code I've seen recently use floating points. Is it slower to use integers for game physics calculations? Are there any other advantages and disadvantages from the developer's point of view for using integers? Or it is because all our hardwares


What is your Unity 3D physics engine budget for iOS games? I'm testing Unity for a game that I'm building, and I've touched its limit. My test scenario a wanna be house with 200 elements (cubes rescaled) no textures, box colliders and rigid bodies for each "cube" and fixed joints to hold them together (400 fixed joints). The house is on a plane, and above it I put 2 sphere at different altitudes, spheres which will crash in the poor house. This moves very slow on an iPod Touch 3rd generation. Therefore I'm looking for some documentation to create a reasonable budget for the number of polygons, physics collisions and so on. What is your recommendation?


How can I resolve collisions a little better? I'm currently developing a physics engine and I'm not sure the best way to go about resolving my problem. I have a little box, that I can move around with in my scene. When I'm resolving collisions, I take in the two bodies that are colliding, determine what both of their normal forces are and apply it to them (I also multiple it by a small number, if I don't I can't continue to walk around the scene). Anyways, while I'm resolving the collision I do this a.Position a.Velocity b.Position b.Velocity I know this isn't a very good way to resolve the collision, but I'm just not sure how to do it correctly. How should I go about resolve collision correctly? Also, here is the whole method I use to resolve collision at the moment private void ResolveCollision(Body a, Body b) Calculate normals forces (N M G) Vector2 normalForceA this.CalculateNormalForce(a) Vector2 normalForceB this.CalculateNormalForce(b) Resolve collision, which is super buggy and obviously a bad idea. a.Position a.Velocity b.Position b.Velocity Apply normal forces a.ApplyForce( normalForceA 11) b.ApplyForce( normalForceB 11) EDIT This is for a 2D game. EDIT Here is a video of what's going on when I applied TomTsagk's answer. The video is here


Should I use animated objects or use the physics engine on iOS scenes with lots of rigidbodies? I have a scene with lots of houses and other objects. These objects will be bombarded from the sky. How to handle these kind of settings having in mind that you want the physics to be as realistic as possible. In Unity3D, if I set all the objects with isKinematic true and on collision I set it to false, then the physics isn't as realistic as I want it to be... Can you have these kind of scenes on iPhone? Should I have animated objects? I really don't know what is the best practice in this kind of scenes....


Box2D stable range and position Box2D marks stable range of object size is 0.1M 10M. This specifies object size range. How about space size? If I make an 1M object at (1000.0f,1000.0f) position? Is it can be stable? Or should I assume spatial range is also limited same with object size? PS. Maybe the resolution limit is defined because of limit of floating point operations. I believe there's also some limitation on spatial range, but I couldn't figure out specific range myself.


How to implement the rag doll physics in OpenGL? I'm wondering, having a human model made in blender, how can you make it so that at some point (when the human "dies") the body follows the rag doll physics in OpenGL? I tried looking for some tutorials but I can't found one that fits my requests. Specifically how do you make rag doll physics in OpenGl (and if needed using Blender)?


How do I program a fan in a platformer game? Fan physics I have a platformer game and want to have fans in it that blow in a given direction and if the player presses the jump button they can go even further. How do I do this? side note I am working with godot engine EDIT My character moves on the two axes using two variables, both multiplied by speed move dir and y velo. gravity affects y velo and the arrow keys affect move dir


How do I set an object's speed to arrive in X seconds? I want to move an object to a point in the game world, I have the distance value which is far the player should move. I want to complete the movement in X seconds. I have tried many equations and formulas to no success. Speed Distance Time This one doesn't seem to give me the right result. Thing is the game is updated 60 times a second and the movement is affected by delta time. I'm pretty sure I am not taking the framerate in consideration. What am I doing wrong? Edit This is how I calculate the speed int dst 500 int time 2 in seconds float speed dst time Doing it this way is making the movement instant and the game object is not traveling the distance in 2 seconds. Every frame each game objects gets updated this way p.x dir.x speed deltaTime p.y dir.y speed deltaTime The dir vector holds the direction of movement which is calculated on mouse click Vector2 dir new Vector2(mouseX, mouseY).subtract(objectX, objectY).normalize() Delta time calculation long time System.nanoTime() float deltaTime (time lastTime) 1000000000.0f lastTime time Please note The game object stops upon arrival.


How do I make a character "jump" when leaving an up slope? I have developed a game in Android using a tile based system. I ve implemented 22 , 45 and 67 up and down slopes and everything works (almost) perfect. The problem now is that, when the character gets to the end of an up slope, it justs falls until it finds the ground. I want it to perform some kind of parabola depending on the slope and its speed. I think it s better explained in the picture I already have a function that determines whether or not the character is leaving the slope, I just want some ideas of how to achieve that kind of "jump" in some pseudo code or explanation because I don't know how to start. Any help would be appreciated.


How to model vehicle driving physics? How to model the physics of a car in a racing game? In real life, vehicle movement is inherited from the wheels. But after reading a few articles on the subject (a lot of which are 10 years old), I realize that the 'real world' physics is in fact often faked with various equations and constants. I want to create custom driving model to learn about it mostly, but I don't want to start wrong so that's why I am here.


Physic of an arrow in flight What are the formulas which represent the horizontal and vertical displacement of an arrow in flight (as well as it angle)? I would like to make sure that I take into consideration the arrow's fluid dynamics and center of gravity.


Friction using delta time returns inconsistent result Slowing down a character using the following formula returns different results depending on the frame rate this.y this.yVel delta this.yVel Math.pow(0.99, delta) Is there a better way to decelerate a player using delta time to allow for consistent movement across several framerates?


3D Coulomb Friction Use Collision Impulse To Calculate Friction Force? I've been using this document to learn how to implement a very basic physics engine. The section on Coulomb Friction on page 55 56 (marked as pages 43 44) confuses me. It observes that the friction force can be calculated using the collision impulse (jr). This seems strange. Envision an object falling very quickly onto a plane with a slight incline. The object is rotating in the opposite direction it would if it were rolling down the incline. When the object makes contact, it will have a small velocity along the tangent, but a huge normal impulse (jr). This will result a very large change in velocity along the tangent (t hat) opposite to the direction of motion. This will push the object up along the surface (bad!) with a notable amount force. My implementation confirms this. Can someone explain to me how this all fits together? I'm very confused. P.S. I don't think trying to provide an example of my implementation here is relevant, either the effect I'm explaining cannot occur (in which case there is a bug, which I can find myself), or I'm misunderstanding the equations, in which case the implementation is inherently broken


Numerical stability in continuous physics simulation Pretty much all of the game development I have been involved with runs afoul of simulating a physical world in discrete time steps. This is of course very simple, but hardly elegant (not to mention mathematically inaccurate). It also has severe disadvantages when large values are involved (either very large speeds, or very large time intervals). I'm trying to make a continuous physics simulation, just for learning, which goes like this time get time() while true do new time get time() update world(new time time) render() time new time end And update world() is a continuous physical simulation. Meaning that for example, for an accelerated object, instead of doing object.x object.x object.vx timestep object.vx object.vx object.ax timestep timestep is fixed I'm doing something like object.x object.x object.vx deltatime object.ax ((deltatime 2) 2) object.vx object.vx object.ax deltatime However, I'm having a hard time with the numerical stability of my solutions, especially for very large time intervals (think of simulating a physical world for hundreds of thousands of virtual years). Depending on the framerate, I get wildly different solutions. How can I improve the numerical stability of my continuous physical simulations?


How do I get a HingeJoint2D to be rigid instead of elastic? I made a chain of 40 segment using a HingeJoint2D. I followed the instructions directly off this Unity tutorial video But when I start the game the chain bounces and stretches and then slowly over about 20 seconds it slowly pulls it self back up How do I get the chain to actually be rigid instead of elastic? If that's impossible, how do I get them to start in a rest state instead of starting with a bounce? I uploaded the scene here if you want to play with it in Unity yourself.


How would I go about programming atmosphere for a game? I've recently started making a 2D game, and I want to implement an atmosphere. My plan is to include many in game compartments, such as tubes and ventilation. If I open an airlock from a room with zero pressure to a room with high pressure, I should feel a heavy knock back. If I mix gases in a room, and players both human and alike would not be able to breath, they would die. I have idea of how to do it, but it won't be that sufficient and real. I don't need an real atmosphere it just needs to feel real. This is the small list of what I want to implement Gas pressure that effects the environment, such as moving objects and causing damage to objects. Simple gas mixing, where I would like to implement 4 5 different gasses. Some sort of in game device to affect atmosphere and check its state. How would I go about programming atmosphere for a game?


Client side prediction in 2D rigid body physics I'm currently working on 2D rigid body physics multiplayer game using Matter.js for physics (both the client and server side) and Phaser3 for rendering. Both the server and the client run the simulation and the server is authoritative. The whole game consists of multiplayer players (who can collide with each other) and objects (boxes, balls, etc). For now, I'm working on the client side prediction and while I understand the main concept, I just can't get it right. Every game tick I gather the client inputs, store them locally, timestamp them and send to the server, while at the same time I start moving the player forward (by applying force). When the server receives the inputs, it processes them (by applying the same forces to the player). The server then sends the current state (coordinates, velocity, rotation, last processed input timestamp, etc) to all players at 20hz. This is the part where it gets tricky. What I currently do, is I force the player to the coordinates sent from the server and apply the same velocity (both X and Y). After that, I remove all locally stored inputs which are older than the last processed input and apply them instantly in a single frame, by doing multiple physics steps. With low latency (20 30ms) it works out quite well, with some jittering when rapidly changing the player direction or when I'm colliding with other players objects, but with higher latencies 70 110ms, the prediction goes completely off. I can see the player constantly being pulled back and forth and the whole game becomes unplayable. I can't wrap my head around, what exactly am I doing wrong? Is client side prediction even the correct way of handling this sort of thing in a rigid body physics based game? Also, I turned off state updating from the server and noticed that the position in the server and locally sometimes goes completely off, for example when I'm jumping, running and quickly changing direction. I believe that means that the physics engine is not deterministic?


How to account for speed of the vehicle when shooting shells from it? I'm developing a simple 3D ship game using libgdx and bullet. When a user taps the mouse I create a new shell object and send it in the direction of the mouse click. However, if the user has tapped the mouse in the direction where the ship is currently moving, the ship catches up to the shells very quickly and can sometimes even get hit by them simply because the speed of shells and the ship are quite comparable. I think I need to account for ship speed when generating the initial impulse for the shells, and I tried doing that (see "new line added"), but I cannot figure out if what I'm doing is the proper way and if yes, how to calculate the correct coefficient. public void createShell(Vector3 origin, Vector3 direction, Vector3 platformVelocity, float velocity) long shellId System.currentTimeMillis() hack ShellState state getState().createShellState(shellId, origin.x, origin.y, origin.z) ShellEntity entity EntityFactory.getInstance().createShellEntity(shellId, state) add(entity) entity.getBody().applyCentralImpulse(platformVelocity.mul(velocity 0.02f)) new line added, to compensate for the moving platform, no idea how to calculate proper coefficient entity.getBody().applyCentralImpulse(direction.nor().mul(velocity)) private final Vector3 v3 new Vector3() public void shootGun(Vector3 direction) Vector3 shipVelocity world.getShipEntities().get(id).getBody().getLinearVelocity() world.getState().getShipStates().get(id).transform.getTranslation(v3) current location of our ship v3.add(direction.nor().mul(10.0f)) hack this is to avoid shell immediately impacting the ship that it got shot out from world.createShell(v3, direction, shipVelocity, 500) Edit I switched to v3.set(direction) v3.nor().mul(velocity) if (platformVelocity ! null) v3.add(platformVelocity) entity.getBody().setLinearVelocity(v3) And it seems to work (so adding the velocities and setting them on the body). However, I'm not sure what the drawbacks are and why the tutorial application used impulses instead of setting velocities. I also think that while this is physically correct it leads to strange results (gun range is two times further when shooting forward than when shooting sideways). The root cause is because really the shells are indeed too slow, but I like them slow as otherwise the gameplay is too fast paced, and they travel too far. I think I need some compromise between physics realistic and ignore platform velocity.


How can I implement smooth digging effects in a tile based game? I'm trying to make a Dig Dug styled game where you will be digging into a material. This is going to be a tile based HTML5 game and I have decided to use the Phaser framework. One way to do the digging mechanic is to break the play area into tiles and remove tiles as the player sprite collides. But I would like to have a smooth digging animation physics, so it appears that the player character "carves" out the soil as it digs through. Any tips on how I should do this? Right now I have 15x15px tiles while the player is 45x45px, this sort of fakes the smooth digging I want. Is there a better way?


How do you properly implement level boundaries in a physics room? I have an issue with creating a proper boundary in GameMaker Studio when using a physics enabled room. My room has a gravity of 0, as it is in Space. My player object has the default values, but a friction of 10 with a box shaped collision shape. I also use View0 on a 1280x720 room with a 1280x720 view. That is to be able to do screen shakes and other neat effects. I really struggle with containing my player object properly to the room. When I use a collision with view0 boundary and add phy position x phy position previousx phy position y phy position previousy then my ship would get stuck at the screen borders very frequently. I also tried adding some sprites that block the player off the room and created a sprite, 1280x720 and spawned them at the borders. I gave my player empty events for them and set their density to 0, making them static. However, this resulted in the same problem, I got stuck in them. I need a smooth solution for this, obviously, to have a fun experience. I have this problem quite for a while, so please help me understanding how to do this properly.


How to create skeletal animation data for a skirt? Please think of this in an engine agnostic way first, and then we can talk about specific engines. In my game, I have a 3D character which is wearing a hakama (think of it as a long pleated skirt). This character will be doing a lot of dancing, which I'm getting a lot of motion capture data for. This is how my character is rigged right now (view from Unity) This character has a standard 3D Studio Max humanoid rig, plus a bunch of bones for the "dangling" stuff such as the skirt, the sleeves, the long hair and other parts. Unfortunately, motion capture can only give me data for the humanoid part, not for the additional parts, so I need a way to animate these. For now, let's focus on the hakama (skirt). I have a few ways of doing this Removing the additional bones, and rig the cloth directly to the leg bones This is my last resort, but one that I'd like to avoid, as the hakama will move directly with the legs as if it were a tight fit, losing a lot of realism. Keep the bones and animate them manually. There are just too many frames and too many characters for it to feasible to do this manually, so this is out of the question. Simulate the leg and cloth interaction in some way. Fortunately, the dancing is static (just for cutscenes), so I can do this offline, export the resulting bone transforms for each frame, and apply this to the character during playback. Since Unity has a pretty mature physics engine, I am trying to hack an offline physics simulation that exports the resulting bone transforms for each frame, which I can then playback in real time in the actual game (which by the way is not Unity based). So far, the sleeves and hair have shown some pretty good results, but the hakama is much more difficult, and I haven't gotten it to work even close to decently. I have tried Setting colliders in the legs and the skirt, so when the legs push the skirt, the skirt moves. I can set a bunch of joints to set some constraints, but setting a correct shape and position for the skirt colliders is not trivial, since the leg colliders eventually find a hole between the skirt colliders, which leads to the leg intersecting with the skirt. Instead of colliders, set spring joints between the leg bones and the skirt bones. Unfortunately, springs don't have a concept of "pushing" vs "pulling", and I can visualize a lot of cases where the simulation will lead to the leg intersecting the skirt. Notice that I can't use Unity's cloth simulator, since this acts on polygons directly, and I need to be able to export the results of the simulation in terms of bone matrices. It's not mandatory to use Unity. I just need to find a way to simulate the leg cloth interaction and export the results in a series of bone transforms. Any ideas on how to solve this problem?


How to obtain "gravity" and "initial impulse" given "desired time to reach max height" and "desired max height"? I'm developing a 2d fighting game, using time steps based on frames ie, each call to Update() of the game represents a frame so, no variable time at all. My jump physics code doesn't need to consider delta time, since each Update() corresponds exactly to the next frame step. Here how it looks double gravity 0.78 double initialImpulse 17.5 Vector2 actualPosition double actualVerticalVelocity InitializeJump() actualVerticalVelocity initialImpulse Update() actualPosition.Y actualVerticalVelocity actualVerticalVelocity gravity It works great and results in a smooth arc. However, it's hard to determine the values for "gravity" and "initialImpulse" that will generate the jump that I want. Do you know if it's possible to calculate the "gravity" and "initialImpulse", if the only known variable is the "desired time to reach max height" (in frames) and "desired max height"? This question should lead to the answer I'm looking for, but its current answer does not fit my needs. UPDATE As MickLH figured me out, I was using an inefficient Euler integration. Here is the correct Update() code Update() actualVerticalVelocity gravity 2 actualPosition.Y actualVerticalVelocity actualVerticalVelocity gravity 2 Only the very first step of the Update() will change and will move the object by initialVelocity plus the half of the gravity, instead of the full gravity. Each step after the first will add the full gravity to the current velocity.


How to implement "Flick" gesture for throwing an object in the 2D realm I am trying to implement a FLICK gesture for throwing a ball from point A to point B on the iPhone. This is my current plan.... Using touchesBegan and touchesEnd I can find the direction I need to move the ball, and with a small counter, I can impact a certain velocity on the object. My question is simple... Is there a better way to do this ? I am unaware of the physics engine and how I could use it in this scenario. Any good suggestion will help !


How can I avoid type checking in the physics side of collision handling? I have a class responsible for handling the physics side of collisions. When the collision detector spots a collision, it notifies both entities in the collision to take care of gameplay. It also notifies the PhysicsGenerator to take car of the physics of the collision. I don't know if it's possible to avoid type checking in the handleCollision() method of PhysicsGenerator. What I wanted to do is apply a force on both entities in the collision to push them backwards. But I can only do this if they are MovingEntities. What if one of them is a StaticEntity? In this case it should be treated differently. I don't know how I can do that without using instanceof quite a lot. How is this usually handled?


What is closing and separating velocity in Ian Millington's game physics book? I'm working on a physics engine in C and chose Ian Millington's Physics Engine Development book as a guide and reference to help me out understand physics concepts and how to implement them. Yesterday I was reading through the Hard Constraints chapter, particularly the simple collision resolution section and came across an explanation of a physics formula that I couldn't fully comprehend. Millington says quot The closing velocity is the total speed at which two objects are moving together quot and it is calculated with the following formula V c dot P a cdot( widehat P b P a ) dot P b cdot( widehat P a P b ) Where V c is the closing velocity, P a and P b are object a and b respectively. Also he further discusses another formula called the separating velocity which is written as follows V s ( dot P a dot P b) cdot( widehat P a P b ) Where V s is the separating velocity. Now I don't really understand what these formulas actually are or what they represent in the physics world. I also have trouble wrapping my head around why we need these formulas to perform collision resolution since he used the separating velocity formula to resolve the velocity upon collision and why we need the dot product. It would be really helpful if someone can provide visual explanation that would significantly help me understand what's going on.


Character animation in physics simulated environment What are the standard solutions for animating characters in physics simulated environments? Let me explain what I mean in most games characters are pretty much excluded from physics simulation there are no forces acting on specific body parts (only gravity for the whole character) and limbs are forced to go into positions specified in key frames of animation... which in turn may produce infinite forces on the limbs and we know real muscles have limited strength... What I want is character animation based on simulated muscles with plausible limitations so character walking into a 1 T stone won't move it, or if he gets hit with a fast flying brick he would realistically fall (and brick won't just bounce like from the wall, whit character standing still like nothing happened). Are there libraries that can do that? Maybe free ones for 2D simulations?


Center of Mass for Convex shape in 3D For an arbitrary convex shape in 3D, how can I calculate its center of gravity? I have face normals, and the vertices for each face. Ocelot No, it most certainly is not the average of the vertices, as demonstrated in this simple 2D case. The average of coordinates is in top of shape, whereas the C.o.M. is in the bottom half.


A good place to learn about Game Programming with Mathematical Vectors? I am looking for a place in the web where I can turn my current game development process into a vector based approach. I am sorry If this question has been asked once. According to my google search analysis, few places I've found pretty interesting are Tony Pa's tutorials and Metanet. But, due to limited explanations, I found it little bit tough to implement. I could try out the same examples as provided there, but when I have to use it in my games, I am STUCK. I want to know about the dot products and cross product stuff, Its uses and detecting collisions and predicting collisions with these mathematical techniques. Please, write down some links and a brief description of the link. Thank you


How to correctly create bullet rigid from custom .mesh in Ogre? Being new to 3d programming and bullet physics in particular, I am wondering how a 3d model or the mesh generated out of it effects the accuracy of bullet physics simulation. I have written a small Ogre 3d application in C , including using bullet for physics. In a small scene I add a plane as ground and three boxes (simple blender objects that come with Ogre) that have their initial position a bit over that ground. So after starting the application those three boxes fall down until they hit the ground plane, where they move a bit, depending on their initial height and rotation, until they come to a halt. Watching that scene the bullet physics simulation looks very accurate and realistic, also the boxes seem to touch the ground very exactly. Ok, then I have created a box model in Sketchup 8 and exported it to an Ogre .mesh file. Then I use this model instead for those three boxes in my scene. The C code itself is not changed at all (except that I load the new .mesh file for the boxes). However, even though on the screen those new box models look exactly as the original ones, their movement is not correct any more. They fall to the ground plane fine, but then they move very weird, it looks not as realistic as before. Even worse, after they have stopped their movement those three boxes now "float" a bit over the ground plane, they do not touch it. I can also see their shadow now below the box on the plane, so they are really not touching the ground plane. TL DR Scene with three boxes, falling down to the ground, simulated by bullet. That works fine with default Ogre (blender) .mesh files for the boxes. But with custom Sketchup models (.mesh files) instead for the boxes, but the same code, the bullet simulation does not work correctly any more. My question is how does the mesh of a model impact the accuracy of bullet? And what can I do to solve that issue with my custom Sketchup models? PS I load the .mesh file and convert it to a bullet rigid body as following m pSceneMgr gt createEntity("Cube1", "Cube.mesh") ... BtOgre StaticMeshToShapeConverter converter(m pSceneMgr gt getEntity("Cube1")) btCollisionShape colShape converter.createBox()


How can I simulate physics on my curved LED strip? I have a LED strip with 300 LEDs that I can control one by one https github.com cipold pyledstrip You can think of them as Adafruit NeoPixels https www.adafruit.com category 168 I have code to detect the physical positions of all LEDs using a camera and generate an x y heightmap https github.com cipold pyledstrip detector There is some experimental code to make use of the heightmap and let pixels race along the strip like on a rollercoaster https github.com Pixe1 pyledstrip particles Video http mnagel.net oneshot 2018 03 02 particle.mp4 975a194be7cc6fc8 particle.mp4 The "physics engine" within that code is very ad hoc, however. I want to rewrite it into something that more explicitly encodes the physical laws of classical Newtonian mechanics. I can easily simulate particles with mass, position, velocity (acceleration gravity forces). With multiple particles and gravity between them, I would end up with some kind of solar system. Or with constant overall gravity, one particle would fall down in a straight line, accelerating all the time. What I really want is "global gravity" but restrict the particles to move along the path dictated by the LED strip heightmap of waypoints (one degree of freedom along that path). How can I adequately model this restriction with formulas that are still reasonably physically accurate?


How to apply physics when you have sub frame state changes? I'm currently calculating my physics every 1 100th of a second and using a state machine to manage the current state of the player. In my main loop I'm checking user input and transitioning the state as needed and then my physics code checks the state to apply the appropriate forces. Pseudo if (fsm.state walking) velocity walkVelocity However, the issue I think I've noticed with this is what if a full state transition occurs between two physics frames. For example the user taps jump so quickly they transition from jumping to falling happens so quickly that the physics code hasn't got a chance to see that a jump was requested and therefore doesn't apply the change in velocity. This is a simple example, but I'm feeling that states maybe shouldn't be used this way. Maybe the key presses themselves need to be fed directly into the physics code (so that it can have access to durations and order of events) and then it (the physics code) updates the states accordingly. Is this the common way of arranging flow? Or am I missing something? I.e. should it be Input state change physics Or should it be more like Input physics state change I've seen state machines used with event systems before. So state changes are raised as events which subscribers can respond to. However the physics code still needs to run at fixed timesteps so it needs to be able to query for 'things which have occurred'.


What are constraints and how are they pluggable? I have been reading this book called "Game Physics Engine Development" and Came across this image in the context of Collision Resolution. See the contact Generator part. Can someone tell me what are constraints and how there can be different types of them? Thank you.


How does pixeljunk shooter simulate its liquids? I am really impressed by the liquids in pixeljunk shooter. I would love to know how they do it.


How do physics bones relate to animation bones? Skinned animations use a tree of bones where the child bone (say a finger) is the weighted sum of the rotations of all it's parent bones. Physics bones are defined as a rotation matrix of a primitive (a cube) that has its position constrained by each of its child bones. Is there any correlation with how they map to each other? Can a physics bone be used in place of an animation bone? Thanks in advance.


Simple collision resolution in a platformer game I want to make a 2d platformer with moving, jumping and wall sliding. How can I make a simple pleasant collision resolution system that works for the following rectangles. Player is red, platform is black, I want to detect if the player is sliding a wall, or hitting the ground, or doing both ( as in third example). Also take the appropriate response. Also I have no idea what I am talking about so a little context might help. These resources helped me How to resolve collision 2D AABBs and resolving multiple collisions How to detect overlap between aabb vs aabb http noonat.github.io intersect


How to make an object oscillate left and right? I can't seem to make an object move left and right, back and forth, on room start whilst on solid ground. Codes I used Step Event if image index is greater than 5, then physics apply force (0,0,100,0) for the right if image index is less than 5, then physics apply force (0,0, 100,0) for the left


Friction using delta time returns inconsistent result Slowing down a character using the following formula returns different results depending on the frame rate this.y this.yVel delta this.yVel Math.pow(0.99, delta) Is there a better way to decelerate a player using delta time to allow for consistent movement across several framerates?


How can I synchronize ocean waves over the network? I've been performing a little bit of research in my spare time on ways to increase the interactivity of environments in a networked game or simulation. One of my areas of research is fluid dynamics and whether it would be possible to synchronize it over the network. I believe the short answer to that is Yes of course you can. But there will obviously be trade offs as there are with any network synchronization problem. I was recently playing Battlefield 4 and a number of their maps have playable ocean areas with fully functional waves large enough to obscure entire boats during gameplay. It seems to work quite well as well. My assumption here is that the ocean simulation is completely offline and each client performs synchronization with the server during initialization. This would allow all clients to run the exact same ocean simulation that appears to be dynamic but is in fact the same offline simulation every time. Interaction with the ocean simulation appears to be only superficial with local splash wave depression. I assume that is entirely local to the client and not synchronized. My question here is Would the above be an appropriate way to synchronize fluid simulation over a networked game? If not, what would you suggest?