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
19 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
41 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
29 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
25 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
73 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
10 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
34 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
20 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
40 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
19 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
21 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
69 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
26 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
30 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
55 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
33 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
47 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
23 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
42 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
78 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
57 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
35 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
29 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
27 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
112 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
72 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
22 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
125 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
26 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
29 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
15 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 ...
0
votes
0answers
27 views

How to have 3d multiple planet gravity in unity c#?

Im using unity and I want to make a game where you can walk around small planets and the further away you get, the weaker the gravity, so you can go to other planets. All the tutorials so far only ...
0
votes
1answer
35 views

How to move through a game object - while getting the normal of the initial contact

In Unity, how can I detect a collision between two game objects, but have them pass through one another, i.e. not block each other? Specifically, I need the collision normal provided by the ...
0
votes
0answers
38 views

Unity rigidbody velocity

In Unity, what is the correct way to move a game object by modifying the velocity of its rigidbody? I'm having some issues with stuttering movement, so I just want to make sure I understand the basic ...
0
votes
1answer
62 views

Capsule getting stuck on edge of block

I'm making a first person game and when I jump and my character gets close to the top of the wall, the vertical movement stops, jitters, or suddenly snaps to the top of the wall. Video Here is my ...
0
votes
0answers
16 views

objects are keep falling [duplicate]

I added some screenshots above. When I run the game obstacle are falling rapidly through y axis. So, there's no more obstacle in that ground. If there's ground than ...
0
votes
0answers
19 views

Creating a simple ripple propagation with variable resolution

I am trying to do a simple simulation of a ripple propagating through a medium. I do not have a physics engine at my disposal so setting up a complicated set of spring constraints doesn't seem to be ...
2
votes
1answer
64 views

How to calculate gravity vector based on device rotation?

I have basic scene where the cube sits on platform What I want is if the device is rotated 90 degrees to the left, cube should fall down as shown below I came up with a solution to tackle that by ...
0
votes
1answer
24 views

stop object while falling

The object have forwardForce. ...
0
votes
1answer
54 views

Need help projecting 2D projectile motion in 2.5/isometric 2D game

So I’ve been researching this a lot and have hit a road block. I’ve read pretty much every thread on here regarding this and while I understand the concept I don’t understand how to implement it. For ...
0
votes
0answers
18 views

Discrepancy in Box2D Flash applied impulse

I have two clients. Player A, and Player B. What Player B sees in his screen is a mirrored version of what Player A sees. This is a carrom game, hence the mirroring. Does anyone know why even if I ...
1
vote
1answer
42 views

Is an inertia tensor in local-space always diagonal?

I'm looking at the implementation of a physics engine and I observe that the inertia tensor of a rigid body, in local-space coordinates, is stored as a 3 dimensional vector, rather than a 3x3 matrix, ...
0
votes
0answers
105 views

Why do edges make the player jump?

I'm making a 2D platformer with Unity and I have a problem with platform edges. This problem is usually visible in the situation where I want the player to walk up the stairs by jumping, but the ...

1
2 3 4 5
43