# 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.

2,231 questions
Filter by
Sorted by
Tagged with
26 views

### How to move an enemy to sneak up on the player from behind, using forces?

I have this code to move the enemy: (for x, same for y) ...
• 217
20 views

### Best approach to model slipstream?

I am looking for a way to model slipstream effect in videogames. The two use cases I want to look at are a simple racing game and the simulation of a peleton (a big group of road bike riders), both in ...
• 133
19 views

### AI car in racing manager game [closed]

I wonder how to make a smooth racing in manager game. All car go smooth with perfect curve, no sliding, good overtake, break.
24 views

### The vector aiming to enemy is in wrong direction

In a 2d game, I am trying to shoot at a moving enemy and the vehicle that is shooting is also moving. However, the velocity of the bullet is not in the same direction as the position of the enemy. The ...
56 views

### How to connect rockets to a space capsule?

I am trying to create a space capsule that has four rockets to balance the capsule. The rockets and capsule haveRigidbody2D and ...
• 3
9 views

### aiming prediction in 2d game using projectile [duplicate]

I am trying to make an agent predict the velocity required to throw a ball at a target and take into consideration the target. So what I need is a ball following a projectile path until it hit the ...
1 vote
56 views

### Aircraft simulation

Trying to get a "semi" realistic aircraft simulator. I'm pulling my hair out because I just can't get the math right. I'm not looking for super realistic but want to at least get some ...
• 111
18 views

### I have a "Floating Capsule Collider" setup, but if Collider stands on the edge of a platform, the player Mesh ends up looking 'stuck'

I have a "Floating Capsule Collider" setup, but it has an issue when the Collider stands on the very edge of a platform-- the player Mesh ends up looking 'stuck' inside of the platform. How ...
• 45
17 views

### How would I calculate the velocity of a sphere with an impulse applied at the top?

I'm developing a rigid body physics engine and currently have accurately calculated the angular velocity of the sphere when impulsed. Unfortunately though, I'm not calculating the velocity correctly ...
• 1
62 views

### Plot rigidbody path simulating magnus effect

I am trying to create a method that will plot the path a rigidbody will take when simulating a magnus type effect with no gravity in Unity. I realize this approach is a drastic simplification to the ...
1 vote
25 views

### Configurable Joint rotation doesn't seem to respect mass difference

The Problem I've run into a physics issue in my Unity project, and have put together a simple example scene to illustrate it. Hopefully someone will be able to tell me if I'm doing something wrong. In ...
• 121
95 views

### Unity CharacterController steps on colliders with 0 Step Offset

I'm moving my CharacterController with the Move() method and for some reason it still steps on colliders even though its Step ...
• 626
55 views

### How to prevent a huge backlog of physics calculations from freezing browser when tabbing out of browser game?

I'm developing a browser game and am using the timestep implementation from the famous Fix your timestep! article. It works perfectly, but there is one problem. If you tab out of the tab and then come ...
• 175
14 views

### Unity - Rigid Body Floats Away When Adding Ragdoll

I added a ragdoll component to my enemy model and now it just floats away whenever I run the game, this never happened before I added the ragdoll. if theres anything else I need to send just tell me ...
27 views

### Wobble physics like Sandwich Runner Unity3d

Here's the game, that's the wobble! I am trying to make a hypercasual game similar to Sandwich Runner, I can't quite figure out how the wobble mechanics was made! Where the stacked objects wobble when ...
93 views

### How to manually Simulate Physics properly on Unity?

I'm trying to simulate physics manualy in a Unity 3D game. I've turned off Physics "Auto Simulation" in Project Settings and wrote this piece of code (it is more or less the unity doc sample)...
• 123
1 vote
117 views

### How to slide along a wall at full speed?

I was reading this answer, and while it works for that use-case, mine is slightly different (simpler?), but I can't figure out how to do it. What I'm looking for is a way for the player to retain ...
• 175
26 views

### How to destroy just the specific powerup I hit, not all of them?

Creating a game for a computer science class - basically I have a player (cop) who will collide with donuts. When the player collides with a Donut, I want the speed to increase by 0.5 each time. Here ...
31 views

### How can I simulate something heavy?

I need to convey the feeling that something is heavy in a game-like experience. The environment is web-based, most likely mobile. Specifically, I need the user to be able to lift/move a chain and get ...
• 101
41 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 ...
32 views

### How to make a capsule Rigidbody player "kick" a Rigidbody sphere (ball) in Unity?

I am just learning the basics of physics simulation with rigidbodies. I am trying to simulate some basic real world functions like kicking a ball. Let's say I have a simple capsule mesh/collider as my ...
• 197
1 vote
49 views

### Circle and circle collision (with physics), but when lots of circles pile up things go wrong [closed]

I'm trying to make an as realistic as possible ball physics simulator. Currently, I worked out all the collisions between balls, and it works really well when there are few balls. But once you create ...
53 views

### Why do colliders have a tendency to spin and develop crazy angular velocity in Unity when used as my "player"?

I am trying to create a basic collider for a rigidbody player in Unity 3D. I have been experimenting with numerous shapes but found it hard to get what I want. The primary issue seems to be if the ...
• 197
1 vote
12 views

### What can I set in rigid body and collidable objects to ensure that the angle after collision is larger?

I have a rigid body with sphere shape attached and a static collidable box. When sphere hits the box at an angle, for some reason, the angle that it bounces off from is really small: https://imgpile....
• 189
72 views

### In physics engines, what are the differences between moving an object with transform.translate and using RigidBody related functions like AddTorque?

I'm trying to recreate the ball maze puzzle game from Breath of the Wild with Unity. This is what I currently managed to make: As you can see, it's not nearly as smooth and I feel like I lack the ...
70 views

### Why are some gameplay systems set up to exist in the world, with full collision and kinematics, whereas others seem like complex event timelines

I wanted to ask a question I've always wondered about to the larger crowd of gamedevs out there: Why is there often a disconnect between the locomotion / kinematic systems that a player controls vs. ...
• 94
1 vote
38 views

### How do I apply real time physics to a 2D game in Java?

I'm developing a 2D Brick Breaker style game in Java and want to apply some real time physics to it, especially to the paddle/ball interections. Nothing too complex; just applying some of the physics ...
• 13
31 views

### Unreal Engine How would I make a one way physics door, that takes both walking into it, and mouse move it

Horror game. In the bathroom stalls I want the doors that opens 45 degrees you can walk into to open it or slowly use the mouse to open it while standing still and "lock" it, once inside ...
72 views

### How to find the maximum distance a target point can be hit from a launched projectile

I'm determining a trajectory necessary to hit target B with a projectile launched from point A with a given velocity. No problems there. Obviously, not all points B can be hit with a fixed velocity, ...
• 591
31 views

### How to deal with rapid acceleration/deceleration from physics forces?

I'm working on a game in LOVE2D using Lua, where you pilot a drilling vehicle. The idea is that as you drill into different surfaces, you speed up/slow down depending on how dense that surface is. I'...
• 41
1 vote
52 views

### Move physics capsule at same acceleration regardless of surface slope

Into: I'm trying to move a capsule up/down a slope accelerating at the same rate as a capsule on a flat surface. I cannot set the velocity directly, because there will be many more forces affecting ...
• 121
87 views

### How to do per-pixel destruction in Unity?

I want to make a game like Liero or Worms but with physics. I have no Knowledge of code, and I searched all over the Internet and all I found were either 3D Voxel Destruction, or 2D Tile map ...
29 views

### Source Engine - Strange factors in acceleration equation

I was going through the player movement code for the source engine when I stumbled upon the following function: ...
1 vote
31 views

### How do I simulate the forces acting on this hydraulic system?

I've been trying to create an algorithm to simulate a specific hydraulic suspension system for animating a car rig. Below are the schematics for the hydraulic system: All same-color lines are ...
47 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 ...
• 51
31 views

### Why does this AddForce code cause my character to zoom very fast in the direction it was heading, rather than just zoom downward?

I have code that takes movement from Player's keyboard input and applies AddForce based on it. Recently I added a GroundCheck function that is supposed to do: "...
• 45
26 views

### Torque orientation when changing the coordinate system

I have some Unity application, where the user can input a torque that will be apply to a given rigidbody. Nonetheless, the sophistication comes from the fact that the input from the user is in a given ...
• 103
58 views

### Why does my code intended to stop Rigidbody from sliding prevent player from jumping?

I have the following code which gives a Rigidbody capsule the ability to move and jump (if on layer Ground). After Player stops input, the Rigidbody slides. I ...
• 11
35 views

### Sphere collision resolution when colliding with multiple meshes

I'm writing my own player collision physics and I'm stuck at collision resolution part. I have sphere as a player and scene made of static meshes. Collision resolution works fine when player is ...
1 vote
63 views

### How to make a code-generated mesh interact with a rigidbody?

I'm using a sphere and an empty game object that generates a mesh upon playing/starting. On the mesh, I place a Mesh Collider component with ...
• 31
29 views

### Implementing Linear Diagonal Movement Relative to Camera Rotation

So far I've implemented horizontal (X-axis) and vertical (Z-axis) linear movement for the player in a 3D game. Using the code shown below, the player is able to move relative to the camera's Y-axis ...
• 101
40 views

### How do you make Cube not instantly rotate upon Keypress in opposite direction?

I have this movement script on a Rigidbody cube with X,Y,Z Rotation Constraints. It is working well to move and to rotate in the direction of the movement. However, ...
• 11
40 views

### What causes Rigidbody character to suddenly move at fast speeds?

I'm trying to make a Rigidbody-based movement script for a character. It behaves pretty much as expected, but every once in a while the character will suddenly run at a massive speed. I can't find a ...
• 45
1 vote
59 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 ...
• 11
27 views

### How to make trigger function respond to certain collider pairs and not others?

I assigned two colliders to one GameObject. Both are different sizes. I am doing operations with Trigger messages. I want this Trigger function to work for only colliders 1 and 3, but not collider 2.
• 13
111 views

### Unity - Billiard balls unrealistic movement

So, I have this problem, even when I apply a small amount of force, the balls seem to get pushed away easily. Here's how they should behave (GIF from 8 ball pool game): And here's how I have it : ...
46 views

### Ball's spin speed seems to change erratically after AddForceAtPosition impulse

I'm trying to make a billiard game, and trying to add "spin" (aka English) functionality. The way I'm using to add spin is by using AddForceAtPosition(). Here's the code: ...
70 views

### How to implement crowd movement in Unity without rigidbodies?

I am working on a mobile game where its core gameplay includes a bunch of objects (can exceed 100) walking around autonomously in an environment where they push each other and get pushed by other ...
• 460
32 views

### High rigidbody drag value gives weird speed readings

when calculating speed in unity ...
• 35
1 vote