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

How to implement roly poly like physics in 2D? [closed]

I want to make a 2d character with roly poly like physics. I tried using Hinge Joint and other joints but results are not correct. Can anyone help me to understand how can I achieve it? Thanks.
0
votes
0answers
39 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
29 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
33 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
3answers
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
80 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
16 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
38 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
30 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
29 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
49 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
32 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
35 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
12 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
50 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
43 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
21 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
22 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
73 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
27 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 ...
1
vote
0answers
31 views

What is closing and separating velocity in Ian Millington's game physics book?

I'm working on a physics engine in C++ and chose Ian Millington's Physics Engine Development book as a guide and reference to help me out understand physics concepts and how to implement them. ...
0
votes
0answers
12 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
40 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
59 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
37 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
48 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
30 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
32 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
48 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
90 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 ...
0
votes
1answer
60 views

Making a 2D gun spin from recoil when it shoots

I am trying to clone the game "Flip the Gun" as an exercise. Here is the behaviour I have so far. And here is the code I am using: ...
0
votes
1answer
36 views

Problem with calculating velocity for a car with multiple gear ratios

I hope this is the right place for this but I have a problem with calculating velocity for my car game. The higher the gear, and therefore lower the gear ratio, the lower the top speed. Given that ...
0
votes
1answer
31 views

Making a parent system with euler angles (gimbal lock problem)

I have a system where objects can be connected to each other - as the parent rotates the child objects will rotate too and child objects themself can rotate too. The system is already working, however,...
0
votes
1answer
34 views

How to stop Players and Enemies from pushing each other

I am developing 2D Top-Down RPG game. I have script that makes my enemy follow the player, and when they touch the player, the player will start to lose HP. Everything works well, but when they touch ...
0
votes
2answers
113 views

Moving ship to new destination when already having a velocity?

Feel free to skip to the bottom and see the actual question. NOTE: Question updated below based on comments I am trying to make a space game and implement basic movement, unlike most, this is a ...
0
votes
0answers
52 views

Simulating linear inertia

I have an aabb (player) which can move dynamically - to get acceleration I am saving the previous previous position (through prevPrevPos, prevPos and pos acceleration will be calculated). Now I have a ...
0
votes
0answers
27 views

How to make googly eyes

I want to make googly eyes in Game Maker Studio 2 and I'm kind of close to what I want. I have a white circle object and a black circle object. When my black circle is colliding with the white circle ...
2
votes
1answer
81 views

Predicting trajectory of Box2D physics body using both: linear dumping and gravity

I would like to calculate position of physics body after some time because of predicting shots trajectory in my game. I found some great answer here where Iter Ator provides equation to calculate ...
0
votes
0answers
24 views

How do I add a third axis of movement for my character to go up and down?

My movement system at the moment is based off of a tutorial I followed. The tutorial is about moving with spherical gravity. I want to add another axis of movement so my character can fly up and down ...
1
vote
4answers
127 views

When an object is launched off-screen, is there any way to know if it's coming back?

In this scene, the object becomes invisible and then comes back In this scene, the object becomes invisible but does not come back Is there any way I can tell if an object will come back when it ...
0
votes
0answers
27 views

3D collision response advice for complex meshes

I am trying to use my own collision detection system in Unity to speed up my game. My problem is that when rigid bodies sit on top of static bodies, they will balance unrealistically on one edge or a ...
2
votes
0answers
25 views

How can I make my table move more realistically after a collision?

Using Unity 2020. I have a character using CharacterController and Rigidbody, colliding into the end of a long table. My table has, as a root object, the mesh and the Rigidbody. It also has, as child ...
0
votes
1answer
37 views

how to do rigidbody movement relative to player rotation in unity c#?

in my game the player is to walk around a sphere, I'm using rigidbody to apply movement with a joystick like this; rb.velocity = new Vector3(move.x, move.y)* speed; ...
0
votes
1answer
16 views

How to apply forces to character with gamepad in Unity?

I've been following Brackey's tutorial on this, see the excerpt from my code below. In his tutorial it only teaches "transform.Translate", how do I use this gamepad input system tool to add ...

1
2 3 4 5
44