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
1answer
45 views

Problems with collision order of resolution

I have two objects, A and B, and I need help to solve the following problem about the collision resolution order: A and B are moving with the same speed, and they don't move both at the same time A ...
0
votes
1answer
33 views

How do I make an object bounce off the wall?

I am spawning objects at a random place at the top of the screen, tilted at a random angle like this: ...
0
votes
1answer
276 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: ...
0
votes
1answer
42 views

Making vehicle using WheelColliders faster

I have a driving game and use wheel colliders to control cars, but whatever I change with the WheelCollider components it doesn't get faster and is way too slow. The code of the controller: ...
0
votes
1answer
374 views

Swept 3d capsule intersection with AABB, what am I actually supposed to use to accomplish this?

I'm trying to figure out how to do continuous collision with a capsule (which would represent a collision volume for a player for example). Given how common the capsule is in many game engines, and ...
2
votes
2answers
148 views

How to predict where the soccer ball should be intercepted by an AI player after being kicked?

This question has been asked many times before, but most of the answers give solution to the problem where ball (target) is assumed to be moving at a constant velocity. In my scenario, I'm making a ...
2
votes
1answer
74 views

How to make mouse pointer be the vertex of a drawn parabola when estimating the trajectory of a projectile?

I'm trying to remake an old flash game using Unity. The main mechanic of the game is to make the basketball pass over the mouse. Here's a video of the game: https://www.youtube.com/watch?v=6sArMC1l_Sc ...
0
votes
1answer
54 views

Stretch line on bow using touch

I have drawn a line on sprite representing the string of a bow. I want to stretch it with finger touch input, using onTouch. I have added a Physics body but I don't ...
0
votes
2answers
415 views

How can I move and rotate an object along with another using vector math?

How can I move and rotate an object along with another using vector math? This is using Godot 3.1 using a KinematicBody2D as a ship with a ...
1
vote
4answers
158 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 ...
1
vote
1answer
599 views

OnTriggerEnter not working when placed inside Update()

I'm making a scanner that scans the "world" (like a 10 x 10 space), and I'm trying to sense a GameObject called pointer. They both have colliders, they ...
1
vote
2answers
47 views

How can I keep a mesh connected and upright?

I'm pretty new to both programming and Unity, and I honestly have no idea how to accomplish what I want to do. Scene: I have a Sphere which I can control with my keyboard. It rolls around on a plane ...
0
votes
1answer
103 views

Rotation of a 3D ball on a plane

This used to be on the physics stack exchange but I was told to put it here: I'm making a game (with physics) and I have a 3D ball rolling down a flat plane. It moves perfectly fine, but the rotation ...
0
votes
1answer
34 views

Reach a moving point smoothly

First, for my specific problem, we can assume we're working in a 1D space. I have a point B moving at a specific velocity V. I want to smoothly move the body A so it reaches the point B and moves at ...
0
votes
0answers
26 views

How to predict future position of body in solar system?

I have a solar system where each body interacts with each other by force F = Gm1m2/R^2 Is it possible to predict future position of some random body after t seconds since bodies velocity and position ...
1
vote
1answer
18 views

Odd behaviour when changing rigid body velocity inside OnCollisionEnter2D

This is the code I'm using to make an object bounce across the scene: ...
0
votes
1answer
42 views

Contact friction for overlapping rectangles

I am currently developing a top-down "tabletop simulator" where you are able to drag, drop and rotate playing cards on a table. The cards are able to overlap but do not interact as of yet. ...
2
votes
2answers
107 views

How to use different drag values for the X and Y axes on a Rigidbody2D?

I'm building a small 2D character controller using Unity physics to simulate an oldschool platformer. I know this is not the best way to do it and I have my own version using just raycast and custom ...
1
vote
1answer
464 views

Pick and Drop the Ball Testing Without Replicating the Physics Frame

I am making a program that pick, drag, and drop the ball. In real life, once you pick the ball and drop it, whenever the available object is (what you see is what you get) will only be picked and ...
0
votes
1answer
171 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 ...
3
votes
2answers
115 views

Why do multiplayer games often use custom physics implementations?

Big game engines all have a physics engine whose job is to resolve forces, collisions and constraints efficiently. I think the majority of modern games use a physics engine to some extent. ...
0
votes
1answer
75 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
0answers
27 views

Predicting angle of projectile trajectory

I'm making a game, where the player and AI shoot projectiles. Projectiles have their own speed, drag and gravity modifiers. I update my projectile velocity in FixedUpdate (I use Unity engine). ...
2
votes
1answer
197 views

How to make a moving platform in Godot not be affected by collisions?

I am trying to make a moving platform in Godot (for a 2D platform game, but I suspect the issue would be similar in 3D). Basically, both my player and my platform are KinematicBody2D, and they move ...
0
votes
1answer
132 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: ...
0
votes
2answers
93 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
6 views

Can a BoxCollider 2D be a child object of a Rigidbody 2D ? (as it's not working)

I tried to find a solution before and asked elsewhere but couldn't find the exact same issue. I have a parent game object that is a Rigidbody 2D, and this object has children that are BoxColliders 2D. ...
4
votes
2answers
91 views

Interpolation on Rigidbody2D not working

I'm trying to achieve smooth movement for a ball. I seem to be failing to achieve this and now I've created a sample scene, which shows my setup from the game and the problem exists in that sample ...
0
votes
0answers
19 views

Unity: how to make a kinematic rigidbody react to a rigidbody hitting it?

How do I make a non-kinematic rigidbody react to a "normal" rigidbody colliding with it in Unity? Like when the rigidbody hits the non-kinematic one, it pushes it back (note: not using the ...
0
votes
2answers
376 views

How can I access an OpenGl buffer from within a GLSL 330 shader?

I am currently attempting to create a simulation using OpenGl's GPU acceleration for both the simulation computations and rendering. The rendering portion of my simulation is complete and working, but ...
0
votes
2answers
510 views

Make objects stack in unity?

I have two kinematic rigidbody cubes from the standard 3D objects, I have also enabled contact pairs mode to "all contact pairs", how do I make it so that no matter what angle they collide ...
0
votes
0answers
14 views

How do get fast leaf nodes collide with a leaf node in bvh tree. ( I don't wanna traverse top-down )

How do get leaf nodes collide with a leaf node in bvh tree. I wanna leaf node list collide with a leaf node in bvh tree. I'm doing this traversing bvh tree from top node. But It really slow because ...
1
vote
1answer
198 views

Game object appears to accelerate too slowly

thank you for checking out my issue! I am trying to develop a game in java, but I have run into a problem. I would like to keep the physics as realistic as possible, so I am using a fixed time-step ...
1
vote
1answer
266 views

Character moving without control

i've been developing a third person adventure game on Unity with a grappling hook and i found a problem that i don't understand and it's driving me mad. Basically, if the player character collides ...
19
votes
1answer
10k views

How do I detect ledges?

In my game, I'd like my character to be able to grab and hold onto ledges, and to be able to pull themselves up if there's room to do so. How do I detect if there's a ledge, and if the character has ...
3
votes
1answer
414 views

How do I get an object to rotate in world space via RigidBody.AddTorque?

I'm getting really discouraged because I can't seem to figure how how to rotate my object via Rigidbody.AddTorque like it is on a figurative global turn table rather than a local turn table. Another ...
3
votes
1answer
869 views

Friction due to gravity in an impulse based physics engine

In my physics engine, I'm using impulses to solve collisions. I'm basing all calculations on these equations: ...
0
votes
0answers
11 views

How to find the center of mass from CapsuleCast in unity

Is there an easy way to find the center of mass from a CapsuleCast, or should I find the geometric center of it?
0
votes
1answer
92 views

Have body resume constant velocity after collision

I want to have a body move at a constant velocity, but react to collisions. My example game is a train, I want it to move at 1 meter a second. If an obstacle appears on the tracks, I want it to react ...
1
vote
1answer
41 views

Networked game with physics and client side prediction and server reconsiliation causes lag

I'm trying to make a multiplayer platformer game. I can almost get client side prediction and server reconsiliation to work, but there is one issue that I just can't wrap my head around. Lets say that ...
2
votes
0answers
41 views

Object stuck against an obstacle still pushes other objects away

I have an object pinned against the ground by a revolute joint. A motor on the joint makes the object spin. Sometimes the object becomes stuck pushing against a static body. When it happens the object ...
1
vote
2answers
103 views

Simulating a rocket out of control in Box2D

In the void of space, a spaceship releases a rectangle shaped space-torpedo. In half a second, it starts its rocket engine and goes straight until something get in its way, and then boom! The code ...
1
vote
1answer
196 views

How to stop my cube collider when it hits another collider using Transform.Translate?

As we know, Transform.Translate() ignores collisions. What functionality do I need to add to my code so that when my collider hits something, the physics system ...
1
vote
1answer
258 views

Firearm magazine ejection

I am playing around with a VR game where the player can fire a hand gun. When the magazine is empty they can press a button on the controller to eject the magazine from the gun. As its VR, I would ...
0
votes
1answer
36 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
46 views

How do I code double jumps to character controller in Unity?

Here is my script. I just started coding like 3 days ago so I don't know much. ...
0
votes
0answers
46 views

Prevent velocity from being increased by fixed joints

I am currently working on a Unity project that makes use of fixed joints. When connecting two GameObjects using a fixed joint, I noticed a behavior where the gameobject that becomes part of a fixed ...
0
votes
1answer
77 views

Rendevouz Calculations

Say you have two objects in a vacuum with no forces acting on them. The objects may or may not be moving. Object A's acceleration is not equal in all directions, and object B may change its ...
1
vote
1answer
134 views

How to interact spheres with random walls

I have a physics problem to deal with, I am asking here because a game developers often uses the efficient method. I have randomly distributed circles interacting to through Lennard-Jones potential or ...
0
votes
1answer
244 views

Verlet rope between two moving points connected with a spring joint?

I'm connecting two moving rigidbodies using a spring joint in Unity. Between them, a rope will be rendered using a line renderer and I want it to move realistically as the joints move, without physics....

1
2 3 4 5
44