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
1
vote
0answers
44 views

How to make Player consistently jump *to* a specific target rather than *towards* it?

I'm trying to make it so if my player hits "E" then they jump precisely to a specific target. The current code results in player jumping towards the target but not really making it there. I'...
1
vote
1answer
34 views

How to calculate the force for the fragments correctly?

I have a wall on which you can shoot cannonballs from a cannon, after hitting, I replace the wall with fragments of it. How to correctly apply force to the fragments of the wall after being hit? ...
2
votes
1answer
86 views

Should delta be applied to every change per frame ? (e.g. acceleration, deceleration, jump, etc.?)

I have written a game based on another game's original physics. I have all the constants the original game used in the Sega Megadrive. For example: ...
0
votes
1answer
84 views

How could I move an object, while respecting the gravity and other related physics in Unity?

How could I move an object, while respecting the gravity and other related physics in Unity? I tried using the following approach: ...
0
votes
1answer
68 views

Why is JumpHeight of 7f not visibly lifting Player off ground?

I'm using this code for Jump but when Space is hit, the character looks like they don't move. I played with JumpHeight and it turns out the jump does work; it just takes like 50f for it to finally ...
0
votes
0answers
10 views

Can't move up the CharacterController after applying gravity

I'm making a player with CharacterController and having trouble with handling gravity. Here's the code: ...
1
vote
1answer
42 views

Making Sprite Movement Appear More Natural

Currently I have a 2D game in which the player and a computer controlled (non-player) sprite move from point to point collecting tokens in a continuous environment. The player and the non-player ...
1
vote
1answer
20 views

A concise set of equation of physics that handles basic 2d physics for acceleration?

I am making an Asteroids clone and I want to implement proper physics for the objects. What equations would I use to calculate the acceleration? For example, I have a ship, and it might have ...
0
votes
1answer
20 views

How to detect all vertices within collision Area?

Using collision detection algorithms such as MPR (Minkowski Portal Refinement), GJK (Gilbert–Johnson–Keerthi distance algorithm), you can calculate the penetration depth in the collision. For 2 mesh ...
1
vote
0answers
46 views

Why do large creatures in some games seem like they have no mass when rotating? [closed]

Why do large characters/creatures in some games seem like they have no mass, especially when the pivot on X axis to change their heading? Imagine a space game where there is a large ship. Typically ...
0
votes
1answer
64 views

Top-Down Tank Physics with Pygame

I am trying to make a top-down tank shooter game in Python and pygame, but I can't get the tank movement right. My objective is to make it move forward in the direction it is pointing in which would ...
0
votes
0answers
26 views

How can I make a wheel spin more freely using joints in Unity?

I am making a simulation physics based skateboard game in Unity3D. I want wheels that will roll freely based on the physics applied to them without any animation or drive forces. I achieved this ...
0
votes
1answer
48 views

How do I make a bomb sight accurately?

On the Bombsight Wikipedia page, I get that equation. I do not understand it very well. How would I go about writing that in C#? The drag doesn't matter in my project. It's not a flight sim. I know ...
0
votes
0answers
16 views

How to ensure that a randomly-generated velocity vector moves the camera forward within a valid arc?

I spawn a camera in a scene using random coordinates for x and y and setting z=0 and orient ...
1
vote
0answers
26 views

Unity 3D - Grappling Gun not making Player lift off the ground at all?

I have the following code (based on https://www.youtube.com/watch?v=Xgh4v1w5DxU but tried to convert to work with world space points for Third Person Character usage): ...
1
vote
0answers
48 views

Godot cutout animation with skeletons and ragdoll physics

i'm following the tutorial for cutout animation, but also wanted to combine ragdoll physics from this video, my goal is to make a 2d fight game with this 2 techniques. but not sure how to combine them ...
0
votes
0answers
54 views

How to decay sine or cosine wave so it takes one additional period to reach equilibrium

In many shmups, when enemies arrive, they accelerate onto screen, decelerate, and overshoot their static arrival position slightly, before backing up slowly to the position. This can be seen in many ...
1
vote
1answer
39 views

Box selection with Physics2D.BoxCastAll is mirrored when selecting in the bottom half of the screen

Using Physics2D.BoxCastAll based on rectangle is working fine when drawing is started on the top part of the screen, but when drawing is started on the bottom you can see this strange mirroring effect....
1
vote
1answer
38 views

Instantiated entities don't collide with each other

I've started to learn DOTS some day ago, and decided to create a simple project. When I added some simple physics to the game I faced the problem. I added one object on the scene and another ...
0
votes
0answers
17 views

How to make a variable height jump controlled by parameters?

I'm trying to make a variable height jump controlled by parameters. I want to be able to specify the max height of my jump, and a time to max height. I also want to be able to specify a min jump ...
4
votes
4answers
1k views

Physics-based marble race: how can you minimize the gap between first and last?

I'm building a 2D sideview marble game, where they race down the track via gravity. The problem is that once one gets ahead of the others, it usually wins. In racing games, they can address this by ...
1
vote
1answer
81 views

Calculating new Velocities of split Physics Body

Given a Physics body with all his properties i want to break the body into two or multiple parts that keep the original velocities. for linear velocity this should be original velocity + centrifugal ...
1
vote
0answers
76 views

How can I allow the rope to correctly interact with Box and Polygon colliders?

In order to build 2d rope physics in my game, I download the github project from Jongallant in this link. In my game, I want the rope to collide with objects with different types of colliders such as ...
1
vote
0answers
24 views

How to connect a UPhysicsConstraintComponent of an AActor to an FKSphylElem (capsule body) of a ragdoll?

I'm trying to connect an Actor's UPhysicsConstraintComponent to a capsule body of a ragdoll. The reason I do it this way, instead of just using sockets on the ...
1
vote
1answer
42 views

Add inertia to Pawn movement

I've just started to learn Unreal Engine 4.26.2 while developing an Atari Pong clone. This is how I have implemented the Paddle's movement (but this implementation doesn't accelerate or has inertia): <...
0
votes
1answer
26 views

Make platformer character stay in the air at the top of a jump

I have a player who can jump. I want the character to stay in its position and not fall to the floor. This is the code I am using so far: ...
0
votes
1answer
104 views

Stop 2D platformer character from sliding down slope

I'm making a 2D platformer game with the default Unity 2D physics. I am implementing slopes, but my player slips down the slope because of the physics. Here is the code I use for the player movement: ...
1
vote
0answers
34 views

How to make a catapult work with physics and colliders?

This should be my final question regarding getting a catapult to throw something in unity. On my last question, someone suggested starting with something simpler (which I apologize for not doing ...
0
votes
0answers
51 views

How to stop a decelarating object?

I am programming a 2D game. When a ball is launched it should decelerate and eventually come to a stop. I have implemented the deceleration part but when the ball nearly stops it starts accelerating. ...
1
vote
1answer
33 views

How do you make objects be pushed away from you?

like pain from naruto, I wanna be able to press a button and be able to push objects here's my push method ...
0
votes
1answer
40 views

Collider for Unity Line Renderer

I have several line renderers that are using as gas pipelines. A user can select one end of the pipe and attach it to one connector. Now the problem is some pipes (line renderer) are overlapping and ...
0
votes
2answers
84 views

Does friction only apply in opposite direction of motion?

Let's say an object is sliding on a slope and is the object has a velocity of (0,0,5). The friction would be acting in the opposite direction of motiong, being (0,0,-1). However, gravity is also ...
0
votes
0answers
13 views

Unity 2d overlapCircle melee combat issue

I have an issue with my overlapCircle melee combat in the game. I'm not good at such things, so I just copied that code from some YouTube tutorial. But the thing is ...
0
votes
0answers
92 views

How to weld nearby mesh collider vertices together to erase seams in Unity?

I'm using Unity 2020.3.2f1 and I have a very commonly seen problem. I have a Spherecollider which I am using for a physics game, and geometry that uses ...
0
votes
1answer
98 views

How do I adjust my rigidbody velocity on a local axes?

I have an fps rigid body script, code listed here: ...
1
vote
0answers
43 views

How can I calculate the inertia tensor of a hollow object defined by a triangle mesh?

I want to calculate the mass, center of mass, and inertia tensor of player created objects. Some of the objects will be hollow instead of solid. I am creating a closed triangle mesh for their object. ...
0
votes
0answers
22 views

Calculating the bouncing ball bounce height while on platforms

I tried to calculate the bounce height for the bouncing ball however it ends up shaking against the moving platform after it finishes bouncing. grav_val in this ...
0
votes
0answers
23 views

How do I correct the turning effects on my car in order for it to turn properly?

In my game, I'm currently working on a Physics-based car driving game in Unity from scratch. My problem is that whenever I press the input controls used for turning, instead of turning, my car does ...
0
votes
2answers
75 views

How do I set the size of a single 'unit' in my game?

I'm currently trying to remake/port an old game created on Unreal Engine 2.5 to my own engine, and I have access to its physics data. It's using a scale of 80 units per meter, or 1 unit = 1.25cm. The ...
0
votes
1answer
28 views

Predict future position of a moving body in Phaser arcade physics

I am looking for an equation for predicting the future position of a moving arcade physics body in Phaser 3. The body has drag applied and isDamping set to true. Phaser applies the drag using the ...
0
votes
0answers
13 views

How to follow an object with the player without stepping out the waypoint line Unity3D?

How to follow an object with the player without stepping out the waypoint line? I added four waypoints with a debug.line and tried doing some simple waypoint mechanic. I wanted the object to move from ...
0
votes
2answers
44 views

Coins are solid objects and I can't collect them

I am just starting out with Unity following along with this video, and I am stuck at roughly 1 hour and 54 minutes in: https://www.youtube.com/watch?v=pwZpJzpE2lQ It is worth noting that the video ...
0
votes
1answer
60 views

Is speed and direction generally combined into one vector, or separated into two?

Couldn't find this answered already, surprisingly. For example, for a game (in my case a 2D top-down one), there could be advantages to doing so. For example, whenever you want to change an entity's ...
0
votes
0answers
43 views

How to perform a sliding collision between a square and a circle?

Please point me to the duplicate if this has been asked before. I couldn't find it. Basically, I am creating a 2d top-down game where the player is represented by a circle, and the tiles are ...
0
votes
2answers
49 views

How to make the snake bodyParts follow same places and directions as the player on a curved surface?

I try to make a game like the classic snake game but on a round ground (Earth). On a plane, the script works well, but when i moved it on a sphere, the bodyparts (prefabs), are not working good as you ...
0
votes
1answer
39 views

How to use a Rigidbody on a game object after animation in Unity?

How to use a Rigidbody on a game object after animation in Unity? I want to play an animation fully controlling the positioning of the elements, i.e. ignoring physics. And after an animation plays ...
0
votes
2answers
33 views

How to avoid entities flying far away when tabbing out and then tabbing back in?

I'm developing a game which uses a standard Entity-Component-System. Every frame, the PhysicsSystem runs, which, among other things, updates the position of ...
0
votes
0answers
27 views

What is the science behind 3d collision relative to the ground?

To my understanding you have the model of the character and the model of the map. It seems extremely redundant and process intensive to have to calculate that the ground exerts a force on the player ...
0
votes
1answer
56 views

Select specific tile in Tilemap

I am following this video tutorial on how to implement drag-to-select behavior like in an RTS. The only difference is, I'm using a tilemap. The selection area is a square which I can drag to make it ...
0
votes
3answers
108 views

Calculate angular velocity from rotation matrix difference

I am working on something for a game. I need to calculate the angular velocity, however in my situation I only have access to the previous rotation matrix and the current rotation matrix (and some ...

1
2 3 4 5
44