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
0 answers
31 views

Why does holding the jump button cause the player to go higher each time they hit the ground?

Why is it that when I hold the jump button, my player character keeps going higher and higher each time it hits the ground? Here is my code: ...
0 votes
0 answers
48 views

calculate projectile velocity from moving shooter

I have a task which i have a moving ship that can shoot in any direction i want. i have to shoot to standing or moving nearby objects. the problem is, I can't correctly calculate true shoot direction....
  • 113
0 votes
1 answer
23 views

Determine when object moving along Bezier Curve and an object along a line collide

I have been using the method here to find the intersection between a line and a curve but, I am not too sure how I would go about solving the time for when two objects moving along their respective ...
  • 1
0 votes
1 answer
61 views

Switching a velocity from one rigid body to another in unity

I have a set up where the ground and the player move with physics and a stationary camera. I want the ground to move faster when the player is getting further away making it look that the player is ...
  • 123
2 votes
0 answers
53 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, ...
  • 151
0 votes
0 answers
21 views

Vehicle with wheel colliders always tilting

I wanted to make a tank, but there is an issue with it where it always leans a few degrees to the right. Even though it's modeled after a tank, it drives like a car, with 4 wheel colliders. When I ...
  • 113
0 votes
0 answers
32 views

Is it a good idea to solve movement of solid bodies with restrictions (e.g. connections) by shifting tangentially and projecting normally in phase sp?

I am trying to code my first 2d game with physics (in python), and so far my physics simulation works with solid bodies. I want to add connections, for example, so the player can rotate an arm and ...
0 votes
0 answers
26 views

How can I debug a y-sort clipping issue?

OS: Mac Godot 3.5.1-stable Language GDScript I have created a Level object as a YSort. Under it I have a ColorRect, 2 Tilemaps, a Tree Scene, and the Player. The tree scene is composed of a ...
  • 101
0 votes
0 answers
67 views

rigid body 3D physics simulation: how to move from Euler to Runge-Kutta (RK4) integrator?

I have followed Physics for Game Developers to implement a basic vehicle simulation (3D Vectors and Quaternions) involving thrust and fluid drag and lift. But it explodes in steady state (some values ...
  • 121
1 vote
0 answers
28 views

Polling Behaviors with Geometry Based Collision System

This one's going to be interesting to explain. Let's say I'm making a geometry based collision system for a platformer, where polygons exist based on the lines that form them. I'm using some basic ...
1 vote
0 answers
50 views

How to make entities fall through illuminated side of collider?

I'm trying to make a prototype, but I'm still new to Unity so not sure what's the best approach to take. Consider this arena: Essentially, I want the shadowed parts of the outer rectangles to behave ...
0 votes
0 answers
39 views

How to move a Rigidbody2D to exactly match the movements of another body?

I'm recording the velocity of a Rigidbody2D using Animation Curves and I need to reproduce the same "movement" on an instantiated prefab (we really need "stuck like glue" movement ...
  • 219
2 votes
1 answer
706 views

"Slowing physics" only for certain objects?

I'm trying to simulate a time-slowing effect in Unity, which is supposed to slow down things like the physics engine, animator speeds etc. However, I also need certain GameObjects to be "immune&...
0 votes
0 answers
59 views

Why doesn't jumping work if character is on upwards slope and moving forward?

I am having an issue where when I hit space to jump, the jump will only work (as in, launch player straight up into the air) only if I am (1) on flat ground (moving or standing still), (2) on a ...
  • 47
1 vote
0 answers
43 views

Pushing Multiple Objects With Static Friction

Given is a set of objects at rest that are in contact with each other, external forces that are applied to them and static friction forces (forces that counteract an applied forces up to a maximum ...
1 vote
1 answer
53 views

How to settle a rigid body to rest on flat surface

I am trying to simulate the behaviour of a rigid body, for example a cube, while it settles on a flat surface. Let's say it lends on an edge or even on a corner, and now it has to settle and remain on ...
2 votes
0 answers
28 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/...
0 votes
0 answers
40 views

How can I combine physics and animation to make a believable death sequence?

I am quite new to working with physics and rigidbodies. So far I've managed to push the body in the opposite direction from where they are hit by an arrow. But I am unsure of how I can combine this ...
  • 349
0 votes
1 answer
24 views

How do I contain two rigid bodies with a relative position, while ignoring rotation?

This question is physics engine agnostic (could be Box2D, Bullet, whatever). I have two rigid bodies, each with a single fixture/shape. One is a sphere, and one is a box. I'd like the box to rotate ...
  • 590
0 votes
0 answers
30 views

Box2D simulation super slow during vsync

I've been developing my own game engine for the past few days and it's time to add physics. But before adding it in the editor itself, I opened a separate project and tried box2D with SDL2. I always ...
  • 31
1 vote
1 answer
40 views

How to draw/calculate a parabolic arch to hit stationary target in Javascript

First off I must admit I'm really not good at math and am trying to learn but have had a hard time finding examples someone like myself can follow. I'm trying to figure out how to draw and calculate ...
0 votes
0 answers
57 views

How to launch a 2D character toward the mouse position?

I want to launch a 2D character using the mouse, but for the life of me I can't figure out how to get the character to move left or right during the launch. Its as if the code is ignoring the X axis ...
0 votes
1 answer
43 views

Bullets shooting all over the place

I have created a simple player controller, which contains the player logic for a movement, aim and shooting bullets from a gun. Everything almost works, except the bullets shoot in random directions, ...
1 vote
1 answer
96 views

How to properly port 30 FPS physics with integers to 60 FPS and maybe floats?

I've inherited a code base in which everything is coded to run at 30 FPS and uses integers. I would like to upgrade the frame rate to 60 FPS, naturally I thought about using floats but it ain't that ...
  • 773
0 votes
1 answer
106 views

Detect collision occurring on a parent CharacterController from a child object

I'm creating an audio script for my character and it changes the sounds based on the textures it is walking on. Said character uses a Character Controller component from Unity and I thought of using ...
0 votes
0 answers
98 views

Kinematic Rigidbody parented to a moving Rigidbody gets displaced

I have a kinematic Rigidbody parented to another non-kinematic moving Rigidbody. Render-wise, the child Rigidbody does not jitter, nor does it inherit any displacement changes from the parent ...
1 vote
1 answer
74 views

What is the minimum number of points in a convex hull in most engines?

A convex hull shape in a 3D game engine defined by vertices needs at least 4 points in order to have volume, since that would make it a tetrahedron. However, some game engines may support fewer points,...
0 votes
0 answers
27 views

Motion of a cube after it bounces off a floor

I am trying to simulate what happens when a cube hits the floor after free fall. I am considering a situation in which cube hits the floor with its edge. There is obviously reaction force from the ...
0 votes
0 answers
49 views

How to detect collision on child of Rigidbody

I have a child GameObject with a collider that only gets enabled by an animation event. The Rigidbody is on the parent ...
0 votes
1 answer
67 views

Bouncing ball with Euler integration loses speed over time

I am trying to implement free fall motion of a ball towards a plane. I implemented collision detection and if collision happens, I change sign of velocity of a ball so it bounces off and climbs back ...
0 votes
0 answers
26 views

Specify endpoints and orientation of FixedJoint created programatically

I'm creating a VR game with Unity using XR Interactive Toolkit with physics based hands which follow the controllers around, but collide with objects. So if you reach through a stationary object, the ...
1 vote
1 answer
108 views

How do I make multiple circles bounce of each other

How will I calculate the direction of the circles when they hit each other? (there is no change in speed, there is no mass, and all circles have the same radius) ...
  • 13
0 votes
1 answer
61 views

How do you resolve continuous collision in a multi body system?

I've been trying to figure this out for weeks but every resource only provides answers for a single body. As far as I can tell for a single body you Find the time of impact Step up to that time ...
  • 1
0 votes
0 answers
25 views

Dynamic bodies falling onto static body tunnel through each other or fail to bounce

I have a problem with Box2D when 2 dynamic bodies fall onto a static body located below when their restitution is non-zero. They tunnel through each other instead of a rigid elastic bounce. If I treat ...
1 vote
1 answer
176 views

Collision normal for sphere near edge of triangle face

When my sphere (or bottom part of a capsule) moves with its bottom near the edge of a mostly horizontal triangle (a face of a heightmap), I am sometimes getting very bad (mostly horizontal) normals. ...
0 votes
0 answers
53 views

2D physics engine collision issues

I'm currently stuck developing my own simple physics engine. I'm getting an issue where objects wont come to rest. Instead, they jitter and eventually are shot off into the distance, and some even ...
0 votes
0 answers
54 views

Different approaches to rigid-body movement

I'm a beginner at game development and I'm building my own physics game engine to grasp the concepts. I wonder if there are different approaches to moving and rotating a rigid body. For example, ...
  • 1
0 votes
0 answers
165 views

Simulate Physics causes Actor to fall through ground when player interacts

I've set up a simple code that allows the player to use a line trace to pick up objects and assign them to one of three sockets on the character mesh. I then set up the ability for the player to ...
0 votes
0 answers
71 views

Solution for back-and-forth jitter when sliding down terrain slopes?

I've got a C++ app where the player is represented by a vertical line segment, walking on triangulated terrain. There's some terrain sliding that allows you to walk on the terrain as long as the ...
  • 69
1 vote
1 answer
116 views

How to roll two dice so they land on pre-determined numbers? [duplicate]

I am developing a game in Unity in which you throw two dice which should roll normally, but you have to get a predetermined output based on the user input. Say the user enters 2,5 and presses enter, ...
0 votes
2 answers
90 views

Changing falling behavior of my object after collision to go gradually down and not instantly

Context I'm here today to figure out how can I have an object to fall down after colliding to another object. In my case, I'm remaking Flappy Bird and trying to reapply some of the physics in place ...
0 votes
1 answer
77 views

How to move on vertical wall with gravity ticked for rigidbody

I am making a ball-rolling game. I want to implement an interaction where the ball can move on a specific area of a vertical wall like the game that the images show, but I don't know how to implement ...
0 votes
2 answers
131 views

Cue ball direction after collision

I am trying to figure out the velocity of ball A after collision, which is V2.A as seen in the figure. I know that the velocity of ball A is perpendicular to the line connecting centre of ball A and B ...
  • 57
0 votes
0 answers
85 views

Collision normal in a manifold between two rectangles

I am writing a physics engine by copying codes from an existing one. For collisions I need the collision manifold with the following information: Collision Point 1 Collision Point 2 Collision Normal ...
  • 237
0 votes
0 answers
67 views

Explaination of Extrapolation from Game Programming Patterns

I'm looking for help because there is one thing from the game loop which I don't clearly understand. I'm in some way of doing implementation of my own 2D game engine based on book „Build Your Own 2D ...
0 votes
0 answers
44 views

How do I implement rigid body collision response out of particle simulation with extended position based physics

could you please take a look at this simulation and tell me how can I fix it, it works best on mobile: https://eguneys.github.io/ode-solver/ I want rectangles to be draggable also respecting collision ...
  • 237
0 votes
1 answer
35 views

How to find combination of vectors to equal target velocity?

I have a space craft in a 3d world that moves along the X Z plane. Given that I have 4 thrusters with one at each cardinal direction, and the ship can rotate itself about the y axis. Is it possible to ...
  • 15
0 votes
0 answers
55 views

First jump when standing on trampoline is higher than subsequent jumps

I'm using Godot 3.4 with a rigid body for the player character, I added a few thing this character can do, like jump and jump higher with the help of a trampoline. Now, I know that rigid body has its ...
  • 61
0 votes
1 answer
40 views

Get component of velocity parallel to a normal

I would like to transform a rigidbody's world velocity into a local velocity based on a normal direction. When the rigidbody is moving towards and within a range of a object, I use a raycast to ...
3 votes
1 answer
123 views

Implementing a pinball flipper without tunnelling

I'm trying to create a pinball and flipper system in Unity. Unity has documentation specifically on a spinning body and a ball. I am using rigid bodies for both the ball and flipper. I've set the ball ...
  • 133

1
2 3 4 5
47