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.

Filter by
Sorted by
Tagged with
0 votes
1 answer
47 views

AABB Collision Resolution Per Face

I have this function that detect the collision of two AABBs: ...
Scollier's user avatar
  • 124
1 vote
2 answers
62 views

Representing a concave polygon as a hull "minus" convex cavities

I am implementing 2D collision detection, and trying to tackle the problem of concave polygon vs. shape. The SAT works only for convex shapes. I was wondering if the following approach is a viable ...
Eilan Laken's user avatar
0 votes
1 answer
53 views

Circle to Polygon & Circle to Circle Velocity Resolution

I am working a 2d physics engine. Polygon to polygon collision and velocity resolution works without issue, but I am struggling to get working circle to circle and circle to polygon velocity working ...
NoStepOnSnek's user avatar
3 votes
1 answer
73 views

Automated playtesting in a 2D platformer

For a hard 2D platformer I'm working on, I want to make an automated playtesting system. The goal is to allow every level to be tested in parallel as part of an automated test suite. These tests would ...
crass_sandwich's user avatar
0 votes
0 answers
24 views

How to implement flexible, deformable shapes?

I'm making a top-down, 2D wargame that simulates large numbers of troops fighting. Instead of taking the Total war approach and modelling each soldier individually, I represent them as 1000-man ...
DeeCeptor's user avatar
  • 255
0 votes
0 answers
25 views

Suspension vector direction of a raycast vehicle

I'm working on a raycast-based vehicle in a 3D world using a physics engine. It's basically a chassis object that contains a transform (translation, rotation, scale), a dynamic rigid body (with mass, ...
Splo's user avatar
  • 736
2 votes
1 answer
71 views

Pin object to the end of a rope

I'm trying to make a cool simulation where a rope swings with an object attached to its end. I've set up the rope using Verlet integration and used Hooke's law to attach the object. But here's the ...
Ainsley Harriott's user avatar
0 votes
0 answers
33 views

How to move a Rigidbody forward using Bullet Physics

I'm currently developing a character controller for my game framework, and I'm utilizing the Bullet Physics engine for the physics simulation. In the process of adjusting the velocity, I aim to enable ...
Wagner Andreas's user avatar
0 votes
0 answers
48 views

How to calculate velocity based on force at an angle

I have a 2D top-down jetboat that is moving (has a x, y velocity). I apply the velocity by multiplying against the delta time <...
fresh's user avatar
  • 1
0 votes
1 answer
41 views

Game Physics Engine : Euler integration : why body under gravity is not covering 9.8 meters/second?

I am working on very basic physics engine and I used euler interation which works like below, ...
videogamechef's user avatar
11 votes
3 answers
3k views

How hard to brake to perfectly smoothly reach the destination?

Goal I want the get the required minimum deceleration to perfectly smoothly reach a target. (The car's AI should know how hard it has to brake to be the perfect valet.) Research "How can I ...
st_phan's user avatar
  • 213
0 votes
3 answers
72 views

Implementing framerate independent friction with linear deceleration

I'm implementing friction into my game, and I'd like it to be framerate-independent. Here's my first solution, in Lua style pseudo-code: ...
Yolwoocle's user avatar
1 vote
1 answer
45 views

Momentum of a ball on a moving platform

I'm seeking information on how to implement something. I have a ball on a moving platform. The ball has a position and momentum. Here's a gif illustrating the situation: So the way it works is, the ...
KiraHoneybee's user avatar
0 votes
0 answers
45 views

Physics Engine Collision Response

I'm making a game engine with my integrated physics engine and I've encountered a problem where rigidbodies tend to over react in collisions and move around without and intention to slow down, I have ...
Gelis 07's user avatar
1 vote
1 answer
68 views

When should I call the physics simulation within the game loop?

I am thinking about where to call the physics simulation. The current situation is that I first update the entities and then the physics immediately before rendering. As you can see in the following ...
Andy's user avatar
  • 13
1 vote
1 answer
41 views

Why is my spring exploding? And how to fix it?

Let's say I have a 1-dimensional spring, and I want to simulate it by applying a force that may vary with time. We can skip friction and dampeners for now. From what I learned many years ago in high ...
Panda Pajama's user avatar
  • 13.4k
0 votes
2 answers
109 views

Max velocity for smooth deceleration to destination

I am able to update velocity of my agent every 0.5 seconds. My agents max speed is 5f/s and max acceleration/deceleration is 2f/s. I know how far away I am from the destination. How to determine ...
Peter's user avatar
  • 13
0 votes
0 answers
35 views

Why do we need two constraints to calculate the friction impulse?

Why do we need two constraints to calculate friction force? $$ \begin{align} K_{fric_1} &= J_{fric_1}M^{-1}J^T_{fric_1} \\ &=(-u^T_1 -(r_1 \times u_1)^T u^T_1 )(r_2 \times u_1)^T) \\ K_{...
noodle_run's user avatar
1 vote
0 answers
61 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 ...
creekat's user avatar
  • 11
0 votes
2 answers
98 views

Calculating velocity to reach the jump height while the player presses the jump button

The height of the jump depends on how long the player presses the jump button. There are only two parameters - height and time. Gravity is constant. Let's say that the height has three units, and the ...
Demexis's user avatar
0 votes
0 answers
14 views

"Sticking" occurs in collision constraint solution

Two rectangles collide, use the following formula to calculate: $$ J = \begin{vmatrix} J_{1} \\ J_{2} \\ J_{3} \\ \end{vmatrix} $$ $$ J_{n} = \begin{vmatrix} \overrightarrow{n} & \overrightarrow{...
noodle_run's user avatar
0 votes
0 answers
66 views

StaticBody2D on body enter without Area2D

How can I get the body_entered signal on a StaticBody2D without an Area2D? I know ...
Salem Domani's user avatar
1 vote
0 answers
33 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 ...
Krupip's user avatar
  • 1,763
0 votes
0 answers
67 views

Reversing the velocity doesn't work after being built

...
Leo's user avatar
  • 1
2 votes
2 answers
148 views

How to make the player pass through only certain objects, but not others?

Experimenting with my 1st Unity project. It's about a top down swimmer. By toggling the swimmer's collider, he can swim under boats: ...
Tomo's user avatar
  • 133
0 votes
0 answers
56 views

What is best to achieve bullet ballistics: frame by frame raycasts, or CCD?

I plan to achieve bullet ballistics at long distances, with a slight drop. I would also try to add networking reconciliation with a library, since I don't really have the skills or resources to ...
jokoon's user avatar
  • 5,243
0 votes
1 answer
26 views

Can't move rigidbody2d when using animations

I have a player moving and jumping by changing its x or y velocity. It worked well until i created a walking and idle animation. Now, the player is animated correctly when idle or walking, but does ...
Usylom's user avatar
  • 21
0 votes
1 answer
40 views

How to check for collisions between objects with the same script?

I am creating a game where there would be two objects instantiated. Each one has a script (to check for collisions), a Rigidbody2D component and a ...
Saharsh's user avatar
0 votes
2 answers
71 views

How to make a character fall through a BoxCollider2D?

Currently trying to make a 2D game in Unity and I'm trying to make the part where if the character falls in a hole it goes back to spawn, but I currently have a ground box collider blocking it, which ...
TheEpikDuck's user avatar
0 votes
0 answers
58 views

How to "float" a capsule with a rigidbody component in unity?

I've been stuck in a rut trying to figure this out for a while now. What I want is to have a capsule hover above the ground at a set height to eliminate ground friction and make irregular surfaces ...
Sundayz's user avatar
0 votes
0 answers
31 views

Getting 3D slide direction

I am trying to make my player slide down a curve (like a water slide) and so far I’ve managed to get the slide direction using the following code ...
Andrei Cristian's user avatar
0 votes
1 answer
44 views

Simulating the behaviour of small objects coming to rest on the surface of an asteroid, 2D

I have a large asteroid object, and I want to use physics2D to have smaller objects be attracted to it as if by gravity, and come to rest on its surface. The asteroid itself is also a dynamic ...
arcadeperfect's user avatar
-1 votes
1 answer
90 views

Angry Birds style aiming (ballistic trajectory)

Could you please provide guidance on how to create the curved part? regard,
Saeed Asmani's user avatar
0 votes
0 answers
48 views

How to prevent jarring collision resolution when enabling a ragdoll?

After enabling a rigid body and collider on an object that is overlapping with another object, it applies a large amount of force to the object, so it jumps out of the overlap. The problem is worse ...
virtouso's user avatar
  • 2,608
0 votes
0 answers
22 views

Where is the friction coming from in this simple setup?

I'm creating a simple implementation of the classic cart and pole balancing control problem. I'd like to have a 2D interface with the cart and pendulum controlled by the Unity physics, so that I can ...
Steve's user avatar
  • 101
0 votes
0 answers
42 views

Should a free roaming camera movement be controlled by the physics engine (for smooth movement)?

I have a hobby engine (for fun and research) with a free roaming camera implementation that works by modifying the PositionComponent and ...
Mark Ingram's user avatar
1 vote
2 answers
44 views

Best way to implement a carrying tray in VR using Unity

I need a way to carry objects on top of other objects in VR without jitterness causing the objects to fall through a tray for example. I've tested with rigidbodies having very high friction, this does ...
Richard Muthwill's user avatar
0 votes
1 answer
44 views

3D Impulse based collision resolution not behaving correctly, what could be wrong?

I've implemented a collision resolution system based on Ian Mellington's System Cyclone and afterwards based on the Game Physics Cookbook. Currently the last one is implemented. For some reason the ...
Martin's user avatar
  • 1
1 vote
0 answers
52 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 ...
Jakob Tadej Vrtačnik's user avatar
0 votes
1 answer
39 views

Getting the scalar speed from an X and Y velocity [duplicate]

Given a Vector2(x,y) that represents an object's velocity, like so: ...
CAOakley's user avatar
  • 101
0 votes
1 answer
55 views

How does bullet physics filter 4+ contacts in GJK?

If the bullet GJK (Convex vs convex) collision algorithm has more than four penetrating points, then how is it filtering that down to the four it needs? What I've tried Staring at the code, but I get ...
Baer Ran's user avatar
0 votes
1 answer
43 views

OnCollisionStay outputs strange contactpoints

I am currently trying to make a pen draw on a paint. I am searching for contact points on the paint but there is too much contact points than expected. I'm not sure to properly understand how ...
Hazard4U's user avatar
0 votes
0 answers
56 views

Determining meters per second in scaled terrain

I have a terrain with a width of 199 and height of 99 and I'm scaling this train by 500. What would be 1 meter in the new terrain, would it be 500? I'm trying to move my character in meters per second ...
blov's user avatar
  • 1
0 votes
2 answers
83 views

Bouncing balls miss collisions, bounce the wrong direction, of lose momentum on one axis when hitting a corner

I am making a 2D game where balls bounce from the edges of the screen, However, there seem to be two types of issues with this kind of bounce method, and every tutorial I checked uses the same method. ...
ZozeR's user avatar
  • 42
4 votes
2 answers
270 views

Order of updates in falling sand simulation

Looking into the classic "falling sand" simulation I've run into a question that I couldn't find addressed anywhere. Most people appear to agree that the update has to go bottom-up, because ...
Seg Fault's user avatar
  • 141
0 votes
0 answers
91 views

Brick Breaker - Adjust ball's collision angle without affecting speed

I'm working on a Java Brick Breaker game, and it's functional so far. However, I'm facing an issue with collisions. Currently, when the ball collides it simply reverses its direction. I want to ...
Zappiermike's user avatar
1 vote
0 answers
128 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 ...
rasputin's user avatar
0 votes
2 answers
96 views

Detecting collisions with trajectories

What if an object were to have collision detection implemented as so: A ray in the direction the object is moving in, and a ray in the direction of gravity.
Nato's user avatar
  • 9
0 votes
0 answers
40 views

unity wrong ragdoll behavior on slowmotion

I use simple logic to make a slow-motion effect. It works fine but it makes ragdoll animations feel like they have no weight and move easily. This is the sample code: ...
virtouso's user avatar
  • 2,608
0 votes
1 answer
166 views

How to code glider movement in 2D? (Godot 4)

So in Minecraft, you have the elytra. When you look up, the character moves up. When you look down, the character moves down. The speed you move forward depends on the angle you are moving. I want to ...
Shattered Reality's user avatar

1
2 3 4 5
48