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

Rigidbody appears to jitter when placed as a sibling to a First Person camera

In my game, the Player can pick up an object (which gets parented to the first-person camera), or the player can push an object (which is parented to the player, but not their first-person camera). ...
0
votes
1answer
38 views

Colliders slightly intersecting each other; any solution?

Consider this simple scene: In Unity, colliders slightly intersect each other. Typically, this isn't a problem. However, I want to make a custom character controller using a box collider and not a ...
0
votes
1answer
16 views

Applying wheel sideways friction to car

I'm applying sideways friction to my car from each wheel, but for some reason my car starts to accelerate forward instead of having forces acting sideways and stopping it. This is the script: ...
0
votes
0answers
11 views

How can I prevent two rectangles from overlapping?

I have two rectangles defined by their respective left, right, top and bottom. I'm trying to prevent the collisions for these two rectangles but I cannot find a working solution. I am obtaining the ...
1
vote
1answer
30 views

Unity raycast equivalent in Unreal

I've been moving from Unity to Unreal and I'm finding it difficult to grasp the Raycast (Trace) logic of Unreal. The use case I'm trying to implement at the moment is to trace a ray and check if I ...
0
votes
1answer
20 views

rigidbody cube falls off the ground

Inspite my ground and cube contains colliders as i apply rigidbody it falls down....use gravity
0
votes
1answer
42 views

Godot: How do I get the id mask for a physics layer by name?

I would like to figure out whether a collider is in a physics layer by the name (string) I set in project settings: ...
0
votes
0answers
30 views

Swinging rope using Velocity Verlet integration is lossing way too much energy

This is a tough question. I tried implementing velocity verlet using the c++ implementation on this Wikipedia page: https://en.wikipedia.org/wiki/Verlet_integration I then added some constraints to ...
1
vote
0answers
27 views

Rigidbodies gaining speed when they shouldn't

I'm trying to get the effect of a constant magnetic field on a charged particle. A really important aspect of this is that the magnetic field doesn't do any work on the particle, which in this case ...
0
votes
1answer
61 views

Hinge joints chain movement (2D)

I have some problems with hinge joint chain movement calculations... Here is my algorithm for segments location/rotation adjustments after a previous segment update (C#): ...
0
votes
1answer
30 views

Box Collider 2Ds float just above each other in Unity

I'm learning 2D Unity and am experiencing a very strange problem. When I have 2 objects both with Box Collider 2D and a RigidBody2D, and one of them is set to be static so it doesn't move, the other ...
3
votes
1answer
167 views

Time complexity of solving constraints in physics engine

Erin Catto mentioned in a talk that solving constraints precisely requires cubic time and quadratic space. What algorithm is he talking about when he mentions cubic time? pdf of slides with following ...
1
vote
1answer
38 views

When setting Rigidbody.isKinematic true collider won't work anymore

I have a rigged 2D character and used Collider2D/Rigidbody2D/HingeJoint2D to body parts to implement ragdoll. It works fine, but I needed to run ragdoll physics only when character is dead. So I made ...
1
vote
0answers
42 views

Aerodynamic Physics

The current unity physics engine is limiting in the sense of drag. It's just not good enough. After a lot of internet sailing... I found this post. https://stackoverflow.com/questions/49716989/unity-...
0
votes
0answers
64 views

How to increase the speed of a projectile?

I am working on a project where I am launching a projectile and according to the following snippet: ...
1
vote
1answer
71 views

How to apply linear drag to a velocity vector?

I have built my own movement code for my character as I want to make smooth movement. (This project is just a character and a floor/wall for testing). The code seems to work fine, but I of course ...
0
votes
2answers
46 views

How to calculate the post Rigidbody2D velocity vector before applying a specific force in Unity?

I am trying to implement a space rocket in 2D. Whenever the player presses a button, a constant force (Both vertical and horizontal) is being added to that rocket. What I want to add is a maximum ...
0
votes
1answer
64 views

What is wrong with my gravity calculation?

Im trying to create a method to calculate the fall time for an object using real formulas. Well I came up with this: ...
0
votes
1answer
70 views

How do i writing timing function for lightning flash in C++?

I need to write a horror scene with lightning flash. Unfortunately I am new to both C++ and OpenGL and I am looking for efficient way to mimic lightning timing in C++/OpenGL? I don't need graphical ...
1
vote
1answer
62 views

How can I blend an animated character with ragdoll physics collisions?

I'm trying to make an effect that a ragdolled character controlled by an animator also affected by the physics collisions. Similar to this game: Crazy Shopping. The problem is animator controller ...
2
votes
1answer
52 views

Unity RigidBody not rebounding as expected on low-impact collisions

I have a Rigidbody2D with a CircleCollider2D, on which I display a sprite of a circle. This Rigidbody can be "shot" in my game. I also have 4 rectangular BoxCollider2Ds on the edges of the game ...
0
votes
0answers
25 views

Pushing an object on other colliders makes the pusher object go through

The Wall moves to the right and pushes the Character with it. The character travels along a bunch of Blocks with colliders attached to them. This is the result: At some point, the Character gets ...
0
votes
1answer
43 views

Vertical push doesn't let the object fall down instantly [UNITY]

An object (Wall) is continuously moving forward on the X axis with a simple script: ...
0
votes
0answers
40 views

Why isn't OnCollisionEnter being called?

I have a hammer and an object to be hit in my scene. I put this line Debug.Log("Collided with" + collision.gameObject.name); to debug whether the function ...
0
votes
1answer
73 views

Collision detection / physics for simple game

I am currently working on a mini game for class (first time doing something like this) and I don't really know how to start with collision detection at all. The game I'm creating is a top down sumo ...
0
votes
1answer
90 views

I am having trouble with gravity in my game

I am trying to detect if the player is on an object with a tag "canHoldWeight". But the detecting if the player is on an object isn't working. falling code called every tick: ...
2
votes
1answer
115 views

Game Either Runs Poorly or at Different Speeds

I'm making a simple 2D shooter game using C++ and SDL2. For my main game loop, I used the code from the famous Fix Your Timestep article. The problem is that, because I'm using a fixed delta time, the ...
1
vote
1answer
50 views

Unexpected behavior of bodies affected by gravity in 2D

I have a simple code that calculates the acceleration of a body every update of my simulation using the Newton's law of universal gravitation and the second law of motion. ...
0
votes
0answers
33 views

How do physics bones relate to animation bones?

Skinned animations use a tree of bones where the child bone (say a finger) is the weighted sum of the rotations of all it's parent bones. Physics bones are defined as a rotation matrix of a primitive (...
0
votes
0answers
30 views

Physics2D.OverlapCircleAll with layerMask not detecting anything

The problem is pretty straightforward and apparently unsolvable. When I use Physics2D.OverlapCircleAll without layer mask it works fine, if I try to use a layer mask it won't detect anything. I AM ...
0
votes
2answers
70 views

Ensuring dash toward mouse position is always a consistent distance

I'm making a 2D game where the player character should dash toward the mouse position when the player clicks, but the dash is currently not a consistent distance each time. Let's say you put the ...
0
votes
0answers
70 views

How to make parabolic jump from a to b to c and so on?

I want to make a game similar to "Dancing HOP: Tiles Ball EDM Rush" I am trying to make an object jump from point a(z=0) to b(z=10) to c(z=20) and so on, keeping the z axis distance constant for each ...
1
vote
0answers
69 views

Game loop stutters

I have the following game loop: ...
0
votes
0answers
40 views

Elastic Collisions in Unity 2D

I am trying to create elastic collisions in 2d game in unity. I have a ball surrounded with a polygon collider and im calculating the reflected vector using the ball velocity and the normal at the ...
0
votes
1answer
35 views

How can velocity be normalized after a collision if a projectile needs to maintain its height?

I want a thrown disc to travel along the same height, even after collisions. The problem is, there's an edge case that I'm not sure how to deal with. The lowest-tech solution would probably be to ...
1
vote
0answers
75 views

Calculating spaceship course

There is an idea for (soft) sf strategy game following me for a long time but I need to get a grasp of some math before moving further with it. Lets assume there is a spaceship traveling (in space) ...
0
votes
0answers
15 views

Set parent by property

In the editor's hierarchy, if I drag and drop one object onto another, the second becomes the parent of the first, and moving the parent will cause the child to move. I see I can set this relationship ...
41
votes
1answer
4k views

How to differentiate landing on top of an object from falling down the side?

I am looking for a conceptual solution to my problem. It's a simple platformer-alike game where player can move horizontally during free-fall. Consider those two cases: In the first case, from game ...
0
votes
1answer
66 views

How do I account for the velocity difference between a ship and it's fired projectile?

In my project, I have a ship that moves and increases it's movement speed with respect to time and how long the acceleration button is being pushed(just like the way a real life car works), now as ...
0
votes
2answers
132 views

Why does my Enemy A.I stop moving when it hits the wall, and how to fix it?

I am making my 2D platformer game at the moment, and I am still a beginner. I saw this tutorial on youtube in which he showed how to make an enemy a.i move. He manages to move it but he didn't show ...
0
votes
1answer
39 views

Is there a standardized way for creating a 2D ball physics movement method?

Is there a standardized method for creating a 2D ball physics movement like you can see on gif below?
0
votes
0answers
36 views

Can’t find component Unity

so, I want to add a Cloth component. I click on a gameobjects, press “Add Component” in the Inspector search “Cloth” And nothing comes up. From my searches in google, nobody had such a problem ever, ...
0
votes
0answers
20 views

bullet raycast vehicle - compound shape and center of the gravity/mass

I use btBoxShape as a collision shape for a chassis rigid body (raycast vehicle). An initial vehicle position is defined by btDefaultMotionState during chassis rigid body creation (a vehicle is ...
1
vote
0answers
62 views

Rolling a circle around a square

I am stuck on a simple Box2D task. I have a box and a ball (in top-down view so no gravity), and I would like the ball to roll around the box. Here is my code. Basically now I am trying to detect ...
0
votes
0answers
42 views

Grappling hook force resolution

Our team is creating a 3rd person adventure platformer in Unreal 4.22. One of the mechanics is a grappling hook. Think less-so a 'pull-to-point' grappling hook (Widowmaker, Just cause etc.). However ...
1
vote
1answer
74 views

Why is my player not giving a knock back when it stays at the right side of the enemy?

So, I have this problem I am facing, for some reason my player does not get a knockback when it stays at the right side of the enemy but when it stays at the left side it gives a knockback. What's the ...
0
votes
1answer
31 views

KinematicBody returns null to try get collided Rigidbody

Player is a KinematicBody and enemy is a Rigidbody. I'm using move_and_slide() to move player. When they collided, each both push them opposite direction, so it seems like physics stuffs working, ...
0
votes
1answer
31 views

Updating RigidBody rotation and velocity only updates it's rotation

I'm currently making spaceship controller script. Control is simple, W/S to move forward/backward, A/D/ to rotate ship by Y Axis(yaw). Spaceship is RigidBody node and has CollisionShape as children. ...
0
votes
0answers
37 views

RigidBody Collision Handling with Verlet Integration

Hi I'm reading the Jakobsen Paper "Advanced Character Physics" which explains how the verlet integration along with a tetrahedron (4 particles) can form a structure usable for rigidbody (with 6 length ...
0
votes
1answer
64 views

Add impulse and torque to a cube

I would like to spawn a cube if I press space and apply a short impulse of force and torque to make the cube rotate. I have some calculations for the impulse but I think they are wrong since the cube ...

1
2 3 4 5
40