Updating RigidBody rotation and velocity only updates it's rotation I'm currently making spaceship controller script. Control is simple, W S to move forward backward, A D to rotate ship by Y Axis(yaw). Spaceship is RigidBody node and has CollisionShape as children. Here's the code for move forward backward export var speed 1 export var max speed 10 var current speed 0 export var key acceleration KEY W export var key deceleration KEY S func process movement(delta) if Input.is key pressed(key acceleration) current speed speed delta elif Input.is key pressed(key deceleration) current speed speed delta current speed clamp(current speed, max speed, max speed) linear velocity Vector3(0, 0, current speed) I need to limit it's maximum speed, so I updated velocity directly, not using something like add force. Next is rotating code export var yawing speed 0.01 export var max yawing speed 0.02 export var yaw stop threshold 0.001 var current yaw 0 func process yaw(delta) if Input.is key pressed(key yaw left) current yaw yawing speed delta elif Input.is key pressed(key yaw right) current yaw yawing speed delta else if current yaw gt 0 current yaw yawing speed delta if current yaw lt yaw stop threshold current yaw 0 elif current yaw lt 0 current yaw yawing speed delta if current yaw gt yaw stop threshold current yaw 0 current yaw clamp(current yaw, max yawing speed, max yawing speed) rotation.y current yaw In this code, I updated rotation.y directly. Each of this function works if run separately, however run these together, it only changed rotation, not velocity. func physics process(delta) process movement(delta) process yaw(delta) Change order of process movement and process yaw doesn't change anything. If I just run one of process movement and process yaw, it works perfectly. Why my rigidbody ignored velocity and only rotated? Any advice will very appreciate it.


in Unity3d, how to automatically create fixed joints in a wall of cubes? I want to create a wall width 6 cubes height 7 cubes therefore I have 22 cubes on the margins and 20 cubes inside. For each of the margins cubes(except the corners) I have to set 3 fixed joints, and for the cubes inside the wall I have to set 4 fixed joints all this to have good physics behavior. Pretty much I have to create a fixed joint between a cube and all his neighbors and that's a lot! Is there a way to automatically create these fixed joints? Is there another way to create a physics friendly wall? I want to simulate a wall of bricks hited by a projectile.


Powder games how do they work? I recently found these two gems http powdertoy.co.uk http dan ball.jp en javagame dust My question is How are the physics with so many elements efficiently handled? Am I just severely underestimating modern computing power or is it possible to 'just' have a two dimensional array, each cell of which describes what is placed at the according position and simulate each cell in every step. Or are there more complex things being done like summarising large areas of the same kind into a single data set and separating said set as needed? Are there any open source games like this I could look at?


Time complexity of solving constraints in physics engine Erin Catto mentioned in a talk that solving constraints precisely requires cubic time and quadratic space. What algorithm is he talking about when he mentions cubic time? pdf of slides with following quote We can model and program our constraints perfectly. Good enough to drive a robot arm on an assembly line or launch a satellite into space. Unfortunately for games, we do not have enough cycles to solve constraints accurately. Solving constraints precisely requires cubic time and quadratic space. For games we make due with linear time and space, so we are constantly wrestling with our solvers. The better you understand constraint solvers, the better chance you ll have of creating robust simulations in your game.


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.


How to program friction in an air hockey game in Cocos2d x 3.11? I'm developing a simple air hockey game, and I have a question about friction of puck and puddles with the game scene. How can I do that? I'm using cocos2d x default physics engine, and the friction setting of physic bodies only applies when they collide. I've found an old air hockey example project, but it seems that it's ported to cocos2d x 3.x so it doesn't use built in physics engine.


Physics calculating angular acceleration in world vs local space I have a pretty simple rigid body simulation written in Python. In my code I calculate the angular acceleration using formula angAcc torque inertiaTensor 1 (note row major matrix order) Now, the torque is in world space so my inertiaTensor should also be in world space. My Python code that does the angular acceleration computation looks like this oriMat quaternion.ToMatrix(self.ori) inertia world self.inertia local oriMat matrix.Invert(inertia world) angAcc vector.Transform(self.totalTorque, inertia world) oriMat is effectively local to world transform. self.totalTorque is torque in world space. So this code transforms local inertia to world inertia and uses its inverse along with world torque to compute world angular acceleration. This code works completely fine. I thought to check out if I could conduct the angular acceleration compuation in local space and eventually convert local angAcc to world angAcc. Here's the code oriMat quaternion.ToMatrix(self.ori) self.totalTorque vector.Transform(self.totalTorque, matrix.Inverted(oriMat)) angAcc vector.Transform(self.totalTorque, matrix.Inverted(self.inertia local)) angAcc vector.Transform(angAcc, oriMat) Here I wanted to do the torque inertia transform in local space. To do so, I transform self.totalTorque to rigid body's local space using inverse of oriMat. Then I mul that by inverted local inertia to get angular acceleration in local space. Finally, I transform angular acceleration to world space by transforming it with oriMat. For some reason this code doesn't yield correct behaviour of my rigid body and I really can't tell why. Anyone got an idea?


How does one avoid the "staircase effect" in pixel art motion? I am rendering sprites at exact pixel coordinates to avoid the blurring effect caused by antialiasing (the sprites are pixel art and would look awful if filtered). However, since the movement of the objects involves variable velocity, gravity, and physical interactions, the trajectory is computed with subpixel precision. At large enough screenspace velocities (v t larger than 2 or 3 pixels) this works very well. However, when velocity is small, a noticeable staircase effect can appear, especially along diagonal lines. This is no longer a problem at very slow screenspace velocities (v lt lt 1 pixel per second) so I am only looking for a solution for intermediate velocity values. On the left is the plotted trajectory for a large velocity, obtained by simple rounding of the object coordinates. In the middle you can see what happens when velocity becomes smaller, and the staircase effect I am talking about. On the right, the locus of the trajectory I would like to get. I am interested in algorithm ideas to filter the trajectory in order to minimise the aliasing, while retaining the original behaviour at large and small velocities. I have access to t, instant position and velocity, as well as an arbitrary number of previous values, but since it is a realtime simulation, I do not know about future values (though if necessary, an estimation could be extrapolated under certain assumptions). Note that because of the physics simulation, sudden direction changes can also happen.


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()


Inconsistent jump height I am doing some physics for a platformer game in MonoGame. The jump height changes based on FPS even though I'm using delta time. When the FPS decreases and gravity is added before movement, the jump height is shorter than usual. How do I keep a consistent jump height at all frame rates? Here's the pseudo code executed each frame velocity.Y gravity dt Move(velocity dt)


Random map generation strategies for scattering clustering random nodes I am doing a simple 4X strategy game in space where each node is a point of interest (a planet, an asteroid and etc.). To randomly generate a map, I would follow the steps below Decide how many type of each nodes the map will have (perhaps, say, 5 Earth like planets, 10 barren planets etc.) Place each type of node on the map. For step 2 I would like to have an even spread of each node type. So for example, I would start by placing all the earth like planets. If I simply do a rand(map.width, map.height) to determine the position, I may end up all the earth like planets clustering together, which will give advantage to the player who starts in that area. Are there any methods, such as using different graph functions or noise function, which could generate a sequence of (x,y) coordinates which are spread out from each other. Likewise, are there any ways to generates coordinates which are close to each other?


Unity 2D Hingejoints break under extreme force I have added a rope to my game that is made up of multiple small gameobjects, each connected to eachother by a HingeJoint2D. Since 1 unit of mass in Unity is supposed to represent 1 kg, I've made the player's mass 60 (60kg). When the mass of each rope segment (of which there are 40) is 20, the rope supports the player when they jump off a cliff. Now 20 kg per rope segment sounds ludicrous. However when I make each rope segment weigh 1 (1kg) the hingejoints break completely and jitter around crazily. The force of the 60kg player against the 1kg segments seems to be too much. I would much rather have the rope be lighter, so it doesn't move the player when throwing and being dragged as much. Any suggestions on how to fix HingeJoint2D's and make them act, as you know, a joint should? EDIT Increasing the Position and Velocity Iterations in File gt Project gt Physics2D menu from the default 3 and 9 respectively, up to a whopping 40 fixes this problem. This is a massive increase. Unsure if performance will suffer too much with these new settings.


How do I determine the slope of a curve? I am making a 2D game where the character rides on the curve of a graph. I need to find out whether the player is going uphill or downhill and calculate speed accordingly. The problem is that I am not sure how to determine the slope of the curve on the point that the character is at. Here is an example of what some of the curves look like


Calculating displacement in physics simulation Something's been bugging me and I haven't been able to figure this out. In a simply physics simulation, where you'd calculate a net force acting on a body every frame, calculate the acceleration that frame and from that the velocity and then distance travelled. (like this) a F(given) m v a dt s v dt Why is it not s 0.5 vfinal dt (for constant acceleration), in other words, why is not customary to assume that the speed changes linearly during the timeframe dt instead of assuming that the velocity is constant during the frame.


Is there a javascript physics engine that does not require canvas? I just need a really simple and small physics engine for squares or circles that moves images using javascript. For the project that I am working on, I can't use canvas, so I will be moving the images via the dom. If I understand it correctly, Box2D and PhysicsJS both require the canvas (or at least in my testing that seemed to be the case). I don't really want to make my own, because I bet there is something out there that already does this. So, is there a javascript physics engine that does not require canvas?


Applying multiple forces on a particle If I have a particle, say in a polar coordinate grid, and I want to apply multiple vectors to it, how can I calculate where it's final position will be given those vectors? Ex. Imagine there's a force represented as a vector, that moves the particle a radius magnitude of 8 at an angle of 45 . Another vector that acts on it at the same time, at magnitude 3 at 90 . How would I calculate the final position of the particle?


Calculate Jump Limits My question is in a similar vein to this question, I am creating a pre mapped pathfinding solution much akin to how Ash Blue was for my 2D platformer style game (in XNA). As part of the process, I have to be able to 'neighbor' nodes in the pathfinding algorithm. To be able to do this, I need a procedural manner to precalculate the maximum capabilities of motion from a given game object at a given location. I am having a difficult time with one specific aspect of this I cannot, for the life of me, figure out how to test whether or not a game object will be able to successfully jump to a given platform from where they are standing. I know there's a way to express this in some manner of equation, but I cannot find what the proper equation would be, it's probably in the vein of projectile physics, but the answer eludes me. If anybody can shed some insight into the matter, I would be very grateful.


How do I properly use multithreading with Nvidia PhysX? I'm having a multithreading problem with Nvidia PhysX. the SDK requires that you call Simulate() (starts computing new physics positions within a new thread) and FetchResults() (waits 'till the physics computations are done). Inbetween Simulate() and FetchResults() you may not "compute new physics". It is proposed (in a sample) that we create a game loop as such Logic (you may calculate physics here and other stuff) Render Simulate() at start of Render call and FetchResults at end of Render() call However, this has given me various little errors that stack up since you actually render the scene that was computed in the previous iteration in the game loop. Does anyone have a solution to this?


Browser sandbox for object interaction testing I m looking for a sandbox where I can upload import STL or OBJ files (rigid bodies that I can export from a CAD software) for quick interaction testing with gravity and contact. The idea is lowest friction possible for import upload so that the time between file export from CAD software to testing of joints and such will be as quick as possible. So things like creating a sandbox template in Unity and then building the game every time would be out of the question. Any ideas?


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


car crash android game I'd like to make a simple 2d car crashing game, where the player would drive his car into moving traffic and try to cause as much damage as possible in each level (some Burnout games had a mode like this). The physics part of the game is the most important, I can worry about graphics later. Would engine like emini or box2d work for this kind of game? Would Android devices have enough power to handle this? For example if there were about 20 cars colliding, along with some buildings, it would be nice if I could get 20 fps.


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.


Player moving up, is he jumping or climbing? In a 2D physics based platformer game that has ladders in it, how do you determine whether the player moving up is caused by a jump or him climbing a ladder, such that you know what animation to play? And in general, obviously the direction vector is not enought to determine the animation to play how do you also determine the cause of the movement (so you know the correct sprite to use)?


Simple 2D hair simulation manipulation I would like to simulate very simple hair in a 2D environment, and will need to be able to "brush" the hair. What I want to do A 2D character is facing squarely towards the player. The player can then brush the character's hair. Think of a little girl brushing her doll's hair into different styles. In my preliminary Google searches, I found many 3D, super optimized hair simulations for tens of thousands of hairs, which are far more complicated than I need. I only need 100 500 hairs, and they only need to react to "brushing" by the player. How might I do this?


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"


How to achieve realistic fake physics? In my opinion, games that are most entertaining to watch and play implement fake physics, the difficult issue is how to implement the fake physics and still allow it to appear realistic. Most popular car driving games implement this really well. Question Anyone has any tips or know of anywhere I can learn more about how these are implemented? Long Story For example, Need For Speed is entertaining when the player car crashes into the computer car, but it would not be fun if we land off the track each time the player collide. In the game, it is obvious that some game logic is in place to steer or land the player car upright, face correct direction and on track most of the time even after a massive collisions. The game instead causes the computer car to suffer heavier damages like flying of the screen after many spins etc to enhance effects. As another example, suppose at a time instance, a speeding player car is driving at the close rear left of a computer car and real physics dictates in the next time instance the player will definitely bump into the computer and lose speed and control. Then at this point, the player could steer right to avoid the car, or steer left to bump into its rear. In an entertaining game, we may still want the player to avoid the front car completely if he steers away and experience an exciting near miss. In NFS, this experience appears to be implmented in a few ways such as player auto steer avoidance, scraping pass and rebound to right of computer, computer car steer away to avoid, computer gets hit but lose control and spin off track to give way to player. On the other hand, it the player steers to engage in a collision, we want to add excitement to spin the computer very badly but still keep the player on track with a good speed. In NFS, these fake collisions and steering are not easily noticeable as they feel very realistic even though if we study them closely, it looks almost like the are scripted. One method I have tried is to determine the final state of collision and then compute the path backwards. But this only ensures the car is in a desired final state, does not address the realism.


Check gap in 3d environnement I am in a 3d environnement, when I jump, i'm calculating the hitPoint of the end jump. I want to know when I jump, if there is a GAP between my initial point, and the end point. But I don't want to set any trigger in the Level Design... My Initial Idea is to do Raycast each 5 6 steps, but I wonder if this is too much cost effective. MayBe it isn't ?


Can this script be edited to create a "shotgun" type spread when firing? Top down shooter I have this code and I'd like to add a shotgun to the game by slightly modifying the code. I've looked online for any example but everything I find is for FPS not a TDS. void Shoot () timer 0f gunAudio.Play () gunLight.enabled true gunParticles.Stop () gunParticles.Play () gunLine.enabled true gunLine.SetPosition (0, transform.position) shootRay.origin transform.position shootRay.direction transform.forward if (Physics.Raycast (shootRay, out shootHit, range, shootableMask)) EnemyHealth enemyHealth shootHit.collider.GetComponent lt EnemyHealth gt () if(enemyHealth ! null) enemyHealth.TakeDamage (damagePerShot, shootHit.point) gunLine.SetPosition (1, shootHit.point) else gunLine.SetPosition (1, shootRay.origin shootRay.direction range) I have a basic understanding of most of this code. I don't quite understand how shootRay.direction understands transform.forward means always the front of player. As DMGregory stated adding a variable of some sort that runs through a for loop firing multiple different angles (or simply different coordinates if making angle rays is over my head) is the route I first thought of but I cannot find a way to implement it. I'm having issues with understanding how to manipulate ray coordinates because they cannot be changed by floats which is the extent of my current knowledge of problem solving.


How would joints work in an impulse based physics engine? I want to learn about physics engines, especially impulse based ones. So I've followed along this tutorial to create some simple rigid body physics http gamedevelopment.tutsplus.com tutorials how to create a custom 2d physics engine the basics and impulse resolution gamedev 6331 I've got this working and it seems pretty solid to me. So I wanted to add revolute (fixed) joints. I've started off with a simple structure struct Joint RigidBody A One body Vec2 AnchorPointA A's anchor point's offset (0,0 if center) RigidBody B The other body Vec2 AnchorPointB B's anchor point's offset (0,0 if center) I'm guessing this would do the job. Now... I'm not too good with physics (hence I started to code this) so I started out what I thought would work RigidBody A joint gt A RigidBody B joint gt B Rotate the anchor points based on the body's rotation Vec2 ancha A gt BodyShape gt Transform joint gt AnchorPointA Vec2 anchb B gt BodyShape gt Transform joint gt AnchorPointB The relative positions of the 2 points Vec2 relativeVel (B gt Position B gt Velocity anchb) (A gt Position A gt Velocity ancha) Apply a force towards eachother, pulling at the anchor points B gt ApplyImpulse( relativeVel, anchb) A gt ApplyImpulse(relativeVel, ancha) This approach simply pulls the bodies together. And it works... Kind of. After the bodies slide together as the joints are set up, it looks ok, but when the bodies fall they tend to spin away from eachother or start to freak out (keep rotating). After messing around with the code (which was getting worse and worse as I was changing it) I've tried to look up solutions on the internet or at least some hints. I've found this How can I implement revolute (hinge) joints in a 2d physics system? But this approach does not apply impulses, it fixes position. Wouldn't be an impulse based system better? How can I fix it? I don't even know how big forces should I apply (I guess it should be based of the distance or something like that and also for the masses of the bodies). Thanks for any help!


How to handle physics of moving platforms in a platformer? So after a few hours of searching on the internet, I have yet to find a pleasing answer on how to handle moving platforms in a 2d platform game. So I decided to make a simple prototype where you interact with 2 different platforms, one that moves vertically and one horizontally. I would love some help to dissect and see what isn't working, and how to fix them. I have submitted the .fla file .as file below, accompanied with a link to the playable .swf. The goal is to make the Hero interact with the platforms as if they were solid objects that he can stand on, pushed alongside with, jump on under etc etc. The problems with my prototype are these When you stand on the horizontally moving platform, without moving (not touching any keys), the Hero moves along with platform, but with a slight delay causing hero to slide back a little. When you stand on the horizontally moving platform, and jump, you move along with the platform midair (some games prefer having it like this, but it doesn't feel natural and is not wanted here). Which might be caused by the Hero retaining the velocity on the X axis from the platform. When you jump up to the bottom side on the vertically moving platform, whilst the platform is moving downwards, you sink inside it for a brief second. Hero penetrates through as if the collision was non existent for a moment. When you jump on vertically moving platform, the veloctiy on Y axis is retained, so when you walk off the platform, you fall down at a higher speed. With the speed of the retained velocity, gravity that is added (this is mostly because I cant figure out a way to reset velocity on Y axis to 0 when you land on the platform, without the player freezing midair). I'm a novice programmer so I am sure there are BETTER ways to do this, and I would love to hear them all. Any ideas on how to improve the code or other methods in which you can implement moving platforms into a Tilebased game are welcome. In the end, I am trying to find a solid way to handle moving platforms in 2d platformers. Playable SWF http dl.dropbox.com u 28271061 PlatformerhowtoFLA.html (Move with arrow keys, Jump with X key, Run with Z key) Sourcecode AS file http dl.dropbox.com u 28271061 Platformerhowto.as SourcefileFLA http dl.dropbox.com u 28271061 PlatformerhowtoFLA.fla If you prefer just to read the code through Pastie online http pastie.org 2266764


Client side prediction physics I'm trying to build a simple networked game and I'm having trouble keeping a jump in sync on the client and server. I've read the free gaffer on games articles and it's helped somewhat but I'm still not completing grasping the theory behind how to keep physics in sync. Right now I have a character that can move right and left. This is kept in sync perfectly by sending all of the inputs and then relaying them to the clients. For the jump command.. I send a packet indicating that i'm jumping. The client then predicts the jump The server begins to simulate the jump and tells the other clients that client X is jumping that then gets simulated on their clients The issue is that if I keep on jumping on the spot eventually the jumps will begin to overlap. I came up with some makeshift solutions to that, but realized that if I started moving and jumping at the same time it wasn't simulating everything perfectly and sometimes the player would land on the tip of a platform on one client and miss it on the server other client. Right now everything is being done locally so there's virtually no lag. I figured the reason it's becoming out of sync is because of jitter. I'm just a little confused in figuring out how to fix this. How do I get it so the client side prediction is 100 perfect in a local environment when incorporating physics?


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.


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!


Server side physic simulations with hundreds of players I m currently working on a singleplayer physics orientated game where I would like the physics to be simulated server side. This because the game will have leadersboards, persistant player progression, etcetera and I want to prevent any type of cheating basically a pure client server architecture, the client is dumb and only displays what the server wants you to display. The problem however is that the game will most likely be played by hundreds (maybe thousands) of people at the same time. This concerns me, as it will most likely kill server processing power if I have to do and maintain hundreds of states at the same time. I would have no problems moving all of the physics simulations to the client side, but then I would really need a way to validate if the result of a client simulation is valid. However, I can't figure out how. I have thought about running the simulation server side once in a while to validate if the client is still playing fair, but I really want the server to have as less strain as possible. Physics will become about as complex as the GDC 2011 demo by Glenn Fiedler, maybe even simpler. However, a lot more always colliding rigid bodies will be in a single scene and they will all be visible at once. I have a hard time getting an answer to this particular case, as most resources on the web again, Glenn Fiedlers site being a great one speak about small scale networked physics (eg. a FPS with 30 players, like Halo). Any advice, websites, papers or the like on the subject will be very appreciated. A recap of the questions I would like an answer to How feasible is a client server model? Is my server processing power concern legit and grounded? Is it possible to reliably validate a physic simulation run by the client on the server? If so, how?


Circle Collision Resolution and Angular Momentum I have a 2D engine working pretty well that involves rectangles and circles. I just reworked parts of the collision detection response system for better handling of angular speed momentum. The collision response algorithm I'm using is described here http www.myphysicslab.com collision.html (the complicated "j ..." equations towards the bottom of the page under "Physics of Collision for Rigid Bodies in 2 Dimensions"). Everything's working great, but I'm wondering about circles. No matter how another another rectangle or circle hits a circle, it's impossible for the circle to gain angular speed through a collision, since the collision normal vector is always perpendicular to surface of the circle. This makes sense to me mathematically, but it goes against my real life intuition. For example, in the picture below, if I poke a ball on the side with a rectangle (tangentially, not towards the middle of the ball), I expect the ball to start spinning (counter clockwise in this case). Why isn't this happening for me? Do I need some kind of non instantaneous collision (deformation maybe?) to experience this effect? If so, is there a way to "fake" it? (Realistically! I don't want to mess up the realistic linear angular momentums and energies of my system!) Thanks in advance for the help!!


Calculating collision of polygons Say I have a multitude of 2D polygons floating about on a plane. These polygons can have any side count and aren't necessarily regular. Assuming I know absolutely everything about the polygons (area, collision point, location, velocity, rotation, angular velocity... etc) how to I calculate what happens to two polygons after collision? I.e. what will their resultant velocities and angular velocities be after collision? If not an exact solution, what resources could help me learn how to accomplish this?


Destructible Terrain like worms I have to develop a game with a dynamic destruction of the map, I searched the internet and even looked at some questions regarding this topic on this Website, but they did not help me much out. I made the map with tiled and used box2d to make collision between the game objects. As a game engine we have to use Libgdx, but I dont know how to start as I had never develeped a game before, can someone give me any tipps how I could start? with regards,


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?


Making AI jump on a spot effectively How to calculate, in 3D environment, the closest point, from which an AI character can jump onto a platform? Setup I have an initial velocity V(Vx,Vy,VZ) and a spot where the character stands still at S(Sx,Sy,Sz). What I'm trying to achieve is a successful jump on a spot E(Ex,Ey,Ez) where you have clicked on(only lower or higher spot, because I've in place a simple steering behavior for even terrains). There are no obstacles around. I've implemented a formula that can make him jump in a precise way on a spot but you need to declare an angle the problem arise when the selected spot is straight above your head. It' pretty lame that the char hang there and can reach a thing that is 1cm above is head. I'll share the code I'm using Vector3 dir target transform.position get target direction float h dir.y get height difference dir.y 0 retain only the horizontal direction float dist dir.magnitude get horizontal distance float a angle Mathf.Deg2Rad convert angle to radians dir.y dist Mathf.Tan(a) set dir to the elevation angle dist h Mathf.Tan(a) correct for small height differences calculate the velocity magnitude float vel Mathf.Sqrt(dist Physics.gravity.magnitude Mathf.Sin(2 a)) return vel dir.normalized Ended up using the lowest angle (20 degree) and checking for collision on the trajectory. If found any increase the angle. Here some code (to improve the code maybe must stop the check at the highest point of the curve) Vector3 BallisticVel(Vector3 target, float angle) Vector3 dir target transform.position get target direction float h dir.y get height difference dir.y 0 retain only the horizontal direction float dist dir.magnitude get horizontal distance float a angle Mathf.Deg2Rad convert angle to radians dir.y dist Mathf.Tan(a) set dir to the elevation angle dist h Mathf.Tan(a) correct for small height differences calculate the velocity magnitude float vel Mathf.Sqrt(dist Physics.gravity.magnitude Mathf.Sin(2 a)) return vel dir.normalized Vector3 TrajectoryPoint(Vector3 startingPosition, Vector3 startingVelocity, float n ) float t 1 60 seconds per time step Vector3 stepVelocity t startingVelocity m s Vector3 stepGravity t t Physics.gravity m s s return startingPosition n stepVelocity 0.5f (n n n) stepGravity bool CheckTrajectory(Vector3 startingPosition,Vector3 target, float angle jump) Debug.Log("checking") if(angle jump lt 80f) Debug.Log("if") Vector3 startingVelocity BallisticVel(target, angle jump) for (int i 0 i lt 180 i ) Debug.Log(i) Vector3 trajectoryPosition TrajectoryPoint( startingPosition, startingVelocity, i ) if(Physics.Raycast(trajectoryPosition,Vector3.forward,safeDistance)) angle jump 10 break restart loop with the new angle else continue return true JumpVelocity BallisticVel(target, angle jump) return false


Manipulating time in Unreal messes up Physics simulation? I'm trying to achive a Super Hot like gameplay, where the time only flows when the player moves. But when I stop time, then restart it, physics simulation will be messed up. Like Cloths starts flying around like they are in a tornado. Rigidbodies fly away, like they were shot from a cannon. All of these without any kind of forces being applied to them. They were just standing still, I stopped time, then I restarted Time and Booom, rigidbodies fly around. I use this in the player's Tick method auto settings GetWorld() gt GetWorldSettings() settings gt SetTimeDilation(timeScale)


2D Ragdoll should it collide with itself? I'm working on a ragdoll fighting game as a hobby project, but I have one dilemma. I am not sure if my ragdoll should collide with itself or not, i.e. if ragdoll's body parts should collide. 2D world is somewhat different than 3D, because there are several layers of stuff implied (for example in Super Mario you jump through a platform above you while going up). The setup I'm currently most satisfied with is when only the parts which are joined by a joint don't collide, so head doesn't collide with neck, neck with chest, chest with upper arm etc, but the head can collide with chest, arms, legs. I've tried every different way, but I'm not content with either. Which way would recommend me to go?


Why is the drag force multiplied by the inverse normalised velocity vector? In pure physics texbooks, I'm seeing this formula to calculate fluid drag force It is clearly stated that it should be opposite to the velocity. Now to me that means, in pseudocode fd get drag(v) using the above formula if v lt 0 fd fd That is, if the velocity is negative the drag should be positive, so we invert the returned value. However, in game code, game physics books and tutorials, I see people doing drag v drag.normalise() fd get drag(v) fd drag That is, we multiply the drag force by the (inverted) velocity unit vector. This to me is logic in regard to the sign, but also it scales down the drag force by a factor between 0 and 1. Which one is correct, and why? PS to be noted, normalisation involves square root, multiplications and divisions, so it's more expensive than a conditional check and subtraction.


Algorithm for simulating collision between circles of different mass First of all, I'm not sure if this is the right site for this question, as it's actually a game I'm developing. However, I thought that this would be a common thing to need to know in games, so I put it here. I'm programming a physics simulation in which I have a list of balls that are moving around. They have different masses and radii. I am trying to find an algorithm to make them bounce off each other when they collide. I've googled the problem and found lots of solutions for when the balls are the same mass (such as billiards), but none for different mass balls. It's not essential to the question but I'm programming this in JavaScript using p5.js


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


Physics simulation methods for large delta times? What physics simulation methods are most suitable for really big delta time (hours to weeks)? In addition, would I face any problems combining different methods for big and small delta times?


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.


Mobile Physics and movement actions I've been using spritekit for a while for a few small games. One thing I've noticed is that spritekit is the first game framework I've used that allows me to apply move actions to physics bodies. (without anything screwing up at least.) Are there any cross platform game frameworks I can use that allow move actions on physics bodies? Not impulses. I've used cocos2d in the past and when I tried ccmoveby on physics bodies the simulation would get totally confused. I rather not use cocos2d anyway. I'm asking because I want to make cross platform games and spritekit is iOS only.


How do I create interactive grass like this? I would really like to create grass that reacts to the player's movements, so when they walk through, it moves away from them, just like this https www.youtube.com watch?v 5Gc Ue9 xgk https www.youtube.com watch?v tFgyc8iykLk The problem is, I'm not sure if this is a case of animation, combined with some form of physics, or controlled by a script. The grass looks like 2 planes that are crossing each other and originally I was going to try a LookAtPlayer script, however that would just make the planes spin around to face the player, instead of swaying in the wind, or swaying away from the player when they walk past them. Any advice on how to create something like this with grass?


How is structural analysis done in games (e.g. bridge building, Dig or Die, and 3D)? From what I understand a typical interactive truss system would need substantial calculations since every component affects the entire system. I think you could arbitrarily stop at a given number of iterations at cost of accuracy in the simulation, but I don't know if that's the approach these games use (bridge building games are an example of truss systems). On the other hand, games like Dig or Die have a quite complex structural system that also takes torque into account (I believe) and compression and is very fast and works on very extensive systems. I guess the basic calculations could be similar, but if not I'm interested in both approaches. Do you guys know how these are made? Do they have an arbitrary limitation or do they use a different algorithm altogether? Also, I guess whatever you guys come up with can be applied to 3D systems but if not or if it's not obvious please at least give a clue on how you could use it for 3D since I'm interested in this for both 2D and 3D games. I know I'm not supposed to thanks here but I find unfair not to at least thank you for your time in advance, I hope this paragraph don't get removed. EDIT If I were to make a guess I'd say Dig or Die stores vectors for each block and then run an iterative algorithm up to a point that the extra accuracy in the simulation is meaningless for the limits of the system (for example, the system would be too large to not collapse anyway), so it's limited by a semi arbitrary (because it's based on application) number of iterations. But I could be wrong.


Calculate impulse need on object to throw i Y meters into the air, with varying mass Say I have an object that has a variable mass. Now I want to apply a vertical impulse (straight up into the air) onto the object, so it always flies up to the same height. How do I calculate this? So the variables are m mass Y height (constant) If Impulse force G Gravity The origin is always from a floor, so no mid air impulses or anything. (I'm using the Box2D engine, but I think that a solution would be engine independent?)


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.


Multiplayer client side physics I'm trying to handle all the physics on the client and correct data on the server. e.g. Client 1 wants to move right Server broadcasts that Clients simulating Client 1's movement Client 1 sends it's coordinates to the server (every 100ms) Server validates coordinates based on client's last position and last update (which is stored on the server) Server corrects Client 1's coordinates on every client But when FPS lt 60 players are moving faster than they should, which causes server to teleport them back. My question is basically how to check x,y without teleporting players with high latency (or low fps). Server var now Date.now() var clientX ...x position sent by client... var clientY ...y position sent by client... var timeDiff Math.ceil((now player.lastPositionUpdate) 5) 5 var timeDiff timeDiff gt 1000 ? 1000 timeDiff var pixelPer100 player.speed 10 var maximumPixelDiff (pixelPer100 100) timeDiff player.lastPositionUpdate now if (clientX gt player.position.x) var diff clientX player.position.x newX player.position.x (diff gt maximumPixelDiff ? pixelPer100 diff) ..and more Client update function() player.body.velocity.x player.speed tick if (tick 6) tick 0 sendPositionToServer() I'm using Phaser with Arcade Physics.


Physics engine deltaTime and force acceleration I am working on a physics engine that uses basic Euler integration to compute forces. So, here is the thing function applyForce (rigidbody, force) rigidbody.forces.add(force) function computeAcceleration (rigidbody) rigidbody.acceleration rigidbody.forces mass rigidbody.velocity rigidbody.velocity rigidbody.acceleration time.deltaTime The forces are reset after each gameloop So now imagine I want to apply a force to jump, I will use applyForce at the moment the player presses the jump button. But What happens is that the amount of movement depends on the gameloop speed, since the force is applied for a single frame. I feel like I missed something about how you should use forces, but I don't see how I should manage it properly. In which cases should we use a force, considering this deltaTime issue? And also, what should I use instead?


Friction due to gravity in an impulse based physics engine In my physics engine, I'm using impulses to solve collisions. I'm basing all calculations on these equations impulse desired velocity change mass impulse force time friction force lt normal force coefficient If an object moves along flat ground (infinite mass), after integration it'll be moving slowly "into" the ground due to gravity. This means that the impulse needed to react to that (given the restitution equals 0) will be the velocity in the direction of the contact normal, multiplied by mass. The issue here is that gravity is a constant acceleration, which means that the object, no matter the mass, will always "dip" by the same amount given a constant frame rate. So the mass is never a factor in this situation, outside of the impulse calculation, which is just a flat velocity change. Now, I can use impulse to calculate the force that was needed to react to the collision, this force can then be used in the friction equation as such friction impulse time lt normal impulse coefficient time Since time is always greater than 0, I can just multiply both sides by it, and then I can use the impulse equation, as such planar velocity change mass lt velocity change along normal mass coefficient And again, I can just remove mass from the equation, which leaves me with planar velocity change mass lt velocity change along normal mass coefficient This is the desired velocity change along the contact surface due to friction. The issue is, obviously, that none of this depends on mass, which means that no matter how heavy or light an object is, it'll always continue sliding along the surface by the same amount given a constant initial velocity. What am I missing? It really looks like there's a logical mistake here. Should the dynamic friction depend on the mass in the first place? Moving a heavy object requires higher force, so static friction should be modeled properly, since it just flat out removes velocity, though it'd be nice to hear if this has merit or just "looks good".


What is a good algorithm for generating a linear regression of positions in 3D space? (for getting the direction of a thrown object in VR) I'm trying to get throwing to feel right in my VR game. I don't plan on actually using physics to do this my idea is to accurately determine the lateral direction of the throw, then move the object in the intended direction (with a doctored Y value) at a speed dependent on other factors. The language of the code doesn't matter too much, but I'm using Godot, so something that wouldn't require me to import a bunch of different math libraries (by converting them to Godot's Python style GDScript) would be ideal. It doesn't need to be robust. To give you an idea of what I was thinking, my original plan was to save the position of the grabbing controller every frame while an object is being held, removing old positions if the controller is moving backwards, then averaging out the movement deltas over the last 10 or 15 frames or so before letting go (it should be consistent since Godot has a fixed timestep "update" function available) and normalizing the vector to get the direction the object should travel in. However, this blog post got me thinking that spending the time learning how to do the linear regression in a more robust way, then applying that to 3D VR, might be worthwhile. I just wonder if, since I don't need the actual linear or angular velocity, it might be overkill in terms of time spent on the feature.


Fixed physics time step and input lag Everywhere I read says I should fix the time step of my physics simulation, and interpolate the result to the actual frame rate of my graphics. This helps with simplicity, networking, reproducibility, numerical stability, etc. But as I understand it, fixed time step guarantees between 1 and 2 t of input lag, because you have to calculate one step ahead in order to interpolate. If I use 90 Hz physics, it gives me an input lag of about 17 ms, on average. Since I often see gaming enthusiasts talking about 1 ms input lag, 1 ms delay, and how that makes a difference, I wonder how fast action games does it, and how they reduce the input lag using fixed time step. Or they don't, and 1 ms delay is just marketing mumbo jumbo?


Creating stable tentacle structures I am using verlet integration to simulate some tentacles. So far it works great and I am satisfied with how it looks in general. Here is how a tentacle is built The very stiff sticks are colored red, in addition I added angular constraints of 180 in order to keep everything together. But still, sometimes this happens When forces are too big at the peak, it flips around and gets stuck in a very ugly state. Of course I could increase the number of iterations for satisfying the constraints, but then the tentacles get too stiff and the performance suffers. What can I do about this? Some ideas add more points at the peak more constraints overall limit possible forces maybe rethink my tentacle design completely? detect flip over and undo it


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 to handle jumping up a slope in a runner game? In an 2D endless runner, what should happen when the player is running "too fast" up a slope and jumps? For example, in a "normal" case .O. . ..O . . O If he is moving to the right slowly enough, he will jump upwards and land on the flat part of the surface. However, if he is moving too fast, the jump will have no effect as his forward motion will bring him back in contact with the slope before he can get high enough to pass over it. When the speed is sufficiently high, there will effectively be no jump. .O O Are there any known ways to solve this issue? I know it's physically correct , but are there techniques that other games use to overcome this in a reasonable manner? As a last resort I'll have to just remove all slopes that are too slanted. If you constrain the player to never jumping backwards.


How to make a smooth projectile in roblox? I am trying to make a projectile (Energy ball) for my game. I am using body velocities, but the issue is is that it seems laggy. I shoot it then half a second through flight it seems to stop in mid air for a quarter of a second then continue. This only happens the first minute of playing. Here is my code local Motion Instance.new("BodyVelocity", Ball) Motion.Velocity ((MouseClickLocation Player.Character.HumanoidRootPart.Position).Unit 100) Why is the described behavior happening and how can I make it never happen?


Platformer gravity where gravity is greater than tile size I am making a simple grid tile based platformer with basic physics. I have 16px tiles, and after playing with gravity it seems that to get a nice quick Mario like jump feel, the player ends up moving faster than 16px per second at the ground. The problem is that they clip through the first layer of tiles before collisions being detected. Then when I move the player to the top of the colliding tile, they move to the bottom most tile. I have tried limiting their maximum velocity to be less than 16px but it does not look right. Are there any standard approaches to solving this? Thanks.


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.


Orbital mechanics orbit as a function of time. Universal variable formulation? I am trying to model a two dimensional orbit for a two body Kepler problem but have gotten stuck when introducing the time variable. For a satellite with known semi major axis (a), eccentricity (e), and true anomaly (theta), I have r a (1 e 2) (1 e cos(theta)) How can I calculate theta as a function of time using the Wiki suggested Universal variable formulation method? I have no idea how to implement (am using Python but any algorithm advice much appreciated!) Alternatively, how do I calculate r as a function of time? Note All other orbital elements and masses are available. Also I am trying to come up with a general solution for elliptical, hyperbolic and parabolic orbits. Cheers!


Simulating elastic ball collisions quickly escalates to disaster I'm trying to learn HTML canvas and was working on a basic physical simulation, where a number of balls are drawn and set in motion, and the program simulates them colliding and bouncing off the walls and each other. Here's the simulation. Each ball is initially given a random position, direction, and a constant starting velocity. For simplicity, a ball's mass is simply equal to its radius. The velocity vectors are stored as (x,y) instead of polar coordinates to make the calculations simpler and the simulation faster, but this apparently has unintended consequences. In the simulation linked above, I'm starting with ten balls, and each ball has an initial velocity magnitude of 3, so the total initial "speed" of the system should be 30 ( 10 3). On each frame, I calculate the total speed of all the balls and read it out in a form field, and with uniform balls of size 10, the total speed seems to stay a few units under 30. The same is true of the min and max radius are decreased so all the balls are size 5, or increased to 20 the total speed stays relatively uniform. However, interesting things happen when the balls vary in size. If the minRadius is changed to 5 and maxRadius to 15, for example, you'll notice that the total speed of the system starts climbing over time. The bigger the difference, the faster the speed grows out of control. SO my first guess is that I screwed up the physics, but I can't figure out how. My other guess is that this is caused by accumulating floating point error, but it's interesting that it only grows upwards, and never towards zero. Also, it does seem to have a limit while it constantly fluctuates, it seems to be capped at some value related to the delta between the minimum and maximum ball size. My question is really to understand why this is happening? Did I just screw up something simple, or is something more sinister going on?


GGX specular BRDF is way over 1! Now, the classic Torrance derivation for roughened surfaces which Cook took into vectorized form yields the familiar parametrization of a specular BRDF where we have the NDF which decides how much perturbation is around the average normal direction of the macrosurface. For example, in the isotropic GGX version, an alpha value is used to modulate just how rough the surface is or just how much specular reflection a partical halfdirection yields from the microsurface normal. Then there's the geometry term which is, numerically, a protective term from the classic denominator of dot(n,v) dot(n,l) which can tend to zero and the whole term to infinity. It also has a more physically intuitive side rendered irrelevant by the sheer horror of division by zero. And there's the Fresnel term, the least threatening of all of them. Basically, it's DGF (4(n.v)(n.l)). And if any of these terms fail, it goes to hell. Hence, all of these terms have normalizing terms which force them in the 0,1 range. Unfortunately, the one I was studying from Epic does not converge give in to the normalization and some values at grazing angles get frustratingly high. The BRDF is the ratio between the outgoing radiance and the incoming irradiance. Anything beyond 1 is weird to me. But 477.43 is... Well... I've double checked everything, the math is a direct match. And yet... Any ideas?


Cloth tool and Skeletal Bone Weight Paints in Unreal Engine Just a quick question I've got my 3rd person rigged and skinned, but I have some hanging fabric around the characters waist which drapes down to the characters legs. Should this fabric be weighted so that it is affected by the characters legs as they are animated, or just the bones around the waist area? My thinking is that I don't want the cloth to be affected by the legs, as the cloth simulation will take care of that for me. Instead the aim should just be to make the cloth orientate with the bones in the waist area, mostly quot spine quot and quot spine1 quot . As such I should just skin the cloth to the lower spine bones, and ignore the legs. If I am incorrect, I'd appreciate any correction, and my apologies for any incorrect terminology, I am still learning. Cheers!


Apply force to a specific point on a rigid body In unity I have a rigid body object and would like to apply force to a specific point. For example say I had a cube, I want to hit just the top right corner so it spins as a result. One idea I had considered is spawn a small sphere and fire it at it, then destroy the sphere. But is there a way to just apply the force?


Run a physics simulation on both client and server? I'm implementing a multiplayer asteroids clone to learn about client server network architecture in games. I have spent time reading GafferOnGames and Valve's publications on their client server tech. I am having trouble with two concepts. Currently I have an authoritative game server simulating physics with box2d and sending out the state of the world to clients about 20 times per second. Each client keeps track of the last few snapshots it received and lerps between two states to smooth out the movement of sprites. However it's not that smooth. It can be smooth for a while, then jerky a bit, then back to smooth, etc. I have tried both TCP and UDP, both are about the same. Any idea what my problem might be? (Note I implemented this for single player first, and the sprite movement is perfectly smooth at 60fps when updating the physics world only 20 times per second). In order to solve the first problem I thought maybe the client should run a box2d simulation as well and just update the positions of its sprites to match the server snapshots when they don't match. I thought this might be smoother since my single player implementation is smooth. Is this a good idea? Even if it won't fix the above problem, is it necessary for client side prediction? For example, if a player attempts to move their ship, how will they know if they hit an asteroid, wall, or enemy ship without a physics simulation? It seems like their ship would appear to pass through the object it should collide with before they receive a snapshot from the server that says they hit the object. Thanks!


How can I predict player to projectile collisions in Box2D? I'm making a real time shooting game with Box2D as the physics engine. The gameplay is mostly about trajectory, like Angry Birds. I want to make a slow motion effect and move camera to the player when he's killed, but the effect should start when the stone is still in the air, before the collision actually happens. The magnitude of damage is only calculated at collision, based on impulse. Because it's a real time game, the player must be able to move their character's physics body without lag. How can I predict their death? Is it even possible? I could raycast, but what if another object moves to block its path?


add physics to a group or container body in phaser I'm developing a HTML5 Phaser game. In this game I do have a Group which I would like to behavior as a physics body (arcade physics). It is a character with a lot of moving parts (sprites) inside this group. In this case the group acts like a container for the sprites. However I only able do add physics behavior to a sprite. game.physics.arcade.enable(mySprite) works good! Doing the same to a group does not works. it only add physics to children sprites game.physics.arcade.enable(myroup) does no works myGroup.body.(...) body is undefined I would like to create a "virtual" body to this group, mannually set dimensions for it (body.setSize) and add all my sprites inside it. Is that possible in any another way?


Smooth jumping in 2D platformers I have a very simple 2D game, similar to old school Mario or Metroid. I'm having a lot of trouble figuring out the proper way to handle player jumping. I've tried several different methods. The first method being that as soon as the player presses the space bar, his position on the Y Axis is automatically updated so that he is now 50 pixels higher. This didn't work, because his player model immediately jumped up instead of going for that smooth up down look. The second method I tried was using a Timer. With this, once the player pressed the space bar, his position on the Y Axis would be incremented every x milliseconds. This also didn't work, for the exact same reason that the first way didn't work. It shot straight up without looking smooth. The last method I tried was a resemblance of my movement on the X Axis. Instead of waiting for player input, the Y Axis is constantly being added, but when the player isn't jumping, the yVelocity 0. When input does come in, an amount is added yVelocity and the player jumps up. I didn't expect this to work, obviously, but it looked better. So how do you apply jumping correctly? This is something that I've been struggling with for a while, and I just want to get it right. Please don't confuse this question like this question, as they're both different. I need an efficient way to handle jumping so that he looks smooth (as in one motion) going up and down. I can make his falling look good, just not the going up part. Can anybody explain to me how they make jumping look good? Note I wrote this question without code because I want a general description of how one might do it. If you do need code or extra details, or anything to understand the question, I'll be happy to add any extra details that you might need.


Box2D Love2D (Lua) Assertion fail with polygon meshes When I try to create a triangle collider for my game it sometimes leads to an assertion fail. I use the physics engine that comes with love2d (Box2D). That's the error message that appears when the assertion fails love modules physics box2d Source Collision Shapes b2PolygonShape.cpp 85 b2Vec2 ComputeCentroid(const b2Vec2 , int32) Assertion area gt 1.19209289550781250000e 7F' failed. Here's an example of a triangle that doesn't cause the error (represented by a table with 3 points) 258,451 , 740,767 , 284,597 And this one leads to a crash 258,450 , 222,569 , 306,723 The bodies of both shapes lie at 0, 0 (upper left corner of the screen) Does anyone know a possible reason and or solution for the problem? Edit I'm not allowed to answer my question right now for some reason so I'll post the answer here before I've forgotten it In Box2D, the order of placement of vertices seems to play an important role, since I was able to avoid the crash with the "problematic" triangle in my example from my question just by placing the first vertex between the second and the third one. Maybe I'll repost the answer when I'm able to provide more information (and am also allowed to do so)


PhysX Revolute joint around unit vector I'm using a right handed coordinate system with (0,0, 1) forward, (1,0,0) right and (0,1,0) up. PhysX version is 3.3.0. I have a unit vector which represents the axis around which my actor is supposed to be able to rotate, (0,1,0). The problem is, if I build a quaternion rotation from that vector, like so physx PxQuat q (0, physx PxVec3(0, 1, 0)) and use that for the joint, the actor will actually rotate around the direction of the rotation around the axis http youtu.be pXMlRRBVOpc However, what I want is this http youtu.be MlBx hC1Z9Q In the second case I used (0,0,1) as axis and 90 degree as rotation and used that to build the quaternion. So, how can I use my axis (0,1,0) and actually get the rotation as shown in the second video?


How do you apply relativistic physics to a 4x strategy game? I had the big idea of trying to create a hard science fiction 4X strategy game (with the obvious space setting), which is supposed to simulate a realistic way of creating interstellar societies while simulating real life physics as well. The problem is how do I apply Einstein's relativistic equations into the game? I will make a separate series of questions for other issues, such as applying Keplerian planetary movement and Newtonian combat physics. Do note the game is being made in C and in Unity. Be warned I am trying to simulate special relativity, not general relativity quite yet. That I can try in a different game.


Reimplemented steering seek behavior from PyGame to L VE is much slower than original I'm learning about steering behaviors and watched this nice explanation tutorial https www.youtube.com watch?v g1jo qsO5c4 amp feature youtu.be with the source code available at https github.com kidscancode gamedev blob master tutorials examples steering part01.py. The example app is written in python and PyGame and behaves like The main code parts of it are MAX SPEED 5 MAX FORCE 0.1 def seek(self, target) self.desired (target self.pos).normalize() MAX SPEED steer (self.desired self.vel) if steer.length() gt MAX FORCE steer.scale to length(MAX FORCE) return steer def update(self) self.acc self.seek(pg.mouse.get pos()) self.vel self.acc if self.vel.length() gt MAX SPEED self.vel.scale to length(MAX SPEED) self.pos self.vel ... I tried to reimplement this example in lua with Love2d framework and HUMP vector utility, source code is available at https github.com voronianski on games sandbox blob master src steering seek love2d main.lua. The code is pretty similar with the same constant values of MAX FORCE and MAX SPEED function Mob new () ... self.maxVelocity 5 a.k.a MAX SPEED self.maxSeekForce 0.1 a.k.a MAX FORCE ... end function Mob seek (target) self.desired (target self.pos) self.desired normalizeInplace() self.desired self.desired self.maxVelocity local steer (self.desired self.vel) if steer len() gt self.maxSeekForce then steer steer trimmed(self.maxSeekForce) end return steer end function Mob update (dt) self.acc self seek(vector(love.mouse.getPosition())) self.vel self.vel self.acc dt if self.vel len() gt self.maxVelocity then self.vel self.vel trimmed(self.maxVelocity) end self.pos self.pos self.vel dt ... end But behavior is different. Square is much more slower in lua implementation though the values are the same What could be a problem? Or what is the difference that I couldn't notice?


Why doesn't this 2d physics calculation yield the desired jump height? I found a formula for gravity and jumping in this article http error454.com 2013 10 23 platformer physics 101 and the 3 fundamental equations of platformers I implemented this formula and proceeded to do some test calculations, but they yield incorrect results. I expected the outcome to be 4, but the test resulted in 3.8. What am I doing wrong? How do I get the number 4? float deltaTime 1f 50f float maxJumpHeight 4 float timeToApex 0.44f float gravity (2 maxJumpHeight) (timeToApex timeToApex) float jumpHeight 4 float jumpVelocity (float)Math.Sqrt(2 gravity jumpHeight) float velocity jumpVelocity float position 0 while (velocity lt 0) velocity gravity deltaTime position velocity deltaTime Console.WriteLine("Position 0 ", position)


Tracing a 2d path through multiple gravity fields For a projectile starting at origin O, an initial velocity V, and several stationary planets P n , how would I pre calculate and store the path it would take without actually stepping through each frame along the curve? I have some idea of how to do this for a single gravity source (conic section, parametric curves), but how do you blend multiple forces, and thus multiple curves, together? The idea is to give the player some idea of the trajectory their shot will take, so it doesn't need to reflect the actual path exactly, but the closer the better.


Looking for very simple implicit integration example I am trying to design a robust cloth system. I have no problem at all simulating things like that using forward integration such as euler, midpoint, runge kutta, verlet, etc. However, I just can't wrap my head around implicit methods. I don't understand how you formulate the equations in linear algebra terms. I'd really like to see a VERY simple tutorial, and an actual example of how to construct the equations, and then solve for a very simple system (for example, 3 particles connected by 3 springs). I looked into David Baraff's Large Steps in Cloth Simulation, and I can kind of follow it, but going from equations to code is a weak spot of mine. I can use a package like eigen to solve, but I'd also really like to see some code for something like conjugate gradient descent. I don't care about efficiency at the moment, I just want to be able to clearly understand what's going on. Thanks


How to achieve realistic fake physics? In my opinion, games that are most entertaining to watch and play implement fake physics, the difficult issue is how to implement the fake physics and still allow it to appear realistic. Most popular car driving games implement this really well. Question Anyone has any tips or know of anywhere I can learn more about how these are implemented? Long Story For example, Need For Speed is entertaining when the player car crashes into the computer car, but it would not be fun if we land off the track each time the player collide. In the game, it is obvious that some game logic is in place to steer or land the player car upright, face correct direction and on track most of the time even after a massive collisions. The game instead causes the computer car to suffer heavier damages like flying of the screen after many spins etc to enhance effects. As another example, suppose at a time instance, a speeding player car is driving at the close rear left of a computer car and real physics dictates in the next time instance the player will definitely bump into the computer and lose speed and control. Then at this point, the player could steer right to avoid the car, or steer left to bump into its rear. In an entertaining game, we may still want the player to avoid the front car completely if he steers away and experience an exciting near miss. In NFS, this experience appears to be implmented in a few ways such as player auto steer avoidance, scraping pass and rebound to right of computer, computer car steer away to avoid, computer gets hit but lose control and spin off track to give way to player. On the other hand, it the player steers to engage in a collision, we want to add excitement to spin the computer very badly but still keep the player on track with a good speed. In NFS, these fake collisions and steering are not easily noticeable as they feel very realistic even though if we study them closely, it looks almost like the are scripted. One method I have tried is to determine the final state of collision and then compute the path backwards. But this only ensures the car is in a desired final state, does not address the realism.


Bullet Physics Applying a force at the point of collision Suppose I want to simulate some kind of gripper with two "fingers" (such as pair of pliers, or two fingered robot hand), picking up an object from the ground. Both the gripper and the object are dynamic rigid bodies. I want to start with the object roughly in the centre of the gripper, and then move the two fingers towards the object, to determine the point at which they make contact with the object's surface. Then, I want to apply a certain force from the fingers onto the object, before finally lifting the fingers (and hence the object) upwards. Is there any simple way to achieve this just by treating the two fingers as two individual rigid bodies? I want to just move the fingers towards the object to find the point of collision so can I treat them as kinematic objects (with zero mass so they don't fall under gravity, which is what I want), and move them manually by slowly changing the pose of each finger over time? But how will I know at what point the fingers and object collide, so that I should stop moving the fingers and start applying a force? Thank you!


How to resolve multiple simultaneous ball collisions in a pool game? I'm trying to simulate a break shot in billiards (1 ball hits a pyramid of 15 balls). The formula for 2D ball collision works correctly in my game. But when it is applied to the break shot, the result doesn't look realistic. (Only the 2 balls in the corners of the pyramid move, but the rest stays in place). The problem is that because 15 balls are touching each other, there is an "infinite" number of simultaneous collisions following the first one. What algorithm or formula can be used to resolve that?


Why is the MaskBit maxed out Hi there for some reason the maskbit of my b2FixtureDef is being maxxed out and im not sure why Here is the declaration of the items that are used in the game enum PhysicBits PB NONE 0x0000, PB PLAYER 0x0001, PB PLATFORM 0x0002 Basically what i want is the player to run along a surface is not slow down (i set platform amp player friction to 0.0f) I then setup my Contact Listener to print out the connections (currently only have 1 platform and 1 player) Player Fixture Def b2FixtureDef fixtureDef fixtureDef.shape amp groundBox fixtureDef.density 1.0f fixtureDef.friction 0.0f fixtureDef.filter.categoryBits PB PLAYER fixtureDef.filter.maskBits PB PLATFORM Platform Fixture Def b2FixtureDef fixtureDef fixtureDef.shape amp groundBox fixtureDef.density 1.0f fixtureDef.friction 0.0f fixtureDef.filter.categoryBits PB PLATFORM fixtureDef.filter.maskBits PB PLAYER Now correct me if im wrong but these are saying the following Player Collides with Platform Platform Collides with Player Here is the printout of the fixtures colliding with each other lt Indicates new Contact Platform ContactA 2 MaskA 1 Player ContactB 1 MaskB 2 lt Indicates new Contact Platform ContactA 2 MaskA 1 Player ContactB 1 MaskB 65535 lt Indicates new Contact Platform ContactA 1 MaskA 65535 Player ContactB 1 MaskB 65535 Here is where i am confused. On the second amp third contact the player maskBit is set to 65535 when it should be 2 and there are 3 contacts when i am sure at most there should only be 2. I've been trying to figure this out for hours and i can't understand why it is doing this. I would be very grateful is someone could shine some light on this for me UPDATE I printed out the class of the contacting objects. For some reason it seems to do the following First Contact Correct Result. Second Contact Player b2Fixture Obtains a new maskBit. Third Contact Platform b2Fixture appears to be set to the same as the Player b2Fixture. It would seem I have a memory race condition i think


Game physics of tearing apart For a game I'm programming I'm looking for a kind of realistic mechanic for simulating the tearing apart of objects. Let me explain I have a given point p in a 2 dimensional space (possible later also more dimensions so a solution should be scalable, which i assume is not the problem) and I have a number of forces f1, f2, ..., fn acting on this point p. So normally this point moves over time according to the combination of this forces. But now I'm looking for a kind of realistic mechanic that if forces vary strongly the point objects gets split up in two points objects that move in different directions. Here a simple visual example three quot similar quot forces resulting in one single force (the point will move according to this single vector) three forces that quot tear quot the point apart and result in two vectors (point will be split up in two new points that move according two the respective vector) I amuse we need two give the point some kind of inner force, that defines how easy it is to tear the point apart? By kind of realistic I mean something that doesn't need to be extremely realistic according to the real world physics but something that would fell kind of real in a video game. So an additional benefit would be that it can be easily computed.


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.


Voxel blocks world physic I'm making a game like Minecraft. I have a world made of blocks and I'm trying to implement a basic physic system that applies gravity and checks entities colliding with the blocks of the world. I tried using Bresenham's algorithm, on player move, to get all blocks between, and then get the first solid and set the player on colliding position. That works well if the player is a point, but if it's a complex AABB and the block too, it becomes difficult. Is there a simple way to make physic in a voxel world like Minecraft?


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.


Making a parent system with euler angles (gimbal lock problem) I have a system where objects can be connected to each other as the parent rotates the child objects will rotate too and child objects themself can rotate too. The system is already working, however, I am doing it with rotation matrices. I want to dynamically simulate angular physics and for that, I would need the angular velocity for which I thought the direct and easiest way would be to get the difference of the euler angles. I am still a beginner with those rotation maths like matrices, quaternions etc. The problem is that the rotation of the children would be local and currently I am just adding the euler angle values (which works fine if I only rotate around one axis). So when I rotate a child on the x axis by 90 degrees and then rotate the parent on the y or z axis the system breaks (y and z should be swapped in this scenario with 90 degrees x rotation) As far as I have understood it the problem could be explained with quot gimbal lock quot . Is there a way to calculate the local euler angles? Or is there in general a better way to achieve what I am trying to do here? I have heard that quaternions also don't save 360 degrees, so that would be also a problem for angular velocity.


Performing movement per game tick Assume we have a player on a map, whereby the grid is represented as a floating point. When a player is moving, they have an x and y velocity. How to do you properly apply their movement each gametic? By that I mean do you keep nudging the player forward by one map unit and repeat that by the velocity? Where is that fine line where I say "we don't go any smaller movements than this like 0.5, or 0.25, etc" Further, is there a way to optimize this to be able to make movement fast computationally? I thought of having some kind of blocks where you can quickly check if you'd intersect anything and make some optimizations, but I have no idea if this is good, bad, or how it should be done. Update Suppose you have a projectile traveling 100 map units North, and it would collide with an object 50 map units North of it. In the period of one world 'ticking', would you just halt it in a dead on collision (assuming the line is impassible), or would you detect a collision and then do something after it since that remaining 100 map unit velocity (like maybe if it's on an angle then cancel its Northward momentum and continue trying to move it to the East West.


How to reduce the time it takes to speed up an object? I have a body that I am applying a force to every step. However, I it takes a significant amount of time for it to speed up, which I do not want. Is there some value I can adjust to help with this?


Adding gravity to arrival steering behavior I trying to write an autopilot for the classic Lunar Lander or its clones. According to this paper, the arrival behavior is exactly what I need for a soft landing. In this example, it accelerates at max speed until it's near the target and decreases near the target to zero. Adding gravity and a engine to decelerate makes this a lot more complicated, at least for me since I couldn't wrap my head around the concept for the past few hours. Currently my spaceship moves in the right direction but doesn't counter gravity and just throttles the engine, crashing near the target. I know my current position, velocity and the gravity is constant. I need to output thrust levels (0 4) with a 90 to 90 angle. Can you give me some pointers as to how I could incorporate gravity into this steering behavior?


Can I use physics in Isometric map based games? I am trying to use physics in my game which is an isometric map based strategy game that the player deals with a city full of buildings, roads and people in it. I am writing the game with Swift and SpriteKit technology. (the following picture shows a snapshot of my game) MY GAME I like to use Spritekit's physics library so I would be able to simulate car accidents and preventing them to go throw the buildings and other kind of stuff that physics could provide. I am familiar with Physics and I have enough experience with Bullet and I can write a 3D game using OpenGL ES and physics, but I haven't really used physics in 2D isometric map games. I have also wrote a 2d physic game that was really 2d (an endless runner) which was actually a sample of a book but as you can see in the following picture the gravity vector is the Y axis and every thing is pretty easy. Here is the gravity vector that is used to create the game at the following picture. self.physicsWorld.gravity CGVectorMake(0, 9.8) Someone Elses Game, Book Sample Book Name iOS 7 Game Development Author Dmitry Volevodz You may find the book Here However, in an isometric map game you can't just set and assign the Y axis as a gravity vector. since the method which sets the gravity vector accepts two arguments it is a big hope that I can use physics in my isometric map games. For example something like this I Say!!! As I am still using a cartesian coordinate system (perpendicular axis) X and Y axis make a 90 degree angle and if I need to project the gravity quantity over the X and Y axis it would be gCos(45),gSin(45) I haven't tested it yet. self.physicsWorld.gravity CGVectorMake( 9.8 0.707, 9.8 0.707) May you please help me on setting the gravity vector and how should I define the moving objects like cars and humans and the static ones like buildings any other tips on modelling physics in isometric map are also welcome and appreciated. The main question is is it really possible to use physics in an isometric map based games?


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?


Who know how to implement the 2D bone animation showed in the game? I wonder how do they implement the bone animation in the flash game http www.foddy.net athletics.swf Do you know any study materials which I can start to learn 2D bone system from? I just implemented a avatar system by compose multiple bitmaps in each frame(similar with maple story), but some guys tell me that, a bone system can save more art resources, so I want to learn some thing about that.


2D bouncing ball simulation angular velocity How does angular velocity of a ball affects it's speed after a bounce? I'm trying to simulate 2D bouncing ball physics. I've found a nice solution how to calculate ball's velocity after a bounce mVelocity.x 1 mi (e 1) mVelocity.y e where mVelocity.x is a component of ball's velocity parallel to the "surface" of a bounce, mi is coefficient of friction, e lt 1 representsthe energy loss during the impact. It's looks quite realistic, however I'd like to calculate angular velocity as well and I assume it's also affecting how the ball actually bounces. I tried to achieve it using matrix found on wolfram site http demonstrations.wolfram.com BouncingASuperball (it's in the bottom of the page), but its implementation doesn't look realistic at all, ball is acting very wierdly. How can I calculate it?


How do I implement friction in a billiards game? I'm having trouble implementing friction in a billiards game. Currently, the ball only slows on collision with the edges, but I also want some friction with the background. How can I implement friction? (I'm using PhysicsJS.)


Verlet collision with impulse preservation I came across this article, recently, that presented a technique for impulse preservation with position based verlet integration. What was interesting was that the integration steps are seemingly done differently from typical position based verlet schemes, as well as the ordering of the integration step and collision resolutions. Specifically, the typical verlet position integrator is newPosition 2 position oldPosition acceleration timeStepSquared oldPosition position position newPosition DoConstraints() Where the article has position acceleration timeStepSquared DoConstraints() newPosition position 2 oldPosition oldPosition position position newPosition Which ignoring constraints for a moment works out to be newPosition 2 position oldPosition 2 acceleration timeStepSquared oldPosition position acceleration timeStepSquared position newPosition Which is different in a term of acceleration timeStepSquared. I haven't quite convinced myself that those terms cancel out through the iteration, as the prior acceleration timeStepSquared term may not be the same as the current one. Could someone explain the reasoning for this, and if indeed it makes sense?


How to calculate collision normal between two AxisAlignedBox's? I'm writing a physics simulation in Ogre3D and I'm trying to figure out how to calculate the collision normal between two Ogre AxisAlignedBox's. I am checking for collisions using the "intersects" function then calculating the collision normals as below, but I am almost certain that this is where I am going wrong as my collisions are very unpredictable Ogre AxisAlignedBox intersection boxA.intersection(boxB) Vector firstCollisionNorm boxA.getCenter() intersection.getCenter() Vector secondCollisionNorm boxB.getCenter() intersection.getCenter() After this, I am normalizing the collision normals, calculating the impulse magnitude using dot product, mass and relative velocity, then I multiply the collision normals by the magnitude to get the final impulse force vector, which is added to my current force vector as "impulseForce deltaTime" for the next step of euler intergration. If anyone could help me out I would greatly appreciate it! Thanks


How to make a character in a Box2D world jump faster? I have a question about using Box2D to simulate a physics platformer. I manage to make the character move to the right and left, and jumping as well. However, jumping seems extremely slow when compared to most tile based platformers. Is there a way to speed up the jumping and falling of the player? I of course know from my basic physics lessons that 'heavier' objects don't fall faster in the real world, but is there a way to simulate this in Box2D?


In Godot, how to make a Kinematic body affectable by rigid bodies? Background Info I'm currently following the FPS tutorial from the official site. By the end of Part 1, there is a Player object implemented as a KinematicBody and controlled by player input, and a few cubic blocks scattered around, implemented as RigidBodies. The KinematicBody is moved with the move and slide function that takes static colliders into account, so the player is able to stand on the floor and bump into walls. However, the player can't bump into or stand on the cubes. If you attempt to jump onto a cube, it will slide from under you. If you try to push a cube into a wall, it will glitch around a little, then slide away, without even slowing you down. The cubes have no power to stop the KinematicBody from moving through them. Question How can I change the behaviour to make it possible for a KinematicBody to stand on a RigidBody?


How to disable static friction in Box2D? I'm making a 2D platformer. One of the issues is that when the character hits the ground, there's an initial pause and then the character finally slows down to a halt. I believe the initial pause is because the coefficient of static friction is higher than the coefficient of kinetic friction. How can I set the coefficients to be equal or disable static friction?