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

How can I make Super Monkey Ball style physics?

I'm trying to create a game with physics similar to Super Monkey Ball and have been struggling to figure out how the physics work. So far, the solutions I've seen are: Rotate the entire stage (with ...
0
votes
1answer
29 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 ...
0
votes
0answers
20 views

What resources can I look to learn 2d and 3d game physics and AI [on hold]

I am looking for some resources to learn game physics 2d and 3d maybe AI to. I am only in 8th grade though so. am looking for something simple.
3
votes
1answer
44 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
38 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
45 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
37 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
53 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
18 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
89 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
75 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
11 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
44 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
31 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: ...
2
votes
1answer
68 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
19 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
32 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
47 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
36 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
44 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 ...
0
votes
0answers
24 views

Check gap in 3d environnement

I am in a 3d environnement, when I jump, i'm calculating the hitPoint of the end jump. I want to know when I jump, if there is a GAP between my initial point, and the end point. But I don't want to ...
1
vote
2answers
99 views

How to achieve a stable hover in Unity

In the game that I am currently making the play character is supposed to hover off the ground. I had used the code from the Hover Car tutorial on the unity website however this causes a lot of ...
3
votes
1answer
85 views

Wraparound world with wraparound horizontally physics implementation in Unity

What is the best way to implement a wraparound world with wraparound horizontally physics in Unity? That means that if I have an object and move it so that a part of it sticks off to right (so that ...
0
votes
0answers
34 views

How to implement a “Parent Constraint” in a custom 2D rigid body physics engine

So I am trying to write my own physics engine, with a specific game in mind, these are some design considerations: the game is about spaceships, the players build their own ships and find others in ...
0
votes
1answer
64 views

The character does not stand still on the moving platform

I'm trying to create a simple platforming game. I have an animated platform moving in 2 opposite directions. I use this simple code to make the character move along with the platform while he is ...
0
votes
0answers
32 views

How would I go about implementing crowd physics?

I'm working on a wave based game where enemies come at you in waves, and I'm stumped on this. I've tried a few things, but nothing really has worked. This is in 2D. It would look like a crowd of ...
1
vote
0answers
35 views

Box collider has different behavior in 2 clients

I'm new to Unity. I am making my first Game and faced with problem. I have a plane and 4 gameobject that has box collider surrounded this plane. there are a few spheres as players inside of the plane....
0
votes
1answer
32 views

How can the ball moving like billiard after collision with wall?

I tried ball.velocity = Vector3.forward * speed and also *=-1 when the collision is occurred(It only works for straight way. But I want the ball movement be liked in photo. How can i do it? Thank you ...
2
votes
1answer
98 views

How do force fields scale?

Setting I am designing a 2d game in which a \$1/r^2\$ force acts between moving charged particles, and the number \$n\$ of particles is very large. To calculate the force between all pairs of ...
1
vote
0answers
51 views

How can I avoid jitter when working with a 2D movement system?

How can I avoid jitter in Unity? Let's suppose that I want to create a 2D movement system using a Rigidbody 2D(Dynamic), and I want make the camera follow the character (which is a pixel art sprite)....
2
votes
2answers
79 views

most compact way to represent dice face translations rolling in cardinal directions

I'm making a 2-D dice rolling game in BASIC (think mechanics similar to Devil Dice on the Playstation, but top-down 2D graphics). I'm trying to accurately represent the transitions of a die when ...
0
votes
0answers
29 views

Calculating Damage from from object collision

I need to calculate the damage resulting from a crash of two objects. I found the formula of the resulting kinetic energy: E = m * v² / 2 I guess I also have to ...
-1
votes
1answer
50 views

How can I prevent the balls from overlapping?

I am making a ball rolling game controlled by tilting an accelerometer. In my game multiple balls overlap, so they end up showing as only one ball. How can I solve this problem, so balls do not ...
0
votes
0answers
48 views

Unity: AddForce problem

I have two spheres on a plane. I'm applying AddForce to the first ball after which it collides with the second one. The weird thing is that the impulse is not passing from the first ball to the second ...
0
votes
2answers
38 views

How do you make a particle system collision add a force to an object towards the particle system?

I have a lightning particle that gets shot at the ground. I want the particles to collide with the object they hit and add an upward force. I tried just entering a negative force in the Collider Force ...
0
votes
1answer
33 views

Preventing the final segment in a linerenderer from being stiff?

I am creating a fishing pole, and have the script that draws the line -mostly- worked out using verlet physics. However, the final segment is stiff. The code follows an old Unity3D Subreddit post. ...
0
votes
1answer
27 views

Detect collision with bullet physics, to make a character controller

I inherited from btCollisionWorld::ContactResultCallback but I really have no idea how to use this virtual function: ...
0
votes
1answer
90 views

Unity3D: AI follow player script for prefab enemy?

So I am having an issue, I have an enemy prefab that is created when the new wave happens(think of Nazi Zombies from Call of Duty, same system) but every script I have found that deals with ai ...
2
votes
2answers
129 views

How to program smooth player 2D movements

I am writing a simple 2D game in Rust, having access to the following dependencies: Piston: for the graphic engine nphysics: for the physics engine The genre is Metroidvania, the game features a ...
0
votes
1answer
78 views

How are real world car characteristics translated to in-game?

I am just entering the world of game development, starting with the racing genre of games. Let me clarify that this question is not about car modelling or external detailing; it is about the way a ...
0
votes
0answers
69 views

How to get one KinematicBody2D to push another?

I am working in Godot 3, where my player is a KinematicBody2D. When I collide with a block which is also a KinematicBody2D I'd ...
1
vote
0answers
23 views

Unity Graphics.DrawMesh equivalent for Physics?

I'm working on something where the same graphics mesh is rendered multiple times in the scene. The problem with this is that each of those graphics items have a physics mesh which isn't there in the ...
1
vote
2answers
105 views

how to calculate initial Y velocity required to reach target?

I am trying to calculate the y velocity necessary for my player character to jump up and reach a y position within 1 second. Given that my game engine is at 60fps, I am doing: ...
1
vote
1answer
65 views

Unity Physics Simulation - Limitations / Inaccuracies? Bounciness of a ball (pool/snooker balls etc)

I am playing with Unity physics engine. I have a pool table and a cue ball. Both have Physic Materials. If I start the game, with the ball floating about 1m above the table, it falls and bounces (...
2
votes
0answers
42 views

How to properly write “stick to surface” character logic that handles unexpected large time deltas?

I've been trying to wrap my head around this issue: in a 2D platformer game (but this may as well apply to 3D games) I want the character to "stick" to the surface that it's moving along and at the ...
1
vote
1answer
89 views

2d side scroller slope physics and collisions

In old 2d games such as double dragon, streets of rage etc. where the player could move “up and down” on the y-axis to give an illusion of depth (as opposed to something like Mario) how were slopes ...
1
vote
3answers
93 views

Targeting with a ballistic gun

I am trying to determine the gun elevation angle of a gun that fires ballistic projectiles. For a target at a certain distance D, I will have to compute an angle that increases with D. This relation ...
1
vote
1answer
58 views

Detecting collisions during animations

I am creating a prototype enemy swordsman, and I'd like to be able to parry his attacks, like the parry system from VR Dungeon Knight. This is my method of implementation: Parent a sword to his hand ...