Questions tagged [physics]
Relating to the motion of objects through space and time. Including concepts such as acceleration (thrust and gravity), mass, collision response, friction and more.
442
questions with no upvoted or accepted answers
8
votes
4
answers
11k
views
Handling movement on sloped surfaces - clamping character to sloped surface
I've noticed that a lot of people seem to have this issue but I've yet to find an actual working solution - when a rigidbody-based character controller (I'm not using Unity's character controller) ...
6
votes
4
answers
2k
views
Lunar Lander calculating gravity, acceleration and collision in GameMaker
I've already asked this on the GameMaker forums but had no response so far.
I'm making a little Lunar Lander game as my first foray in to GameMaker, I'm wanting to have the ship land and take off ...
6
votes
0
answers
191
views
How can I create a set of collision points for an arbitrary mesh?
In my project I am working on automatically deforming an arbitrary mesh with respect to another arbitrary mesh, within the context of user generated content, similar to this deformer being developed ...
5
votes
0
answers
573
views
3D Physics Engine Collision Response: Solving Simultaneous Collisions via equation
I have been implementing a basic physics engine for a small game project I'm working on. It has very specific requirements, so I decided to try and write my own physics engine to meet them. I found ...
5
votes
0
answers
297
views
Rotation of a ball moving on a surface
I have a ball that moves along a platform. The ball is characterized as a sphere that has a radius and a position. The platform basically is a rectangle consisting of two vertex triangles. Its class ...
5
votes
0
answers
227
views
Sizing a Box2D ground object
I am developing a platformer game using SDL2 for graphics and Box2D for physics.
I am currently designing my levels and would like to know if it is better to make the static part of each level (ie: ...
5
votes
1
answer
167
views
How can I determine "exact moment" of collision with ray casting?
I'm currently brainstorming how the physics for my game engine is going to be handled.
It's top down and I'm thinking of using ray casting for collision detection.
I've reached two potential problems (...
4
votes
0
answers
109
views
Force propagation through physic bodies constraints (as non-penetration)
First, some context
I'm currently implementing a (well, tiny) game engine using a predictive approach. The idea is to compute when a state change will occur, and only update state at time of the ...
4
votes
1
answer
1k
views
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:
...
4
votes
1
answer
2k
views
Disc Golf Physics in Unity
I am trying to make a frisbee golf game, and I am stuck on the physics of the frisbee.
I can get the disc to fly, but I have not been able to add spin or make it act the way a frisbee would in real ...
3
votes
0
answers
163
views
How do you compute for angular spring physics for physics joints in game engines?
I'm working on fixing Godot's physics joints. Currently, it uses Euler angles and it doesn't help me in building active ragdolls for my game. I heard that using quaternions is the way to go. So I ...
3
votes
0
answers
159
views
Faster convergence in a physics engine
I've got my hands on the first edition of the book Game Physics Engine Development: How to Build a Robust Commercial-Grade Physics Engine for your Game by Ian Millington. Because I didn't really know ...
3
votes
2
answers
336
views
With gravity enabled, how do you move a RigidBody forwards at a specific speed?
I have a perfectly smooth cube on top of a perfectly smooth plane. I am applying a forward-force of 1 unit per second, using ...
3
votes
0
answers
197
views
How to implement path-finding with a large number of blocking agents following similar paths?
I want to implement a demo like creeps laning in Dota 2.
So for simplicity, there is Left team and Right team, they are enemies.
Units from Left team move toward Right base, and units from Right team ...
3
votes
0
answers
320
views
How to properly write "stick to surface" character logic that handles unexpected large time deltas?
I've been trying to wrap my head around this issue: in a 2D platformer game (but this may as well apply to 3D games) I want the character to "stick" to the surface that it's moving along and at the ...
3
votes
0
answers
372
views
Bullet Physics Scaling rotational part of 6DoF Spring Damper
I am currently trying to scale up my setup (consisting of two rigid bodies connected by a btGeneric6DofSpring2Constraint) to fall within the suggested dimensions for a concise simulation.
In order to ...
3
votes
0
answers
599
views
Add Rigidbody and MeshCollider at runtime : is it a bad practice?
Good day.
To simulate an explosion of a vheicle, I decided to do this:
When I need to explode veichle , at runtime, i add rigidibody for every single part of veichle (5-10 part: door, wheel, hood ...
3
votes
0
answers
324
views
UNET Performance of (many) Kinematic Rigidbodies
I am building a game in Unity in C# using the UNET networking elements.
I am trying to figure out what is the performance cost of kinematic rigidbodies?
My understanding is that, when kinematic, ...
3
votes
0
answers
75
views
Solving constraints/joints in 1D
For n points moving in 1 dimension.
Position and velocity are known for each point.
Each frame a basic integration is done for each point:
...
3
votes
0
answers
165
views
How to aim with a spaceship in 3D considering its angular momentum?
So I have a spaceship and I have 6 degrees of freedom.
At a given moment the following vectors are known of the spaceship:
Local forward.
Local up.
Local sideways (may be implied from the previous ...
3
votes
1
answer
2k
views
How to code a non-newtonian spaceship control script?
I'm working on a simple 3D space combat game, and I've decided to go with simplified physics over proper newtonian motion, similar to the space sim Oolite, and more 'arcade' style games. I basically ...
2
votes
1
answer
709
views
How to implement grapple hook and swing
I'm trying to make a retro style grapple hook / swing system that has a constant speed and is not based on real-life physics. Like the one in Axiom Verge, Bionic Commando (NES) and Super Metroid.
2
votes
0
answers
75
views
Calculating spring constant c
Suppose we have 2 springs with different values for m and k. The first spring is given an arbitrary dampening value, ...
2
votes
0
answers
63
views
How to connect particles to rigid bodies in LiquidFun?
In vanilla Box2D various types of Joints can be used to connect two rigid bodies together. The LiquidFun extension brings the Particle Module, but I was unable to find a way to connect a particle/...
2
votes
0
answers
429
views
How to accelerate car based off of Animation Curve?
I am making a karting game and I want the karts velocity to accelerate based off a curve. This would allow me to quickly iterate different types of cars that accelerate in different ways. I was ...
2
votes
1
answer
81
views
How do I get the consistent time it would take for two points to reach each other in circular motion?
I'm making a 2D game. It involves the player swinging around a grapple hook in perfect circular motion, however, I want to make the cooldown for this ability based on predicted end position for the ...
2
votes
0
answers
84
views
How can I make my table move more realistically after a collision?
Using Unity 2020.
I have a character using CharacterController and Rigidbody, colliding into the end of a long table.
My table has, as a root object, the mesh and the Rigidbody.
It also has, as child ...
2
votes
2
answers
418
views
Interpolation on Rigidbody2D not working
I'm trying to achieve smooth movement for a ball. I seem to be failing to achieve this and now I've created a sample scene, which shows my setup from the game and the problem exists in that sample ...
2
votes
0
answers
777
views
How to achieve variable jump height in an elegant and natural way
I am making a platformer, with a methodical approach to player physics. This is how I do variable jump height:
...
2
votes
0
answers
101
views
Handling strange physics behaviour while sliding between coplanar surfaces
We've got a character setup based around manually resolving collisions, and we're using bullet to do so. Our characters have a kinematic rigidbody to push things around, but their movement and ...
2
votes
0
answers
842
views
Realistic 2D air friction in unity
I want to make an evolution games similar to this old games that was generating cars.
Except I want it to be more realistic.
So I want air friction to impact the speed of my cars, but how do I do ...
2
votes
1
answer
820
views
calculating the trajectory of an object in SpriteKit when an impulse is applied to it
I want to make a trajectory line of little balls of where the object is going to go after an impulse, sort of like what is in Angry Birds. I did some research and it seems that the physics in ...
2
votes
0
answers
574
views
Simulating Water by changing Y values of Quad Vertices
hopefully this isn't too difficult to answer, but I'm stuck and could at least use some input. I'm working on simulating water for the first time with basic wave functionality. As in I click at a ...
2
votes
0
answers
564
views
2D platformer:How to avoid "bouncing descend" when walking down slopes?
I've been working on implementing slope collision by SAT(Separating Axis Theorem). And then I have a trouble. When my character walks down slope, it moves like a bouncing ball:
The slope has 3 ...
2
votes
0
answers
109
views
Soft-restart tampers with physics determinism, resulting in different results
Updated question
I have a Spawner entity that spawns my Rollables:
...
2
votes
0
answers
610
views
Unity applying forces using animation
I'm trying to make a croquet mallet swing to hit the ball using an animation that rotates the mallet mesh. The mesh appears correctly positioned to hit the ball in the center but the ball doesn't go ...
2
votes
0
answers
626
views
Calculate Orbit Path/Ellipse given mass, velocity, and distance (2body)
Calculate and draw the path of an orbit in a 2 body problem given the mass, current velocity, and distance of both bodies?
We're working in Unity and will be using the default rigidbody.mass to start ...
2
votes
0
answers
1k
views
2D Distance Field as collision handler method
Pixeljunk Shooter has really cool fluid simulation.
I found the dev's video explaining what they did. Here
I understand that it is particle based simulation Smoothed Particle Hydrodynamic
I can ...
2
votes
0
answers
270
views
Storing rigid body collision shapes in local or world coordinates
I'm writing the beginnings of a lightweight 2d rigid body engine (in javascript, as a hobby project), and i'm debating whether to store collision shapes in local or in (updated as needed) world ...
2
votes
0
answers
288
views
How do I compute the angle between a pixel on an irregular curve and a circle colliding with it?
I'm building a custom physics engine to accompany a level-editor. This image shows how the level-editor outputs levels:
Now, some explanation is in order. The curve is defined by the red points. ...
2
votes
0
answers
183
views
Newton Game Dynamics: Making an object not affect another object
I'm going to be using Newton in my networked action game with Mogre. There will be two "types" of physics object: global and local. Global objects will be kept in sync for everybody; these include ...
1
vote
0
answers
40
views
Predictive Aim to shoot a moving target with a constant velocity while the projectile is affected by gravity (2D/Platformer view)
I've been working on creating stationary gun turrets that can shoot down missiles in my game. The bullets are affected by gravity while the missile moves in a linear path at a constant rate as if it ...
1
vote
1
answer
52
views
How can I constrain a RigidBody ball to move along a path, but only apply forces to keep the ball on the path without adding velocity?
I'm currently working on a game and I'm hung up on this particular issue.
I have a ball that is a RigidBody. The RigidBody is ...
1
vote
0
answers
17
views
Applying impulses simultaneously at each contact point or sequentially?
I'm coding a 2d physics engine in python, and I'm struggling to understand the right way to implement collision resolution when there are multiple contact points.
Consider a very simple collision case ...
1
vote
1
answer
63
views
How can I simulate locking or limited-slip differentials in Unity?
I have been developing a racing game in Unity for a few months and I can't find any information on how to simulate a car differential.
Right now I just split the torque generated by the engine 50-50 ...
1
vote
0
answers
139
views
How to implement soft-body blobs that don't pass through one another
I am learning about soft-body implementations in Unity recently, and I stumbled upon the game Blob Merge 3D.
It is quite an interesting implementation because the blobs do not overlap one another and ...
1
vote
0
answers
35
views
Physics interpolation given an asynchronous physics thread
I've followed https://gafferongames.com/post/fix_your_timestep/ to do interpolated physics. I have a separate thread entirely from my graphics thread. I use vulkan which allows me to do asynchronous ...
1
vote
0
answers
56
views
Separating axis theorem implementation results in limitless extending colliders along the Z axis
I am trying to implement SAT and it works except for the fact that colliders extend infinitely along the Z axis and I can never get past them. I also have confirmed that ...
1
vote
0
answers
158
views
In Unity 2022+, Unity.Physics 1.0.16, what is the proper way of detecting collisions with a job?
I have properly defined the CollisionEventJob, scheduled it, and attached necessary components to my entities, but for the love of God, ECS is not detecting collisions between those entities. Here is ...
1
vote
1
answer
209
views
Raycast suspension simulation rebounds car on landing
I'm expecting the car to land and engage the suspension to dampen the landing. The code I'm using currently has this effect:
...