Questions tagged [game-physics]

Game Physics is about implementation, creation, optimization and any other thing related to physics in games. Physics controls the interaction of every physical object in a game, where any 2d or 3d model interacts with any other 2d or 3d model of an object in a game. Physics is used to give realistic effects of this interaction.

game-physics
Filter by
Sorted by
Tagged with
0 votes
1 answer
1k views

Objects do not land on the floor in unreal engine 5 [closed]

Objects do not land on the floor and fall straight down, how can I solve this? When I place an object in the air and press the Run button, it does not land on the floor and falls straight down. How ...
assa's user avatar
  • 139
0 votes
1 answer
70 views

How to prevent character from rotating when moving at an angle to an incline

You can see the problem when moving at an angle to the collider: https://8observer8.github.io/webgl10-js/lighthouse-oimophysics-webgl-js/ I use OimoPhysics but there is no such tag. This is a task ...
8Observer8's user avatar
  • 1,008
2 votes
1 answer
179 views

Phaser Complex Collisions

How can I detect the collisions of multiple children from different groups? similar Imagine something like this, but with square hitboxes the pink object is from one group, the red object from ...
Vatsa Pandey's user avatar
0 votes
0 answers
106 views

Sand and Fluid Cellular Automata

I have been struggling all day to get the fluid to work in my sand and fluid cellular automata simulation. Ive searched the web for info on how I could solve my issue but I cannot seem to fix it as ...
SoulDaMeep's user avatar
0 votes
1 answer
104 views

How to make character not slide down hill in Unity3d?

we made a character with a capsule collider and a ladder (smooth as a slide collider) and the character is not fixed in the middle of the stairs but just slips off. I tried to create a physical ...
JICako's user avatar
  • 3
0 votes
0 answers
86 views

Can't understand the math and physics behind throwing grenades in games

I'm digging in unity tutorial "3DGameKit". when a game monster shot a grenade, call the function GetVelocity() to set rigid body's velocity. In order to figure out this function,I studied ...
zhang0xf's user avatar
0 votes
1 answer
29 views

Python kivy game: how can I make a rectangle/ellipse collide with a quad

I am creating a game but I can't make rectangle collide with the quad shape. It collides when the rectangle is at the middle of the quad and at the right side of the quad but if I move the rectangle ...
Enahon Wilfred's user avatar
1 vote
0 answers
71 views

Every time I try to implement gravity to a sprite in Love2d, it breaks another feature,

Im trying to give the player for a game im working on gravity when its not climbing a ladder, but every time i try to implement this feature, something climbing ladders breaks, and when i try to fix ...
TriggerFox Games's user avatar
0 votes
0 answers
21 views

Why does my ball in the simulation stick to the bottom of this quadratic curve and how can I fix it?

I am using this function to snap the ball to the closest point on the curve x**2: def snap_to_quadratic(position): # Quadratic equation: y = f(x) def f(x): return x ** 2 # Solve ...
Tanner Ross's user avatar
3 votes
1 answer
136 views

How would I go about placing a GameObject on another object's surface while matching the rotation? Unity3D

I'm making a game where you build, and when I try to place a GameObject on another one's surface it uses global rotation and not local, however I'm trying to get the placed GameObject's rotation to ...
BAMBanam's user avatar
1 vote
1 answer
37 views

How to reset rectangle position in the moment when it touches the border?

Problem is, whatever i tried to put in this part of the code: LOPTICA = LOPTICA.move(BRZINA_LOPTICE) if LOPTICA.left < 0 or LOPTICA.right > width: ##what i should put here It got crashed ...
GigaBurek's user avatar
0 votes
0 answers
25 views

Why isn't my Unity OnCollisionEnter working in the build, but working in the editor?

I have a piece of vaulting code for my FPS game and it works fine in the editor but doesnt work at all in the build ive tried debugging several times but it never works! I've decompiled the code of my ...
Legendized's user avatar
0 votes
1 answer
101 views

Aligning the rotation of the player in projectile motion using Rigidbody in Unity3D

transform.up = _rb.velocity.normalized; Currently I am using the above to align the players rotation to the direction of the velocity. This causes problems with the physics system so I decided to use ...
J2CD's user avatar
  • 3
0 votes
0 answers
201 views

Collision resolution/path finding between many object in Vampire survivours type of game

So I'm making a vampire survivor clone. The base idea is many enemies (which are, simply speaking, just circles) are chasing out player, and they have to find the path in some way. You can imagine the ...
Иван Поздняков's user avatar
0 votes
1 answer
79 views

How could I make a viewing function for a simple game in Python?

I'm working on creating a simple game in Python, just to get used to Python and get better at using it. Just so that the question that I have is understandable, I'll explain what the important parts ...
chester's user avatar
  • 23
2 votes
2 answers
645 views

Rotate a sprite from cursor position

I don't understand how rotation works in Bevy. I just want to rotate a sprite to follow my cursor position. What is the piece of code to make it work? I tried that, but it's not working: Bevy rotation ...
Theo Cerutti's user avatar
0 votes
0 answers
20 views

How to make an app to auto-click online memory game dots according to given IDs?

So if you have an online game with some dots and every dot has some id for example you need to click the first one, the the fourth one, then second one and lastly the third one but each of these dots ...
Bake's user avatar
  • 1
0 votes
1 answer
31 views

How to make walls that can be moved by velocity code but can't be moved by anything else?

I am creating a game where you play as a ball and the walls move around you in different directions. My problem is that when it hits the wall it adds force to the wall, moving it in directions I don't ...
Lleyton Bell's user avatar
0 votes
0 answers
46 views

Odd normal on collision between a collider2D circle shape and a collider 2D box shape

I'm building a little arkanoid clone with godot to learn how physics work but I have found a little problem when checking the collision between the ball and the paddle. I have a paddle (character ...
Notbad's user avatar
  • 6,186
-1 votes
1 answer
57 views

Unity main character falls down when getting close to a corner

I'm trying to create a game in Unity 2D. I've created the player movement but now I have the problem that when I get close to corner the sprite starts falling down and rotates. It gets like in this ...
ShadowSPM's user avatar
0 votes
2 answers
282 views

Collisions only on specific objects, or alternate solution

Working in unity, trying to find a good way to make a collider only work for a specific object. Layer-matrix collision wont work here and Im also hesitant to manipulate the physics engine to ignore ...
CThomas's user avatar
  • 71
0 votes
0 answers
175 views

creating physic with cannon.js in three.js

I have been working on three.js and cannon.js I have been struggling with the cannon.js part, basically what is supposed to happen is it creates the usual. (scene, camera, renderer) then it creates a ...
Owen Stritz's user avatar
0 votes
0 answers
67 views

Unity WheelCollider - relation between brakeTorque and brakeDistance

So I am trying to write an AI for learning purposes and I am facing one (one of the many to come) problem that whenever the car approaches an intersection or a turn it has to slow down to a set speed ...
Priyansh Yadav's user avatar
0 votes
0 answers
578 views

How to control realistic car controller when it is in the air in unity 3d

I am using RCC car controller to make a car stunt game. There are different types of ramps that I am using for stunt. But I am facing some issue while driving the car. Here are some issue and I need ...
Faisalmirza Mirza's user avatar
0 votes
1 answer
42 views

Wrong direction of dragging trajectory line

Wrong direction of dragging trajectory line I was tring to make a preview fire line for aim. This pic showed it's work fine facing toward. But the trajectory line is facing to a wrong direction when ...
XenonFace's user avatar
0 votes
0 answers
44 views

how to check if an actor is inside the trigger but not the player

I am trying to implement a logic where I shoot balls at 9 trash cans to make fall over the edge. I want to check if all the trashcans has fallen over the edge or not. This is the level editor. I have ...
haize233's user avatar
1 vote
0 answers
90 views

Make light pass throught Smooth Portals in Unity

I am using Sebastian Lague portals in my game (text), everything works perfectly but there is an catch, I have a flashlight machanic in my project and when I get close to the portal with it it looks ...
JakeTheBlaze's user avatar
-1 votes
1 answer
140 views

How to add force in up direction at an angle in Unity

I am adding force in up direction of an object using ammo.GetComponent<Rigidbody2D>().AddForce(ship.transform.up * magnitude); This way the ammo will always follow the direction of ship. How can ...
mukul's user avatar
  • 179
0 votes
0 answers
82 views

Trying to make glue in Unity for VR game

I'm trying to make a system gluing that paints the object then the tool touches it then creates a trigger collider so I can apply my joint logic when another object that can be glued enters the ...
Michael 's user avatar
0 votes
1 answer
384 views

How to add force in up direction of a 2d object in Unity

How to add force in up direction of a 2d object after it has rotated? I am using AddForce(transform.up) but it always moves the object upwards, irrespective of its rotation. I want to move a ship ...
mukul's user avatar
  • 179
-1 votes
1 answer
67 views

How do you make a rigid body eventually converge to a fixed position?

https://www.youtube.com/watch?v=zz7XJ6bK_YQ What is the best way to think about writing a program for a free-falling, bouncing 2D rigid body like the one in this video that eventually converges (or ...
wes's user avatar
  • 1
0 votes
1 answer
78 views

How do you detect the point of impact between a moving circle and a rectangle?

If you have a circle C that is moving at velocity V, how do you calculate the impact point of a collision with rectangle R? I'm asking this and going to immediately answer my own question in hopes ...
Jason Boyd's user avatar
  • 1,230
1 vote
2 answers
306 views

Writing a full game in WGSL?

The goal would be to get the optimum of performance, when every major calculation is done on the GPU, to make huge simulations in the browser possible, to achieve something like the powdertoy or more ...
Hutzlibu's user avatar
  • 124
1 vote
1 answer
211 views

Centripetal force in Unity to achieve perfect circular path

Why I had to add -0.5f to NForce to achieve a perfectly circular path by ball2 if The magnitude of the centrifugal force is equal and opposite to the magnitude of the centripetal force why -1 did not ...
Amarnath Pandey's user avatar
0 votes
0 answers
47 views

My simple physics system makes object shake instead of standing still

I am currently trying to make a system (for roblox) that is basically just a Vector3 that has physics and collision, it doesn't have volume it's literally just a vector position in 3d space. I've made ...
xSwezan's user avatar
0 votes
0 answers
38 views

How do i fix my dropping problem in C# forms

I have problem with pictrure box in this project. When form is loaded my character is devided to two sides and started bugging under the other picture box, but my other mario on the grass can jump and ...
David Chalupka's user avatar
1 vote
1 answer
66 views

my player can look up and down but when my player look right and left its shaking. i'm following tutorial on brackeys

Can you guys help me? I want my player to look normal and not keep shaking. My game is first-person. When my player looks up and down, it looks normal but when the player looks right or left, it's ...
ryandi fahrizal's user avatar
-1 votes
1 answer
34 views

Jumping not working(you can jump infinitly)

Hi im begginer of C# and Unity and im making movements for the player. I used code from tutorial on youtube. But this code is not working as it is supposed to. The code worked for the guy on youtube ...
Bendas627's user avatar
0 votes
1 answer
77 views

Projectile Collider colliding with triggers

In the shooter game I am making, my bullets have two collision rules, one for hitting enemies and one for everything else. Code looks like this: - private void OnCollisionEnter(Collision other) { - ...
Alexander Leavitt's user avatar
0 votes
1 answer
55 views

Rigidbody gets stuck "midair"

I added a physics material with no friction in order to not have my character stuck in walls which worked out great for me but, now the problem I have is, If I move my character towards a wall in a ...
Enes Ceylan's user avatar
0 votes
2 answers
235 views

Weight system in unity

I have started making a platform game that uses weight mechanics but I don’t know how to start coding it. For example I have a seesaw and I want it to act like real life physics which means heavy ...
Seyit Şahin's user avatar
0 votes
0 answers
36 views

How do I put objects on the map in libgdx?

I'm building a game where the player has to put different objects on the map. I have already set up the map and it has 2 layers, second layer is for placing objects. There is also a sidebar to select ...
Rustam Temirov's user avatar
1 vote
0 answers
30 views

Can't get gigantic ball to normal size in PyGame [duplicate]

I am trying to make a clone copy of a tiktok rock, paper, scissors filter (link provided) but for some reason the first ball always seems to be gigantic compared to the rest, and it's also outside of ...
DiWaso's user avatar
  • 19
0 votes
1 answer
50 views

How do i correctly calculate the ellipse that illustrates the orbit of an object in space based on initial state values (r0, v0, deltat, and mu)

I'm working on a game that has a primary UI showing the solar system in a top-down (earth's north pole being roughly 'up'). And I have a need to show a semi-realistic path of travel for an object ...
Nieminen's user avatar
  • 1,294
0 votes
0 answers
176 views

How can I get an accurate height value from the gradient noise in shader graph based on an object's world x and z position values in unity?

So the solution I currently have actually works for a couple of seconds, then it goes out of sync. Here is how the shader graph looks: Here is how the code looks (the code is attached to the object). ...
Spookieboi123's user avatar
0 votes
1 answer
59 views

Why isn't my bird jumping when i press the space bar for my flappy bird game?

I am new to lua and love. I am attempting to make a flappy bird game. When the game runs, the bird does not jump. the bird just floats until it crashes and the game ends. Also, only my original pipes ...
Anomalyy's user avatar
0 votes
1 answer
188 views

Moving a sprite on a 2d plane along a circular path in C++

I am making a simple 2d arcade shooter game and am attempting to have the enemy sprites move in circular patterns. The enemy's position on the screen is controlled by the two variables: ...
Fishie's user avatar
  • 25
0 votes
0 answers
27 views

How to make intersection "line vs box" without penetration many objects?

can someone give me idea how can i make intersection only first box when the line is stretched to mouse cursor? Im trying to make something like "raycasting" but don't know how to stop the ...
Binny Bogs's user avatar
0 votes
0 answers
63 views

Acceleration physics in Java does not slow down or stop

I've made a physics engine which contains acceleration, but when I try to make the object stop, it neither slows down or stops. It seems that the if(deaccelerating) {... never gets executed, I've ...
Grinding For Reputation's user avatar
1 vote
1 answer
142 views

Map collision function 2D game

My player can move vertically, horizontally and diagonally. I'm having trouble writing a good diagonal collision function. My goal is to do the following: If a player moves diagonally and a collision ...
Alex's user avatar
  • 45

1 2 3
4
5
79