Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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.

0
votes
0answers
36 views

Feathers and wind simulation in Unity

I would like to create a bird simulation that will use its wings to interact with the surrounding air. How can I achieve this?
1
vote
1answer
21 views

ContactFilter2D does not detect a trigger even with “use triggers” enabled

I'm Using Unity 2018.3.11f1 and I'm going crazy trying to understand why the "use triggers" variable of the ContactFilter2D is not having any effect and I'm always detecting only the non-trigger ...
0
votes
0answers
11 views

Collision Checking in Unity immediately after instantiation

I'm working on a dungeon generation script and I'm having some issues detecting overlap. Each piece that I spawn has attachment points, with rotation values and an offset amount so things lineup ...
2
votes
1answer
28 views

How do I calculate vehicle rotation when two car wheels are on the ground to simulate gravity?

I'm writing some code to simulate a vehicle (tank or car) driving over a heightmap terrain. I'm not using a full physics engine, and just simply checking the height of the terrain at the 4 bottom ...
1
vote
1answer
37 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 ...
2
votes
1answer
97 views

Predicted trajectory becomes less accurate in a side-on collision

In my 2d billiards game, I have it so that when the user clicks and drags with their mouse, a Physics2D.CircleCast is projected from the cueball to wherever the mouse is. If the circle happens to hit ...
0
votes
1answer
29 views

How can I avoid the precision loss when recentering objects on open terrain?

For a better context this question is related to this one: What's the largest "relative" level I can make using float? When the player is moving too far away from the center, all the ...
0
votes
1answer
81 views

How to detect when the player has filled a shape?

In my game, the player is presented with a plane containing obstacles (orange / blue) and regions of empty space (white). The player moves their green cube around the empty space, which instantiates ...
-1
votes
1answer
46 views

Wind in video game project [closed]

How to make the wind blow with randomized patterns? Like for storms and calm breezes?
2
votes
1answer
66 views

Math needed to create a very simple 2D side view car game

I'm trying to create a 2D side view car game (something like Hill Climb Racing, but much more simpler), but I'm confused on the math and physics. Most of the tutorials I found were about making a top-...
0
votes
0answers
10 views

Unity rigidbody glitch throu corners [duplicate]

No matter how thick the wall is, the player will glitch through. I've tried changing the settings on the rigidbody but nothing have worked. The walls fits together almost perfectly. Why is this ...
0
votes
2answers
43 views

Javascript Jumping Physics

I have asked questions for this project before, but the jumping physics are a bit messed up. I cannot jump unless I hold down the W key, and then it just teleports me upwards. Does anybody know how to ...
1
vote
1answer
49 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 ...
0
votes
0answers
25 views

What is the logic beyond cube collisions?

I am trying to simulate a colliding of two cubes , I actually tried and read a lot for many days but i did not get the idea beyond it,I know how to detect when they collide. Maybe my question is ...
3
votes
0answers
33 views

How to implement path-finding with a large number of blocking agents following similar paths?

I want to implement a demo like creeps laning in Dota 2. So for simplicity, there is Left team and Right team, they are enemies. Units from Left team move toward Right base, and units from Right team ...
0
votes
0answers
84 views

How do I program a fan in a platformer game?

Fan physics I have a platformer game and want to have fans in it that blow in a given direction and if the player presses the jump button they can go even further. How do I do this? side note: I ...
0
votes
1answer
65 views

In Cricket games, how is the ball synced with batsman's shot animation? How does the ball hit right at the center of the bat? How does this work?

I've been trying to figure this out for quite some time now. In Cricket games, when the bowler bowls, and batsman takes a shot, how does the ball sync with batsman's shot animation? For example, let'...
0
votes
0answers
60 views

How can I make billiard without using Rigidbody? [duplicate]

Unity's physics engine isn't deterministic (ie. the results aren't always the same on all computers) so I haven't Idea that how billiard games Implemented.Is there a way to Implementing fake and ...
0
votes
0answers
21 views

How to get gravity to change with mobile tilt in Unity

Let's say I was making a mobile unity game and I retrieved the tilt variable and put it into a vector3 to apply forces to a cube, this works for one cube but not for every game object. I want the ...
7
votes
3answers
3k views

How to move the player while also allowing forces to affect it

For now, that's how I move the player: rb.velocity = Vector2.right * input.x; And I affect him a force while he is damaged by an entity: ...
0
votes
0answers
90 views

How do I keep a rigidbody from making unnecessary collisions on smooth surfaces in Unity3d?

I have been having trouble with a custom character controller I am making. The root of the problem lies with collisions. I am trying to make movement code, but I have a problem with ground movement. ...
1
vote
0answers
26 views

Handling strange physics behaviour while sliding between coplanar surfaces

We've got a character setup based around manually resolving collisions, and we're using bullet to do so. Our characters have a kinematic rigidbody to push things around, but their movement and ...
1
vote
1answer
56 views

Is Rigidbody needed and what move function to use in 2D games?

I don't really fully understand how to use rigidbody and which movement functions in a 2D game. There seems to be so many options and it's just a mess in my head right now. If I'm making a game like ...
0
votes
2answers
55 views

How can I fix my velocity damping to work with any delta/frame time?

I am decreasing my velocity by 50% every second using a guide I found online. I am using the code here and it gives the right result but only for very small values for dt: ...
0
votes
1answer
75 views

Bullet Physics Integration - direct movement of rigid bodies

I'm adding bullet physics to my engine. The physics simulation bits are all working nicely, but one bit I'm struggling with is being able to move objects using their co-ordinates, and then have them ...
1
vote
1answer
76 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
0answers
14 views

Godot: How to maintain constant inertia

Inertia If I have a platform moving vertically I want the player to jump onto it without it losing its motion and slowing down or stopping. I have tried looking at the settings to CollisionShape2D ...
0
votes
0answers
24 views

How to deal with VBO and obj files for physics simulation?

I'm having a hard time struggling with obj files and clothing simulations. I first made the obj file processor class that deals with the typical obj file problem: having multiple indices for vertex ...
0
votes
0answers
43 views

Simulate piston for forklift using PhysX 3.4 ( Unity 2018.3 )

I need to simulate a piston for a forklift, but I don't really know how to create an accurate physics model. The forklift ( a car with some wheel colliders ) should react to the force applied by ...
0
votes
0answers
24 views

Resolving this kind of situation in my platformer (movement on slope with roof)

I'm building a simple 2D character controller based on raycasts. At this moment I'm trying to finish the player-ground interaction. For the ground I will be using edge colliders and no tiling ...
0
votes
1answer
68 views

How would I move something around inside of a sphere without it going outside of the sphere?

I want to be able to do this, but not go outside of the 4.4 meter limit, the radius is 4.4 meters, and it has zero gravity and no friction. I have a hard time explaining this, but imagine holding a ...
2
votes
1answer
71 views

Box2D physics are different on server and client

I'm using C# Box2D library for my server and client, they have similar world.step(), iterations and update function. At the same time they have different physics' results, difference is not fixed, it ...
0
votes
1answer
61 views

How to use 2D textures in OpenGL / WebGL for physics [closed]

Following along the answer here, it was mentioned about textures: They can also store things like velocities. For example, you can use a texture as a "flow field" for animating particles or other ...
0
votes
2answers
96 views

Calculating the intersection of a fast moving circle and a line

Inside of my game, I am in need of a way to test the collision between a line segment and a fast-moving circle. I would say I need a line v capsule collision however the problem is I need the ...
1
vote
0answers
81 views

Applying multiple forces on a particle

If I have a particle, say in a polar coordinate grid, and I want to apply multiple vectors to it, how can I calculate where it's final position will be given those vectors? Ex. Imagine there's a ...
0
votes
2answers
60 views

How can I solve niche collision cases between circles and insides/outsides of AABBs or arcs?

I am trying to create a game with some interesting geometry. Literally all the geometry that is involved are the circles that move large distances per frame, and the edge of an iPhone X display, which ...
0
votes
0answers
47 views

Multiplayer physics out of sync

So I'm working on this multiplayer platformer game using Phaser, Matter.js, and Colyseus.js. I have a simple map and player controls set up and now I'm trying to copy my physics simulation on the ...
1
vote
2answers
111 views

Pre-calculate physics in unity

I have a self contained physics simulation (eg fragments of a building crumbling) which is known to be the same, excepting floating point precision errors, every time it is run. Is there a way to ...
1
vote
1answer
88 views

Redundant checks from spatial partitioning

A simple 2D grid partition system for collision detection divides space into equal-sized tiles. Colliders then map themselves to tiles with their bounding box in O(1) time. Collision detection only ...
0
votes
0answers
12 views

Find circles velocities after collision [duplicate]

In my program, I have multiple balls that are given a random velocity. I'd like to have it so after they collide, they "bounce" off each other. The balls have a mass, radius, position (Vector), and ...
1
vote
1answer
67 views

Rigidbody & Ray alternative or optimization

I am creating an AI that moves around to certain points, but should interact with ais or objects seen. The ai should find other ai to comunicate or look for objects on the ground. It works with all ...
0
votes
1answer
36 views

How to add undulation to a constraint-based chain?

I have a constraint-based chain composed of segments where each of the terminal segments has a fixed position. My constraints are set up as follows: ...
1
vote
1answer
81 views

How can one replicate the 'Quake Disruptor' of Wipeout XL/2097?

Following my previous question, I am wondering how one can achieve the same effect under Unity? The effect in action https://youtu.be/kzmmLeCwL0g?t=790 Description of the effect When you fire the ...
0
votes
1answer
20 views

What are constraints and how are they pluggable?

I have been reading this book called "Game Physics Engine Development" and Came across this image in the context of Collision Resolution. See the contact Generator part. Can someone tell me what are ...
0
votes
0answers
37 views

Friction makes entity move slightly backwards

I'm having some trouble getting my friction to act properly in my game. My current goal is to add a dash move - which is working fine except that a bug with the friction is messing with me. The Dash ...
1
vote
0answers
63 views

How do I make both the Standard Unity Sphere and Pro Builder Sphere behave the same way?

I recently got into Unity and have been developing a game with a co-worker. Long story short I was thinking about using Blender for the 3d models but found about ProBuilder and gave it a shot. Here's ...
0
votes
0answers
29 views

How can I stop my character's velocity in only one direction?

I'm moving a character by setting its velocity. It works perfectly and stops how I want it to however when I'm moving forwards and sideways at the same time and I stop moving either sideways or ...
0
votes
0answers
8 views

Controls don't work when parent or target moves

I have a platform for catching a ball. Platform physics material has bounciness value of 2 which pushes ball twice high from compared to its original position. Camera and platform have scripts ...
1
vote
1answer
39 views

Detecting a Collision Between Two Bodies Undergoing Multiple Transformations

I have been searching for an answer to this for a really long time and I have not found any definitive answers as of yet. What I am trying to do is determine if and when two bodies collided between ...
0
votes
0answers
60 views

why are my 2d game objects passing through each other?

So I've been looking around for a while and can't seem to find an answer for this. I am trying to make a game where you stack shapes as high as possible. I have an OnMouseDrag script so I can grab a ...