# 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,157 questions
Filter by
Sorted by
Tagged with
12 views

### Help with Ragdoll snapping back to origin

So I have a ragdoll system that is enabled when the player is hit by an enemy. When the ragdoll is enabled I disable the animator, wait 3 sec, then enable the animator and play a get up animation. ...
125 views

### How do I manually accelerate the rotation of a sphere in Unity 3D?

I'm a little new to this so any help will be appreciated. Context: I'm creating a VR billiard/pool game and trying to get the physics as realistic as possible. I have a cue ball being hit with a cue ...
106 views

### How to predict where the soccer ball should be intercepted by an AI player after being kicked?

This question has been asked many times before, but most of the answers give solution to the problem where ball (target) is assumed to be moving at a constant velocity. In my scenario, I'm making a ...
202 views

### How does skin width work in Unity's CharacterController?

I'm trying to write my own character controller and I want to understand how Unity's works. I think what it does is this: at each fixed update it takes the smaller collider reduced by the skin width, ...
25 views

### Calculate the starting position of a turning aircraft with inertial force to make it stop at desired position and heading

Continued from the answer here, I have some problem when the aircraft in my game has inertial forces after going forward and turning itself. To illustrate, from the following image (https://imgur.com/...
86 views

### Phaser 3 - How to make 2 object merging after collision (Like Claw Machine)

I'm new in Phaser 3. I use Matter.js for physics. I want to create something like Claw Machine : I have a claw (top) and prize (bottom) The claw will take a prize from bottom When claw hit the prize, ...
175 views

### How do I manually change a sliding ball into a rolling ball in Unity 3D?

I'm a little new to this so any help will be appreciated. Context: I'm creating a simulated VR billiard game and trying to get the physics as realistic as possible. I have a cue ball being hit with a ...
68 views

### How to simulate destruction/damage of household objects?

I'm looking for a method to simulate various objects' damage and destruction. As far as I can see, Unreal Engine 4's Chaos can only simulate buildings, but I'm more interested in other type of objects....
26 views

### Getting “continuous collision detection”-like behaviour out of triggers

I have a particular scenario where I want to use a trigger to adjust the course of a fast-moving projectile, but am running into issues because Unity does not support continuous collision detection ...
79 views

### 2D Platformer Multiple Body Collision Response

I've been stuck for the past few days on implementing multiple body collision response, and I can't seem to find any good resource to help me advance. Colliding between two objects is simple enough. ...
112 views

### RigidBody or Character Controller for Zero Gravity first person shooter

I am developing a single person, first-person shooter that takes place in space. I want to be able to simulate zero gravity. Should I use a Rigid-Body or a Character Controller?
36 views

### Collisions and Colliders

Does anyone know how to prevent a gameobject from colliding with another gameobject but can still register collisions? Like a ball that can bounce off of the wall or ground and can pass through the ...
82 views

### Unity Ragdoll moves away from parent

So this is a weird one. I've looked it up but can't find anyone with similar issues. Basically I have a simple combat system and after the enemy health is zero I go through each rigidbody component in ...
16 views

### How to Cease the Ragdoll Wiggle Dance

When I instantiate a ragdoll object, it collapses nicely, but the movement never stops. It wiggles continuously. I'm using CharacterJoint components. None of the colliders (box and capsule) intersect. ...
70 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: ...
49 views

### Formula Racing Physics in curves (under-steer, over-steer)

I have a working physics code for a -let's say- WipeOut-style vehicle [well, closest approximation]. Some time next year I would like to do a formula game but am struggling to get to tweak my code to ...
112 views

### Roguelike movement system

I'm trying to implement a roguelike movement system for my game. I'm using the ECS architecture. The requirements are: entities will have a mass, on which should slow down the entity movement ...
147 views

### How to make Rigidbody.AddForce less delayed in Unity3D?

I'm trying to make it so that when the player in my game moves left or right, he lightly jumps from his current position to his new position. The way I have it set up now, the jump occurs once he has ...
127 views

### My bullets won't bounce in Unity?

I wanted bullets to bounce when they hit walls. However when colliding with a wall, they just jitter about on them. I didn't want to create a new physics material as I want to keep the ball moving at ...
383 views

### Linear interpolation: reach moving destination regardless its speed

I'm implementing a camera for a game and I'm using the LERP formula for smooth chasing. However, if the target moves fast enough, the camera can never reach it unless the ...
24 views

### Trying to create a knockback effect between 2 squares (Code in Java)

I've been in trouble for weeks now and I don't understand why it doesn't work for me! I have tried so many things and I just can not understand. I try to get one player to get a knockback as soon as ...
66 views

### How to calculate a movement Vector3 to kill unnecessary momentum and start moving in the right direction?

Imagine a rocket is accelerating in a straight line toward PointA, picking up momentum every frame, then suddenly decides it wants to go toward PointB instead. It can't just turn straight toward ...
155 views

### Simple collision resolution in a platformer game

I want to make a 2d platformer with moving, jumping and wall sliding. How can I make a simple pleasant collision resolution system that works for the following rectangles. Player is red, platform is ...
74 views

### How to rotate an object based on the movement and angles of Lifters

I have Lifters that "carry" an object. I want the object to move and rotate based on how those Lifters move. Requirements include: Supporting 1-4 Lifters at any side of the Object (e.g., ...
53 views

### Understanding Physics Materials

I have been reading the documentation about Physics materials, and it really seems very incomplete to me. When I try to work with it, I get so many questions... Maybe can someone help me wrap my head ...
50 views

### Having multiple different friction values on a single piece of track?

I am trying to figure out a good/performant way to give a piece of track multiple values of dynamic friction. A track piece is 10x10 units in Unity and the idea is to puzzle them together to a big ...
97 views

### Why is my player spinning after a collision?

I've made a very simple 2D top down prototype with Unity. This is the code I use for the player: ...
476 views

### What is transmitted over the network during multiplayer first person shooter games?

In games like Half-Life 2, Team Fortress 2 etc, when you play against other players online, your local game communicates with a game server. If you've built one of these games, what sort of ...
68 views

### Making pickup objects with gravity that won't push the player on collision

I am trying to create pickups, that appear after an enemy dies, and that the player can pick up, but I am running into some issues. First of all, I want the pickups to be affected by gravity, so I ...
337 views

### Apply external effects to player movement

In a 2D downhill game with the following, custom movement code, how do I apply external effects to the player's movement? For example, when the player hits an obstacle, I want them to get bounced off ...
430 views

### OnTriggerEnter not working when placed inside Update()

I'm making a scanner that scans the "world" (like a 10 x 10 space), and I'm trying to sense a GameObject called pointer. They both have colliders, they ...
79 views

### What are some of the tricks engine can use to render object that have extremely high polygons efficiently? [closed]

What are some of the tricks engine can use to render object that have extremely high polygons efficiently? I know one thing we do is render only the parts that the camera points at, but I am wondering ...
83 views

### A ball hits the corner slightly, where will it deflect?

I am currently making an iOS Game but I have a small problem. The game is simply a ball which you can control to avoid obstacles and find the food. When the ball hits, e.g. the top or the bottom of an ...
92 views

### My character is not switching right or left like subway surfer in 2D?

I am making a 2D subway surfer type of game right now and I found this code on the internet that switches the lane of the player but the problem is it doesn't switch. When I play the scene it won't ...
82 views

### Bouncing ball loses its forward momentum after the first bounce

I've created a bouncing ball in Unity, and I want to bounce the ball across the field, but the results I get seem very unrealistic. The ball should bounce in the direction it was launched 2 or 3 more ...
101 views

### How to calculate tangents in beam data to fit given trajectory

I'm currently trying to create a trajectory effect (in UE 4.25.1) similar to one from the last of us: I have created a beam with niagara, which lets me determine the starting point of the beam, ...
137 views

### How to use continious collision detection in a dynamic AABB tree

I am currently writing a game in c++ using openGL, and I am currently using a kinetic sweep and prune algorithm for the broad phase and then using GJK Raycast + GJK & EPA for the narrow phase. ...
125 views

### How to throw an object without having a curve trajectory?

I am making a game that slingshots an object using a line renderer. I wanted to know how I can throw my object when I unclick my mouse without having a curve trajectory like throwing a basketball to a ...
104 views

### How to make planets “stay together” on collision

I working on a 2D planetary orbit simulator and I've encountered a problem regarding the collision of planets. Currently, here is what I have ...
86 views

### Simulating Gas Density and Pressure in a 2D World

I'm building a small spaceship simulation app that looks a lot like a game for an upcoming talk I'm giving where I use this sample app to teach the F# programming language. This small app is ...
47 views

### How to search through large numbers of discrete objects that interact with each other, like Minecraft blocks?

Imagine you had a world like Minecraft, but wanted to bake in some sort of physics (okay, I was playing minetest actually). For example, blocks under too much pressure might break, limiting how many ...
17 views

### How do I stop my first person character going through walls? [duplicate]

As per my code: ...
398 views

### How to improve the charactercontroller for jumping?

I have an issue with my character controller, when I jump, it sometimes lands on surfaces it shouldn't be able to land on, like very steep slopes etc (even though my max slope is 45 deg). In this case,...
294 views

### Set Rigidbody velocity in FixedUpdate() or Start()?

I'm developing a simple 2D game in Unity (balls hitting bricks), so I have a ball and I want to fire the ball to hit bricks. Now, to fire the ball I have to set ...
125 views

### Custom steering system in Unity for braking and sliding

I am developing a game where the player controls a vehicle. But instead of using a first person view, the camera is top-down and orthographic. I tried using Unity's wheel collider system. While that ...
134 views

### Car simulation, motor torque and brake torque combine problem

I am creating a custom wheel collider in Unity. Every thing is fine now (suspension, collision, friction) except one problem that i cant get my head over for last 3 weeks. So now i have a car (one ...
44 views

### Creating a Pawn that simulates physics

I'm trying to make a Pawn that I can raycast against. Starting from the DefaultPawn object, I can't find a way to have a StaticMesh cube that simulates physics. My raycasting code works with Actors, ...
62 views

### Move an object with other objects connected (via joints) the right way

What is the best way to move an object with other objects connected to it via joints? Let's assume we have the following setup: A player that can move on the x and the z axis "Normally configured" ...