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.

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

Unity 2D Parabolic character movement between platforms displays unexpected behaviour

I am trying to write an enemy AI that jumps between available platforms when it doesn't have ground below its feet. I want the character to do the jumps in a parabolic fashion rather than doing a ...
user avatar
3 votes
1 answer
52 views

Eliminate bouncing when switching/sticking to a different surface

I am following this tutorial to make a KinematicBody2D align to the surfaces below it. When switching from one surface to another, the character bounces until it ...
user avatar
  • 229
0 votes
1 answer
27 views

How do I revert back to "normal" speed after a slight boost hitting a collider mid-air?

How do I revert back to "normal" speed after a slight boost from hitting a collider mid-air? ...
user avatar
0 votes
1 answer
17 views

Unity physics2d object repelling itself from static colliders

Is there a way to have a 2D object repel itself from any colliders within a radius? A PointEffector2D will repel other colliders, but no force is exerted on the object containing the effector. I also ...
user avatar
0 votes
0 answers
25 views

HingeJoint stops constraining the relative axis of rotation between connected bodies

The selected leg is supposed to be connected to the blue leg by a HingeJoint, but as you can see on the image the relative rotation between these two bodies is wrong. The leg behind the selected one (...
user avatar
  • 7,857
0 votes
0 answers
38 views

In Unity what is the best way of making a robot that has several legs connected with joints move?

Here's how the robot looks like in the scene: Here's its structure as an object: LegX2 is connected to LegX1 with a HingeJoint. LegX1 is connected to Platform with another hinge joint. These two ...
user avatar
  • 7,857
0 votes
1 answer
26 views

How to know if a rigidbody2D is moving away or towards another position?

I want to know if the rb2D is moving away or towards the other position. Is there a formula to determine this?
user avatar
0 votes
1 answer
23 views

Projectile arc velocity changes depending on target x-axis position

I am trying to create an enemy for a 2D platformer that launches a projectile in an arc at the player position (think throwing a grenade, launching an arrow style parabola). Everything works as ...
user avatar
0 votes
1 answer
62 views

Implementing tension in chain/rope pulling

I'm trying to implement the movement of a chain of segments connected to each other (gravity, mass, etc. are not involved). The chain can only be dragged by its "head" segment. Each segment ...
user avatar
0 votes
0 answers
23 views

Hey, how can i program a Knockback system for Enemies upon hitting them based on this script?

I am trying to program some Knock for enemies. This script goes onto the sword and causes the enemy to start the hurt animation and display particles { using System.Collections; using System....
user avatar
0 votes
0 answers
43 views

Problems with knockback implementation

In 2D platformer I'm having difficulty with knockback feature that happens when character touches enemy. That's implementation of it. Character.cs: ...
user avatar
  • 1
3 votes
1 answer
95 views

How to navigate a moving 2d spaceship under newtonian mechanics to a point in space?

I am creating a real-time game where ships move through space using basic laws of motion. The ships move by rotating (instantly for our purposes) to an angle and then firing their engine to accelerate....
user avatar
  • 41
1 vote
1 answer
57 views

Unity Engine Movement Script Causes Shark To Fly

This code is for controlling a shark I want to have continuous collision detection which won't work with MovePosition so I tried changing it other options but those are making the Shark Fly Why does ...
user avatar
1 vote
1 answer
68 views

Model path of bullet to hit future position of balloon

I am coding a Bloons Tower Defense Game and one of the problems I have is how to shoot a projectile from a tower and have it hit a balloon that is moving along a certain path. The way I am currently ...
user avatar
0 votes
0 answers
50 views

Game networking with physics different client and server languages

We are currently having only "turn based" multiplayer games in our party game lobby system. Now we considered to add realtime multiplayer games as well, for example golf in 3D. Our current ...
user avatar
0 votes
0 answers
38 views

2D circle and rotated square collision detection and response

I'm creating a 2D multiplayer game in javascript, but I'm actually struggling with a problem (not really a problem, but I don't know how to do). I'm actually trying to make my player (circle hitbox) ...
user avatar
0 votes
1 answer
52 views

3D CharacterController ride moving platforms in Unity?

I have a player controller script that I'm writing that uses the CharacterController component to move around and handle collisions. I've been able to implement ...
user avatar
0 votes
0 answers
28 views

I am looking for a flexible way to rotate a gameobject around another

I try to make an object rotate around another object on mouse input. In order to achieve this I used this code: ...
user avatar
0 votes
0 answers
20 views

How to utilize stacking blocks under the player object(cylinder) by using rigidbodies in unity3d?

I am working on a hyper-casual game project which is very similar to Matching Cubes. Initially, I was using transform to stack blocks under my cylinder(player object). But in the game there will be a ...
user avatar
0 votes
0 answers
101 views

Smooth lerp towards a moving target

I stumbled upon this function that lerp towards a moving target with exponential correction which works really well. The original author mentioned integrating the target position. Can anyone explain ...
user avatar
  • 11
0 votes
0 answers
51 views

Quaternions around a moving Sphere

I'm using quaternions in my code to move my game camera around an object in 3D space. When stationary it works great and really simplifies the code. Unfortunately when the object starts moving I can't ...
user avatar
0 votes
0 answers
64 views

How do I respond to AABB collisions?

I'm coding a physics engine in Javascript. Forces, Gravity, Friction, AABBs are taken care of. Now, the big question: how do I respond to AABB collisions? Right now, when an object collides, it prints ...
user avatar
  • 1
1 vote
1 answer
58 views

How to make an object move and rotate the same amount as another obejct

INTRO: I am trying to make a camera move around in a fast moving, rotating in all axis, spaceship.... This person has achieved exactly what I need to achieve if that is a good reference for you (go to ...
user avatar
  • 169
0 votes
1 answer
74 views

Detect Child Trigger inside Parent Script

I want to detect when a Child's collider is being triggered to apply the damage to the thing being hit. But currently I'm confused about how it works. Does the Parent's ...
user avatar
  • 3
0 votes
0 answers
20 views

Collision not being detected on CharacterController in Unity

Help! For whatever reason, I was following a tutorial on Unity movement, and when I was going to test out collision for certain objectives in my game, for whatever reason collision is not being ...
user avatar
1 vote
1 answer
75 views

Why do physic engines apply force fully linear, despite adding torque

I checked how the applyForce function on rigid bodies in 3 different physic engines work (cannon.js, matter.js, PhysicsJS) and it seems that this is the common way ...
user avatar
12 votes
2 answers
3k views

Moving player inside of moving spaceship?

INTRO: I am trying to achieve a spaceship that flies through space and the pilot can get out of their seat and walk around the ship and place physics objects in it while the ship is moving, rotating, ...
user avatar
  • 169
0 votes
1 answer
46 views

Predicting Inclines and Declines for projectiles

For background, I am working on a top-down fighting game. I'm trying to create an archer class, in which the arrow sort of predicts the inclines/declines (moving it about the Y-axis [or up/down]). A ...
user avatar
  • 11
0 votes
0 answers
57 views

line renderer collision detection in 3D

I've been using the code down below to simulate a rope physics (based on this: Create Rope Bridge, String in Unity - Verlet Integration Part 2). Currently, it uses edge collider 2d to detect collision....
user avatar
0 votes
0 answers
38 views

How to move an enemy to sneak up on the player from behind, using forces?

I have this code to move the enemy: (for x, same for y) ...
user avatar
  • 237
0 votes
0 answers
26 views

Best approach to model slipstream?

I am looking for a way to model slipstream effect in videogames. The two use cases I want to look at are a simple racing game and the simulation of a peleton (a big group of road bike riders), both in ...
user avatar
  • 133
-1 votes
1 answer
30 views

The vector aiming to enemy is in wrong direction

In a 2d game, I am trying to shoot at a moving enemy and the vehicle that is shooting is also moving. However, the velocity of the bullet is not in the same direction as the position of the enemy. The ...
user avatar
0 votes
2 answers
62 views

How to connect rockets to a space capsule?

I am trying to create a space capsule that has four rockets to balance the capsule. The rockets and capsule haveRigidbody2D and ...
user avatar
  • 3
0 votes
0 answers
10 views

aiming prediction in 2d game using projectile [duplicate]

I am trying to make an agent predict the velocity required to throw a ball at a target and take into consideration the target. So what I need is a ball following a projectile path until it hit the ...
user avatar
1 vote
0 answers
76 views

Aircraft simulation

Trying to get a "semi" realistic aircraft simulator. I'm pulling my hair out because I just can't get the math right. I'm not looking for super realistic but want to at least get some ...
user avatar
  • 111
0 votes
1 answer
67 views

I have a "Floating Capsule Collider" setup, but if Collider stands on the edge of a platform, the player Mesh ends up looking 'stuck'

I have a "Floating Capsule Collider" setup, but it has an issue when the Collider stands on the very edge of a platform-- the player Mesh ends up looking 'stuck' inside of the platform. How ...
user avatar
  • 45
0 votes
1 answer
25 views

How would I calculate the velocity of a sphere with an impulse applied at the top?

I'm developing a rigid body physics engine and currently have accurately calculated the angular velocity of the sphere when impulsed. Unfortunately though, I'm not calculating the velocity correctly ...
user avatar
  • 1
0 votes
0 answers
117 views

Plot rigidbody path simulating magnus effect

I am trying to create a method that will plot the path a rigidbody will take when simulating a magnus type effect with no gravity in Unity. I realize this approach is a drastic simplification to the ...
user avatar
1 vote
1 answer
68 views

Configurable Joint rotation doesn't seem to respect mass difference

The Problem I've run into a physics issue in my Unity project, and have put together a simple example scene to illustrate it. Hopefully someone will be able to tell me if I'm doing something wrong. In ...
user avatar
3 votes
1 answer
162 views

Unity CharacterController steps on colliders with 0 Step Offset

I'm moving my CharacterController with the Move() method and for some reason it still steps on colliders even though its Step ...
user avatar
  • 627
0 votes
3 answers
75 views

How to prevent a huge backlog of physics calculations from freezing browser when tabbing out of browser game?

I'm developing a browser game and am using the timestep implementation from the famous Fix your timestep! article. It works perfectly, but there is one problem. If you tab out of the tab and then come ...
user avatar
0 votes
0 answers
20 views

Unity - Rigid Body Floats Away When Adding Ragdoll

I added a ragdoll component to my enemy model and now it just floats away whenever I run the game, this never happened before I added the ragdoll. if theres anything else I need to send just tell me ...
user avatar
0 votes
0 answers
77 views

Wobble physics like Sandwich Runner Unity3d

Here's the game, that's the wobble! I am trying to make a hypercasual game similar to Sandwich Runner, I can't quite figure out how the wobble mechanics was made! Where the stacked objects wobble when ...
user avatar
  • 1
0 votes
2 answers
250 views

How to manually Simulate Physics properly on Unity?

I'm trying to simulate physics manualy in a Unity 3D game. I've turned off Physics "Auto Simulation" in Project Settings and wrote this piece of code (it is more or less the unity doc sample)...
user avatar
  • 123
1 vote
1 answer
164 views

How to slide along a wall at full speed?

I was reading this answer, and while it works for that use-case, mine is slightly different (simpler?), but I can't figure out how to do it. What I'm looking for is a way for the player to retain ...
user avatar
-1 votes
1 answer
30 views

How to destroy just the specific powerup I hit, not all of them?

Creating a game for a computer science class - basically I have a player (cop) who will collide with donuts. When the player collides with a Donut, I want the speed to increase by 0.5 each time. Here ...
user avatar
0 votes
0 answers
32 views

How can I simulate something heavy?

I need to convey the feeling that something is heavy in a game-like experience. The environment is web-based, most likely mobile. Specifically, I need the user to be able to lift/move a chain and get ...
user avatar
  • 101
2 votes
0 answers
92 views

How to accelerate car based off of Animation Curve?

I am making a karting game and I want the karts velocity to accelerate based off a curve. This would allow me to quickly iterate different types of cars that accelerate in different ways. I was ...
user avatar
0 votes
1 answer
104 views

How to make a capsule Rigidbody player "kick" a Rigidbody sphere (ball) in Unity?

I am just learning the basics of physics simulation with rigidbodies. I am trying to simulate some basic real world functions like kicking a ball. Let's say I have a simple capsule mesh/collider as my ...
user avatar
  • 227
1 vote
0 answers
197 views

Circle and circle collision (with physics), but when lots of circles pile up things go wrong [closed]

I'm trying to make an as realistic as possible ball physics simulator. Currently, I worked out all the collisions between balls, and it works really well when there are few balls. But once you create ...
user avatar

1
2 3 4 5
46