Stack Exchange Network

Stack Exchange network consists of 174 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
Make your voice heard. Take the 2019 Developer Survey now

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
30 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
29 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
31 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
17 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
59 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
36 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)....
1
vote
2answers
70 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
23 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
47 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
44 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
30 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
18 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
19 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
21 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
95 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 ...
-1
votes
0answers
10 views

Find The Angle Needed for Hitting a Target with Air Resistance [duplicate]

I'm looking for a formula to hit a target on an xy plane. How can I calculate the angle needed to hit the target with a given distance and projectile velocity? I want to incorporate simulated air ...
-1
votes
0answers
9 views

How to preserve original shape in Position Based Dynamics?

I have a question about Position Based Dynamics (PBD). (http://matthias-mueller-fischer.ch/publications/posBasedDyn.pdf) For my case, I want to add constraint for preserving original shape for cloth, ...
0
votes
1answer
71 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
34 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
16 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
102 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
44 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
37 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
73 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
84 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
36 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 ...
0
votes
1answer
97 views

How to check for mesh overlap?

I'm creating a level editor in Unity. I need to detect when an object is intersecting another as I don't want to allow the user to place an object when it is colliding with something else. In the ...
0
votes
1answer
45 views

Preventing overlap in OnCollisionEnter2D

So I have successfully built a script that can determine the physics for a ball reflecting linearly off of walls, similar to pong, while the ball is using a kinematic rigidbody. The issue is when the ...
0
votes
0answers
16 views

Why is it when I grab at a point it “jumps” upward?

So I've got a mechanic that lets me grab vertices. Something in my code (I think it's got to do with the clickRadius) keeps causing a grabbed vertex to "jump up". Example: https://i.imgur.com/0S6ZyRK....
1
vote
1answer
49 views

OnCollisionEnter2D just flat out not running for certain objects

I am working with the Unity3D Engine in 2D mode. Currently I am trying to make a circle collider bounce off of a composite collider for the walls of my game. The only issue is that for some reason the ...
0
votes
0answers
25 views

How to deal with pushing objects out of collision

I am developing RTS game in unity3d. I have thousands of units running around the battlefield I can't use unity physics component for collision detection as physics API is not available for job system ...
0
votes
1answer
20 views

Trying to mix and mingle 3d physics with the Unity UI

I have recently created a drag drop system where I drag stuff from a UI menu and then drop it to another UI. The child of the draggable UI object is a 3d model. I have attached box collider and ...
1
vote
0answers
32 views

Avoid object from bouncing non-stop after AddForce() is applied to it

I want to implement some sort of elastic field on my light blue magnetic field when a cylinder is colliding it, it worked except the lines won't stop bouncing. I am enabling the trigger collider on ...
0
votes
1answer
47 views

Manipulating time in Unreal messes up Physics simulation?

I'm trying to achive a Super Hot like gameplay, where the time only flows when the player moves. But when I stop time, then restart it, physics simulation will be messed up. Like: Cloths starts ...
0
votes
1answer
39 views

Unity - OnTriggerEnter & OnTriggerExit strange behavior

I am having a trouble with OnTriggerEnter with a lot of objects. I have a NavMeshAgent moving randomly throught the scene, then I have a sphere collider inside a children to detect nearby objects. If ...
0
votes
1answer
61 views

How to find the resulting angle of a ball hitting a wall in 2D

So there's a ball moving on a 2D plane with any vector. When it comes into contact with a collider, it should reflect in a linear fashion. What formula should be used in order to find the angle that ...
1
vote
1answer
66 views

Can I apply a force to particles from a script?

I'm working on a game which involves streams of electrically-charged particles, being manipulated with electric and magnetic fields. Since I want a large number of small objects coming from an emitter ...
0
votes
2answers
111 views

Is there any way to keep the applied torques in the old planes, even if the ship's local plane has rotated?

I'm trying to make a space shooter game in Unity3D with realistic spaceship physics. I have a problem with correct rotations. When I apply torque in global coords system it will always apply them in ...
3
votes
1answer
187 views

What is the physics behind a 2D gravity tunnel?

In Portal 2, there is a concept of an "excursion funnel", a beam of light that moves physical objects in a certain direction. Here is a link to a demonstration. I added a simple implementation that ...
1
vote
0answers
55 views

Confused about calculation of steering force

I'm reading Programming Game AI by Example, by Mat Buckland. What I don't understand there is why the individual behaviors return a vector representing change in velocity, but the combined result is ...
-1
votes
0answers
90 views

3D Bird Flight/Gliding Physics (Simple)

I am trying to create flight/gliding physics for a mobile game in unity. Essentially it needs to be a bird that is simply gliding forward through a path. I am not aiming to replicate bird flight ...
2
votes
1answer
89 views

How to implement swooping movement?

I am trying to code some swooping behavior for a flying enemy in my 2D platformer. The ideal behavior has the enemy starting from an arbitrary height above the ground, then accelerating downward and ...
1
vote
0answers
41 views

Center of Mass for Convex shape in 3D

For an arbitrary convex shape in 3D, how can I calculate its center-of-gravity? I have face-normals, and the vertices for each face. @Ocelot No, it most certainly is not the average of the vertices, ...
0
votes
1answer
33 views

Unity Rigidbody sitting on top of another Rigidbody does not move with the Rigidbody its sitting on

I have a mesh with a rigid body that moves back and forth like a platform. Other rigidbodies fall onto the upper surface of this cube. The problem I have is that when the platform rigid body moves the ...
-1
votes
0answers
25 views

Prediction and BEPU physics

i am doing a multi player game with bepu physics hosted on server. Client use client prediction to move player. Client will send a message( contains: pressed time T, sequence number N ) to server ...
0
votes
1answer
81 views

How to manage collision between balls in Game Maker 2 (Drag and Drop)

Hey there I'm using Game Maker 2 Drag and Drop for a project, I made a game like Break Out and when the ball collides with the wall it doesn't bounce, in Game Maker Studio we had Bounce Action but in ...
0
votes
0answers
38 views

How does Cortex Command handle its pixel based physics?

I would assume that it's a cellular automaton similar to "powder" games but I can't find any resources on its development or physics engine. I'm not very familiar with cellular automata, and I might ...
0
votes
1answer
37 views

How to collapse a structure after procedural destruction

When considering this temple structure with procedural damage in pink: How can I efficiently determine the collapse of such structure as below? Even if the model is defined on a voxel grid, it would ...
0
votes
1answer
67 views

UE4 Get direction of Ball rolling and boost it

I'm sitting on some kind of a Minigolf-Game in my freetime. There is a PowerUp collectable which should give the ball a boost. I tried it with SetPhysicsLinearVelocity and also with AddForce. ...
1
vote
0answers
18 views

How to determine angle of incidence, resulting position, and resulting velocity for a point with position and velocity appearing within a rectangle?

I have a rectangle positioned on a 2D Cartesian coordinate system, and its minimum x and minimum y are represented as a coordinate pair (xrect, ...