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
0answers
22 views

Jumping a image in javascript

Which is the most efficient way to animate an HTML <img> element in vanilla javascript so that it jumps and falls back with acceleration. Edit: Im adding ...
0
votes
0answers
16 views

How do I implement corner correction in a platformer?

I'm writing a platformer in Unity and I'm trying to make it so that when the player jumps up to a ledge but barely misses (imagine they hit their toe on the ledge, or maybe even their foot, I'll play ...
0
votes
0answers
10 views

How to make a dynamic/variable length physics based rope in Unreal?

So I have followed several tutorials on making a physics based rope using bones and physics constraints. Similar to this video here. I have found success but, it seems like a waste of time to keep ...
0
votes
0answers
17 views

Intersection of ray and non-axis-aligned box

I need to compute the intersection of a ray with a non-axis aligned box. Currently, I transform the ray into the local space of the box, do classic ray-AABB intersection and transform the intersection ...
0
votes
1answer
14 views

Unity: AddForce in transform.forward direction not working as expected

I am building a very simple car-driving game in Unity. I have a Player object, which looks like this: As you can see, I have a Rigidbody2d component attached to this object, as well as a script, ...
0
votes
1answer
51 views

Rotate Rigidbody to face away from camera with AddTorque

I have a camera that rotates around an object with "Look At" . I want the object to rotate to face the direction the camera is pointing (Camera.main.transform.forward) using AddTorque, but I can't ...
0
votes
0answers
14 views

Unity : How to make ships slide around a planet smoothly

I'm making a game similar to galcon/phage wars and I'm stuck at the part where the fleets when travelling from one planet to another,if they hit a planet that is not the target then they should go ...
0
votes
0answers
28 views

Best option to narrow a known set of triangles?

I am building collision detection and response in a custom engine. This routine happens between the moving player, and static entities on the map. In the first phase, the broad phase I am moving the ...
0
votes
1answer
27 views

Effectors in 3D

I see that, in the Unity editor, there are only Effector2D components, but no Effector components. Are there other components that can be used with the 3D physics engine, that function like effectors? ...
0
votes
0answers
19 views

Why does rb.velocity blurrs background?

My player controller code is bellow. So is my player inspector. This makes my character move yet it blurs the background, but when I use ...
0
votes
0answers
18 views

My colliders keep going through one another? [duplicate]

So, I have some platform with colliders and a character with a collider (everything in 2D). The problem is, while there is some noticeable effects (a certain push back) when the colliders collide, ...
0
votes
0answers
17 views

Attach (Child)Rigidbody TO (Parent)Rigidbody let it collide with Tilemap

We want to attach a (Child)Rigidbody to another (Parent)Rigidbody so that the (Child)Rigidbody is also transformed on (Parent)Rigidbody transformation. The other constrain is that the (Parent)...
0
votes
1answer
39 views

Rotation of a 3D ball on a plane

This used to be on the physics stack exchange but I was told to put it here: I'm making a game (with physics) and I have a 3D ball rolling down a flat plane. It moves perfectly fine, but the rotation ...
0
votes
1answer
44 views

How to physically move a rigid body up the stairs?

When an object is controlled by a CharacterController, it is easy to make it climb ramps with a certain slope, or climb steps with a certain height. When the object is controlled by a RigidBody ...
0
votes
1answer
46 views

How to use AddForce on a capsule?

I created a simple scene, with a box that serves as the ground, and a capsule that serves as the player. I added to the player a RigidBody, and a component that should move it using AddForce: ...
0
votes
0answers
23 views

Rigidbody with many colliders has strange inertia

I've had some feedback from my game that "gravity feels weird and moon-like". After some investigating I found that some of my objects do indeed behave as though they are on the moon. I can confirm ...
0
votes
1answer
31 views

OnTriggerEnter works…sometimes

I was working on a small game in which you shoot projectiles towards various targets, now I decide to use OnTriggerEnter instead of OnCollisionEnter because OnCollisionEnter adds a slight force to the ...
0
votes
0answers
29 views

Player losing alignment with tilemap after moving

I'm using an isometric tilemap(2:1) and I can't figure out how to make grid based movement on it's surface. I managed to get a code working for the grid based movement, moving my character with 0.5 ...
0
votes
1answer
21 views

Basic rigidbody movement

This is a noob question but, what is the rigidbody movement equivalent of: transform.position += transform.right * speed * Time.deltaTime;
0
votes
0answers
22 views

How do you exactly implement a Semi-Implicit Euler type of movement in a 2D platformer?

So I've been following along Sebastian Lague's 2D platformer tutorial, and to understand exactly how the physics of how a jump is done, I dug into the subject and noticed a lot of people, from ...
0
votes
1answer
30 views

How can I decelerate a physics object to a stand still?

I am currently working on a little prototype and I am struggling to apply a friction force to slow down the player object. I have a simple physics engine using the model of setting acceleration, ...
0
votes
0answers
24 views

Using delta time in game loop and physics calculations doesn't work as desired

I know there have been similar questions on this site and others, but after trying to apply the different things I read into my own code, none seem to really solve my issue or help my understanding. ...
0
votes
1answer
48 views

Random.range giving me the same value at the same time

I created a random direction in x and y-axis at where to move, then my problem is when I tried to randomize it sometimes I get the same value at the same time on both x and y-axis. How do I not let ...
0
votes
0answers
33 views

How do I smooth janky movement over ground as rope length is reduced?

Here is a video showing the type of movement I am talking about: video I have a configurable joint attached to the player which reduces in length every frame the player touches the ground. I do this ...
1
vote
1answer
9 views

Unity 2019.3 - Tilemap colliders 2D + Componsite colliders + Platform effectors

I am using tilemaps to create my own platform game. This is what I had in the first place. This was working fine in first place, but is an issue. Sometimes, the enemies get stuck while running along ...
0
votes
1answer
49 views

How do I not let my explosion go through the walls like bomberman?

I have this problem that I want to fix. Every time I place a bomb it goes pass through the wall even if I added a Layermask to tell if it's a wall or not. ...
1
vote
1answer
163 views

Unity 2019.3 - Player getting stuck on wall

Problem I have a wall made with a Tilemap and a Tilemap Collider 2D. Sometimes, when the player jumps against the walls, it seems to get stuck. You do not need to be pressing the directional button, ...
2
votes
0answers
39 views

Avoid shaking artifacts in 3D continuous collision detection

I am programming a 3D game physics engine that uses continuous collision detection to avoid my objects from being able to "tunnel" through the geometry. Here is basically how it works: Execute a ...
1
vote
0answers
17 views

How is the density of a collider determined?

I read here that, once determining the density of a Buoyancy Effector, "Colliders with a higher density sink, those with a lower density float, and those with the same density appear suspended in the ...
0
votes
1answer
54 views

Player with Character Controller and children colliders won't collide properly

I have a player that consists on a root object with the Character Controller attached and some children with its components. Those have box colliders attached. When moving the player I want to be ...
0
votes
0answers
15 views

Speed after an angled collision?

I can calculate the speed when there is no angle, but I can't calculate the speed when it is angle. Physics paramaters: ...
0
votes
0answers
44 views

Kinetic sand simulation

I want to simulate Kinetic sand's behavior in my game. I could implement operations such as slicing and cutting using simple mesh cutting algorithms but I want to implement complicated operations such ...
0
votes
0answers
6 views

(2d) Error pops up when handling enemy knockbackS [duplicate]

So I created some code that will make the enemy take knockback upon taking damage from the player. I put this behaviour inside the EnemyInheritance script so that every enemy I have in the game will ...
1
vote
1answer
31 views

Apply impulse in direction line is pointing with force proportional to the length of line

I have a line perpetually pointed at the mouse and originating at the player, but the length is limited to a certain value. I also can create a circular object on demand in Box2D (specifically the ...
0
votes
1answer
22 views

Unity trigger method does nothing

I have the following script on my object: ...
0
votes
0answers
20 views

Grappling hook script sometimes causing jitter

I am trying to implement a grappling hook mechanic. My grappling script is attached to my camera that is attached to the player. Sometimes when I try to grapple onto a wall, it causes jitterting ...
0
votes
1answer
18 views

Unity Springjoint2d - how to put collider between anchors?

I want gameobjects to bounce off a line between 2 springjoint points. I placed boxcollider2d (with small Y scale) or edgecollider2d between two Joint points and every frame put it in right place, set ...
0
votes
1answer
36 views

How to add or increase speed on every 500m distance of player?

I'm a a beginner, creating an endless runner game. I want to increase speed as the player completed the distance and on every 500 meter speed should be increased. Anyone have an idea of how to ...
0
votes
0answers
15 views

How to rotate my gameObject using Joystick control?

So, I am still a beginner C# game dev. and I am making a 2d airplane game right now and I wanted to know how I can make this feature when the joystick is faced in a direction let us say I moved the ...
1
vote
2answers
56 views

How to move my character by itself but I can still move its direction or where it is going, using Mobile Joystick?

So, I am making a 2D airplane game right now and I wanted to know how to move my player automatically but I can still control where it should go or the direction. How do I code this using Mobile ...
0
votes
0answers
31 views

Rigidbody appears to jitter when placed as a sibling to a First Person camera

In my game, the Player can pick up an object (which gets parented to the first-person camera), or the player can push an object (which is parented to the player, but not their first-person camera). ...
0
votes
1answer
49 views

Colliders slightly intersecting each other; any solution?

Consider this simple scene: In Unity, colliders slightly intersect each other. Typically, this isn't a problem. However, I want to make a custom character controller using a box collider and not a ...
0
votes
1answer
22 views

Applying wheel sideways friction to car

I'm applying sideways friction to my car from each wheel, but for some reason my car starts to accelerate forward instead of having forces acting sideways and stopping it. This is the script: ...
0
votes
0answers
19 views

How can I prevent two rectangles from overlapping?

I have two rectangles defined by their respective left, right, top and bottom. I'm trying to prevent the collisions for these two rectangles but I cannot find a working solution. I am obtaining the ...
1
vote
1answer
57 views

Unity raycast equivalent in Unreal

I've been moving from Unity to Unreal and I'm finding it difficult to grasp the Raycast (Trace) logic of Unreal. The use case I'm trying to implement at the moment is to trace a ray and check if I ...
0
votes
1answer
32 views

rigidbody cube falls off the ground

Inspite my ground and cube contains colliders as i apply rigidbody it falls down....use gravity
1
vote
1answer
105 views

Godot: How do I get the id mask for a physics layer by name?

I would like to figure out whether a collider is in a physics layer by the name (string) I set in project settings: ...
0
votes
0answers
38 views

Swinging rope using Velocity Verlet integration is lossing way too much energy

This is a tough question. I tried implementing velocity verlet using the c++ implementation on this Wikipedia page: https://en.wikipedia.org/wiki/Verlet_integration I then added some constraints to ...
1
vote
0answers
28 views

Rigidbodies gaining speed when they shouldn't

I'm trying to get the effect of a constant magnetic field on a charged particle. A really important aspect of this is that the magnetic field doesn't do any work on the particle, which in this case ...
0
votes
1answer
65 views

Hinge joints chain movement (2D)

I have some problems with hinge joint chain movement calculations... Here is my algorithm for segments location/rotation adjustments after a previous segment update (C#): ...

1
2 3 4 5
40