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.

Filter by
Sorted by
Tagged with
0 votes
0 answers
17 views

Unity problem with ConfigurableJoint, how fix it?

There is a chain of units that are attached to each other using CongigurableJoint.(RotationUnit - top unit, HeadAttachment - bottom unit). The bottom chain has all axes locked, but it still ignores ...
Анатолий's user avatar
-2 votes
0 answers
15 views

Issues regarding adding collisions and physics to jumping game [duplicate]

I added some collisions to the jumping game but having issues implementing it. Here is the code attached. I tried using normal physics and was expecting mario game like graphics and mechanism. here is ...
Dev Vaghani's user avatar
0 votes
0 answers
13 views

Collidestart not fired - Aframe 1.4.1 & Ammo.js with 8th wall

I want to detect collisions between dynamically created falling boxes and the ground. After the collision, a highscore increases & the boxes are removed from the scene. Problem: Some boxes don't ...
cbinger's user avatar
  • 34
0 votes
0 answers
27 views

Separating axis theorem implementation results in limitless extending colliders along the Z axis

I am trying to implement SAT and it works except for the fact that colliders extend infinitely along the Z axis and I can never get past them. I also have confirmed that vertices values are correct. ...
Jakob Tadej Vrtacnik's user avatar
0 votes
1 answer
26 views

How should I implement collision handling in my 2D game? (Kivy in Python)

I would like to implement a collision logic for a head soccer type game. I have a Ball and a Player class and would like them to interact seemlessly by using physics simulation. I have tried ...
Petr Michovský's user avatar
-1 votes
0 answers
31 views

Keep getting black screen for pygame output for particle model [duplicate]

I've been making a simple physics simulation and it's been going just fine so far. After modelling the mass and velocity of the particles (via user input), I've also added a slider that goes up to ...
Z1yaad's user avatar
  • 1
4 votes
1 answer
44 views

Why must I add velocity to object.position.y + object.height?

There nothing wrong with my code really. I was watching a tutorial to help me learn to make games in canvas. I’ve understood every single bit of it, but the one thing I don’t understand is why must I ...
Heavenly Gater's user avatar
0 votes
0 answers
31 views

Separating axis theorem implementation results in infinitely extending colliders along the Z axis

I am trying to implement SAT and it works except for the fact that colliders extend infinitely along the Z axis and I can never get past them. I also have confirmed that vertices values are correct. ...
Jakob Tadej Vrtacnik's user avatar
0 votes
0 answers
18 views

Physics and lag issues in a 2D game similar to Knife Hit in Unity: 2D Rigidbody values and gravity for the log and knife

I have a question for people who have ever played the knife hit mobile game. I've been creating a similar game in unity 2D for some time now in terms of mechanics, and I'm having trouble getting a ...
Viw0a's user avatar
  • 37
0 votes
0 answers
19 views

Conserve gravity action when overriding velocity

I'm developing a video game with Unity. I have a GameObject with a Rigidbody attached. I'm moving it overriding directly its velocity, which works great. The Y velocity is conserved to work as ...
georgenda182's user avatar
0 votes
1 answer
28 views

angle of launch to hit the object on desired location in unity 3D

I am creating a cricket game and I want to implement a bowling logic that is, I want to through the ball to the ground at specified location(should not gain any height it should start moving towards ...
harshit joshi's user avatar
0 votes
2 answers
33 views

Aligning one game object to another for base building system considering different rotations based on raycast hit

I am creating base building system similiar to Valheim's one, but I have problems with aligning objects towards themselves. I want to be able to place object with different rotation at point my camera ...
Kiket95's user avatar
  • 77
0 votes
1 answer
55 views

How to make 2D character do one step of 32 pixels when pressing a button once in Godot's 4 GDScript?

I wrote a script where I move my 2D character after once pressing a button one step. But it moves only 1 pixels instead of 32 and also jumps up for 1 pixel. There is a function that measures the ...
Mimo's user avatar
  • 3
0 votes
1 answer
39 views

How to add force to a RidgedBody without causing infinite velocity gain while keeping air-control?

I am a fairly new coder and I was having some big issues with something and I wasn't able to find a nice fix just by searching it up. Essentially, I have followed the RigidBody-based movement tutorial ...
ErraticSignal's user avatar
0 votes
1 answer
17 views

How to know which side of a ChainShape is being collided with?

I'm learning LibGDX and trying to use Box2D for collision and movement. I'm making a simple Pong game. When the ball hits the left or right wall (i.e. the other side scores), I want the ball's body to ...
Copha's user avatar
  • 23
0 votes
0 answers
16 views

How to aim a balistic projectile at a moving target?

i have: the target speed and position the gravity the firing point i need to calculate where i should launch the projectile to hit the target 100% of the time in 3D i found lots of solutions for ...
DigestDig9's user avatar
0 votes
1 answer
34 views

Colliding a box with a plane - strange rotation

I am following the Game Physics Engine Development book. I understand splitting up a collision: generating a contact first and then resolving it based on its direction, position, penetation, etc. I ...
Georgi B. Nikolov's user avatar
1 vote
1 answer
117 views

N-body simulation in C++ has great momentum conservation and huge energy deviation

I am using Verlet integration (more specifically, the last equation in the "Non-constant time differences" section in the Verlet integration Wikipedia page), with C++ and the Eigen library, ...
Malmel's user avatar
  • 13
0 votes
0 answers
25 views

Accurate weapon grip animation in UE5

I want to achieve an accurate animation of grabbing a weapon, like for example in rdr or tlou in these games, regardless of the character’s actions, whether he is walking or sneaking, the character ...
Glandus's user avatar
2 votes
0 answers
29 views

How to use matter.js for collisions with large tilemaps

Requirements: The collisions system should be able to at least handle 100x100 tilemaps with at least 5 dynamic entities and preferably 50 dynamic entities that interact with the tilemap efficiently. ...
Olivia Smith's user avatar
2 votes
1 answer
35 views

Riding platform Phaser3

in my 2D game I have 1 character and a platform that moves left and right with tweens. I created this platform as an object in tiledmapeditor and it spawns by giving texture. When my character comes ...
yunusemre agdin's user avatar
1 vote
1 answer
42 views

Box spins when on ground and going forward

I am trying to create a moving box that can jump, go forward/backward and right/left. But when this box is touching or has touched something with a collider, it starts spinning and doesn't allow me to ...
Arnaud Girard's user avatar
-1 votes
0 answers
11 views

My wallslide is not working even through it is running perfectly

private void WallSlide() { bool horizontalcondition = horizontal != 0f; Debug.Log(horizontalcondition); if (IsWalled() && !isGrounded() && horizontalcondition) { ...
VELUPUGONDA BHAVANI KRISHNA's user avatar
0 votes
0 answers
34 views

Youngs Modulus Spring Strain

I need to simulate steel strain. But I can not add enough strain. If I will, it exploding and damping values can not fix. Here is my code: Vector3 delta = distance_joint.FirstNode.transform.position - ...
Berkay Onur's user avatar
1 vote
1 answer
27 views

Cannon Fire Phaser3

I want to make cannon fire for my game I developed in 2D phaser3. I haven't achieved this move yet. When I code it this way, it falls directly down sharply after a certain point. How can I get the ...
yunusemre agdin's user avatar
0 votes
0 answers
26 views

CharacterBody2D Sliding out of StaticBody2D instead of teleporting out of it in GODOT 4.1

I am trying to replicate Mario Maker's On/Off switches and if the player got stuck inside the block after it was toggled on, the player just teleported out it. I know this is expected, but I wanted a ...
Jason O'Neil's user avatar
0 votes
0 answers
33 views

OpenCV to Unity and ball tracking

I am working on a project where I have a venue with cricket nets inside. This venue currently has a bowling machine connected to a computer and sensors to detect where the ball hits. My goal is to ...
Saitama's user avatar
0 votes
0 answers
32 views

Adding collision to a png image in JavaScript

so Im developing a web game in JavaScript, and I want to add collision to some objects in the map. The map was created using the Desktop App called Tiled, and I exported the map as a png image. Also ...
LuizCarloBergamini's user avatar
0 votes
1 answer
33 views

How would I go about making a propulsion system within my game?

I'm currently making a 2D platformer game within Gamemaker 2 and I'm using GML as the language. I've had the idea of making a mechanic in my game where the player is able to aim a gun around ...
BravestMedal's user avatar
0 votes
0 answers
31 views

Can I get a data race from numpy?

I'm trying to write a basic rope simulation using numpy. However, it oscillates and explodes. One theory is that there might be a data race. The edges are stored as an (2,N) array on integers, which ...
ollie d's user avatar
  • 19
0 votes
0 answers
16 views

3D Unity game C# movement script falling issue

When i try to go down a slope my character keeps playing the falling animation everytime it takes a step, tried it on different steepness and happens everytime This is the code i have now: using ...
gson's user avatar
  • 1
0 votes
1 answer
24 views

object floats after collision with another object

So I have a cube with with a rigidbody (with kinematic turned off) and a plane under it without a rigidbody. I have a script on my Cube so that it can move up and down and when I try to collide my ...
Tub The Teletubbie's user avatar
0 votes
1 answer
67 views

Problems Implementing XPBD in to Unity 3D

I've been trying to implement a softbody simulation into Unity based on XPBD (Extended Position Based Dynamics).The tutorial that I have been following is from Matthias Muller from the Youtube channel ...
Xigtim's user avatar
  • 75
0 votes
0 answers
21 views

How to move Cloth down when it reaches end of table in Unity?

I have a sewing machine and a hanger-stand. I have a plane to which i have assigned cloth component. Now what i want to achieve is Move the plane on table of sewing machine, When start of cloth ...
aqeel's user avatar
  • 77
1 vote
0 answers
90 views

Converting quaternions to angles for a 3D editor

I have a 3D map editor and the objects are rotated using a quaternion, but also the user has the ability to set angles using a textbox. I need to correctly convert from angles to quaternion and back I ...
Lagerat's user avatar
  • 11
2 votes
1 answer
109 views

How can I calculate velocity to jump to the target with MatterJS?

I'm trying to create a ball in matter-js that will bounce off rectangles and jump to the next rectangle. All I can know is ball's position and next rectangle's position. I found a similar question at ...
Kisder19's user avatar
  • 123
-1 votes
1 answer
24 views

What is the most efficient way of detecting all objects in a set radius after a short interval. 2D

I'm working on a 2D tower defense game and I'm not sure how to make the turrets get a new target. I want them to focus the enemy that is closest to the end. And I wonder, what is the most efficient ...
IsaKobe's user avatar
1 vote
1 answer
65 views

Godot Simply decelerating a Vector2

Very new to Godot. I'm not thinking about this right as I have had no doing similar in other langs, would appreciate a new set of eyes - thanks! func _physics_process(delta): if joystick_right and ...
zngb's user avatar
  • 623
1 vote
1 answer
55 views

How would I go about creating gravity for the Unity Character Controller?

I’ve been working on a new game with a character controlled by a CharacterController. void Jump() { if (character.isGrounded) { velocity.y = 0; } if(Input.GetKeyDown(KeyCode....
NerdGuy3000's user avatar
0 votes
0 answers
27 views

In Unity Physics2D, after collision, how to get the contact points of the Rigidbody2Ds?

In Unity Physics2D, It's able to get contact points in OnCollisionEnter2D(). public void OnCollisionEnter2D(Collision2D collision) { var contacts = collision.contacts; foreach (var contact in ...
AdmiralOrange's user avatar
0 votes
0 answers
57 views

How do I make a fluid stay in its container using a simulation based on Jos Stam's paper?

I am making a 3D fluid simulation in JS/WebGL based on Jos Stam's papers. I believe everything is working except for either the boundary conditions, advection, or something above my expertise. My ...
giveearholdtongue's user avatar
0 votes
0 answers
21 views

How do 3D models physics mechanics work (how is it setup to behave a certain way)

trying to make a program that uses 3D models and some physics integration, but I dont understand how a 3D model is made to have certain specific properties related to physics, such as collision. A ...
henhen's user avatar
  • 1,055
0 votes
1 answer
25 views

How would I calculate how much of a mesh's volume intersects with another mesh

So, I'm making a game in Godot, and unfortunately it lacks any means of doing this on its own, or even a rough estimate of this using the collision meshes, so since I have to do this manually, I'm ...
Camellias's user avatar
0 votes
0 answers
78 views

How to do collision in MonoGame properly?

I've been making a game using MonoGame framework, but I came across a problem when I tried to handle collisions, to be more specific, player collisions. I tried to search some things on YouTube and ...
Absol's user avatar
  • 101
-1 votes
1 answer
38 views

Apply rotation to rigidbody transform

I have been working on Roll a ball type game. Where i want to rotate the rigid-body on X-axis and rigid-body transform on Y-axis. I know rigidbody rotation and transform rotation are not good friends. ...
Gohar Javed's user avatar
1 vote
1 answer
50 views

how to make my player jump only when it is on ground and not in air in Unity

The code of mine lets my player jump many times like even when my player is in air it can jump. Just like a flappy bird game. I don't want this functionality. using System; using System.Collections; ...
Ashish Sharma's user avatar
0 votes
0 answers
63 views

MoveAndSlide() not working with Character stuck in the same place and not moving

I'm using Godot4 and although IsOnFloor returns true and my characters movement input are registered the CharacterBody2D doesnt actually move I have also tried using MoveAndCollide but when I use that ...
Sreyas's user avatar
  • 11
0 votes
0 answers
37 views

How can an angle to rotate be determined for a moving object taking into account the object’s velocit?

In 2d space, I have a boat that travels to the position of user input via screen touches. The question is that while traveling toward the position of one touch (with varying velocity and speed), when ...
quickj's user avatar
  • 45
0 votes
0 answers
31 views

How to make real-time pvp game where both players perceive in-game time normally while actual relative time-flow speed between them is different?

I was thinking about making a real-time (not tour-like) PvP game where both players among other attributes would have 'speed' attribute that would define their movement and attack speed. But because ...
Amae Saeki's user avatar
0 votes
1 answer
43 views

How to make a moving GameObject push a CharacterController smoothly?

I have a GameObject called Player with a CharacterController component attached that has the following settings. Player also has a script called PlayerController attached. Gravity is applied to the ...
Magnality's user avatar

1
2 3 4 5
78