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
16 views

How many 2d rigidbody can work in android? [closed]

I'm making 2d side scroller shooter with Unity. There are 2 main things that have rigidbody2d: Characters and weapons. Characters are player and enemies, and weapons are just weapons. However when I ...
3
votes
1answer
131 views
+100

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
31 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
40 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
59 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
67 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
42 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
59 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
67 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
49 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
45 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
24 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
42 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
36 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
71 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
88 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
112 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
48 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
32 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
22 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
55 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
69 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
66 views

Game loop stutters

I have the following game loop: ...
0
votes
0answers
19 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
34 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
72 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
65 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
124 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
35 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
16 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
61 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
37 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
73 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
29 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
30 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
34 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
59 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
vote
1answer
74 views

How to receive a Knock Back when the player touched the enemy

I'm still new to C#, making my 2D game atm and my problem is how can I give my player a Knock Back when it touches the enemy. How to add it with this code? ...
0
votes
0answers
40 views

Calculating approximations of support/forces between objects in Unity

I'm looking for ways to calculate how much a given object supports another in a scene. For example, imagine a box is on a table. In this situation we may say the table provides support to the lamp (...
0
votes
0answers
123 views

Unwanted angular velocity in unrelated axis (rigidbody simulation)

so real quick I'm simulating 3D rigidbody dynamics. This is what I have: ...
0
votes
1answer
52 views

Get project's gravity value in Godot

I need to get access project's gravity value which set in Project Settings -> Physics -> 3D -> Gravity, however I couldn't find any related information about this. How do I get project's gravity ...
0
votes
1answer
156 views

Velocity and drag in unity

So I have an object that is bouncing around the screen randomly, physics still works on it so it will speed up or slow down depending on what it hit and when. To try to normalize the speed I want to ...
1
vote
2answers
62 views

Resolving collisions after initial collision

Given a sweep test for a ray, how do we check collisions after the 1st collision has been detected, and the ray has been deflected. Physics system steps are: Update velocities (gravity, etc) Resolve ...
0
votes
1answer
83 views

Dealing damage over multiple frames without damaging the same enemy twice

I am using Physics.Overlap to find which enemies are in my damage range. But dealing damage in only one frame is not what I want. Some attacks should be active for ...
1
vote
1answer
24 views

How do the PhysWalking and similar functions actually handle input?

As the title may suggest, I'm developing a CustomMovementComponent and I'm on the stage where I am developing my own PhysCustom ...
1
vote
1answer
92 views

In a MovementComponent, where should I initialize member variables?

I have a MovementComponent derived from CharacterMovementComponent MovementComponent, ...
0
votes
2answers
57 views

Center Gravity in Unity

a 2d planet in the center, where the players will be able to walk on it and also will be affected by center gravity. planet will be static and there won't be any other planets. so; Is there a way ...

1 2 3 4 5 39