Questions tagged [rigidbody]

In game development, a rigidbody is usually referred to anything that is affected by physics.

Filter by
Sorted by
Tagged with
1 vote
1 answer
54 views

What would be the best way to gradually increase the speed of a 2D arcade game with gravity physics in Unity?

I'm somewhat new to Unity, so I'd like to hear some more experienced thoughts on this. I'm using C# if that helps. I'm currently working on an arcade game somewhat similar to "Doodle Jump" ...
soxyo's user avatar
  • 13
5 votes
1 answer
123 views

How to get consistent collision impulse values for colliding rigid bodies in Godot?

I'm writing a game where you can pick and throw objects and depending on the force of the impact they break. Using the get_contact_impulse method to calculate the breaking point gives me very ...
Luke B.'s user avatar
  • 1,107
3 votes
1 answer
2k views

Why objects are falling equally in Unity

I have different game objects with rigid bodies, each having its own mass and drag. However, when these objects fall, they appear to fall at equal speeds. This raises the question of why they do not ...
Muhammad Faizan Khan's user avatar
1 vote
1 answer
122 views

Rigid bodies sliding off slopes

Kinematic bodies have a simple class that makes the player not slide on slopes, but for rigid bodies? I tried using rays and areas, either to lock the player on an axis or to just straight up disable ...
Cei's user avatar
  • 863
1 vote
1 answer
86 views

Rigidbody2D goes over destination when moving with Vector2.Lerp

I'm rounding the position of an object (the blue cube) when the player stops pushing it using ...
Samuel Fyckes's user avatar
1 vote
1 answer
99 views

How to prevent colliders from knocking each other back before being destroyed?

For context, I have a player that can use a bow or a spear to shoot enemies in a 2D side scroller game. The bow shoots arrows and the spear shoots itself, and they both have rigidbody2Ds attached. ...
Peecee's user avatar
  • 13
0 votes
2 answers
97 views

Struggling to launch my player backwards after it comes into contact with an enemy object

I am pretty new to Unity... watched quite a few of Brackey's and other YouTube videos along with a lot of research. I have been trying to add an impulse to my player so that after it comes in contact ...
shanksVR's user avatar
0 votes
1 answer
91 views

how to rotate my character along the y axis when character is aligned with a slope

I have a capulse character Im moving around in my 3d Game, I usually rotate the character using this line of code: ...
Jambo's user avatar
  • 11
0 votes
0 answers
56 views

Children of a rigidbody are able to move through the floor

I have a problem with rigidbody collisions atm. I have a parent object that has a rigidbody and I am spawning objects that become that parent object's child (the children are all spheres). These ...
Christian Blevens's user avatar
0 votes
1 answer
95 views

Switching a velocity from one rigid body to another in unity

I have a set up where the ground and the player move with physics and a stationary camera. I want the ground to move faster when the player is getting further away making it look that the player is ...
Barreto's user avatar
  • 123
0 votes
1 answer
222 views

Rigidbody drifting after being stopped

I am struggling with an issue in Unity where I am stopping a rigidbody's motion, but after the motion is stopped the rigidbody still moves slightly. It is causing me major issues as I need the object ...
Cato's user avatar
  • 33
0 votes
0 answers
91 views

How to move a Rigidbody2D to exactly match the movements of another body?

I'm recording the velocity of a Rigidbody2D using Animation Curves and I need to reproduce the same "movement" on an instantiated prefab (we really need "stuck like glue" movement ...
Igor's user avatar
  • 219
0 votes
2 answers
104 views

How to convert slope handling code to work with AddForce instead of AddRelativeForce?

I an using the following code for handling slopes: ...
yukjaly7's user avatar
0 votes
0 answers
186 views

Why doesn't jumping work if character is on upwards slope and moving forward?

I am having an issue where when I hit space to jump, the jump will only work (as in, launch player straight up into the air) only if I am (1) on flat ground (moving or standing still), (2) on a ...
yunum's user avatar
  • 47
1 vote
1 answer
63 views

How to settle a rigid body to rest on flat surface

I am trying to simulate the behaviour of a rigid body, for example a cube, while it settles on a flat surface. Let's say it lends on an edge or even on a corner, and now it has to settle and remain on ...
Žarko Tomičić's user avatar
2 votes
0 answers
45 views

How to connect particles to rigid bodies in LiquidFun?

In vanilla Box2D various types of Joints can be used to connect two rigid bodies together. The LiquidFun extension brings the Particle Module, but I was unable to find a way to connect a particle/...
Simon Zvara's user avatar
0 votes
1 answer
101 views

Bullets shooting all over the place

I have created a simple player controller, which contains the player logic for a movement, aim and shooting bullets from a gun. Everything almost works, except the bullets shoot in random directions, ...
Laurens van Oorschot's user avatar
0 votes
0 answers
360 views

Kinematic Rigidbody parented to a moving Rigidbody gets displaced

I have a kinematic Rigidbody parented to another non-kinematic moving Rigidbody. Render-wise, the child Rigidbody does not jitter, nor does it inherit any displacement changes from the parent ...
LifGwaethrakindo's user avatar
0 votes
1 answer
113 views

How to adjust speed based on the angle of the Vector3 you are following?

I'm applying forces to a Rigidbody rb. The forces come from points along a spline splineComputer. The code says "find ...
m0a's user avatar
  • 115
0 votes
0 answers
50 views

Motion of a cube after it bounces off a floor

I am trying to simulate what happens when a cube hits the floor after free fall. I am considering a situation in which cube hits the floor with its edge. There is obviously reaction force from the ...
Žarko Tomičić's user avatar
0 votes
1 answer
34 views

LedgeClimb script not choosing point to grab correctly when encountering Stacked meshes (meshes on top of one another)?

I created a script to climb ledges. It shoots 4 raycasts total: -2 shooting straight forward from player (origins left and right of player) -2 shooting down from forward&above player (origins left ...
m0a's user avatar
  • 115
0 votes
1 answer
48 views

Why is my simple movement script making Capsule go into the air when movement is fast?

I am trying to create a simple movement script. Currently I don't have any jumping implemented; the movement script should just move rigidbody-based Capsule left, right, forward, backward based on ...
m0a's user avatar
  • 115
0 votes
0 answers
191 views

Rigid Body is rolling/spinning on collision, is there a way to have it slide on surfaces instead?

I have a rigid body with a sphere as a collision mesh which can move and rotate freely. It realistically spins when colliding with other objects, but this is annoying from a gameplay standpoint. Is ...
Mazz1224's user avatar
0 votes
0 answers
57 views

Different approaches to rigid-body movement

I'm a beginner at game development and I'm building my own physics game engine to grasp the concepts. I wonder if there are different approaches to moving and rotating a rigid body. For example, ...
mcas's user avatar
  • 1
0 votes
1 answer
62 views

When I rotate a game object, it keeps moving the same direction

When I try to rotate my game object, it keeps moving in same direction. I think there is pretty basic solution but couldn't figure it out. Here is my code: ...
Ivan's user avatar
  • 317
0 votes
1 answer
116 views

How to move on vertical wall with gravity ticked for rigidbody

I am making a ball-rolling game. I want to implement an interaction where the ball can move on a specific area of a vertical wall like the game that the images show, but I don't know how to implement ...
YOUNG ETHAN's user avatar
0 votes
1 answer
53 views

How to find combination of vectors to equal target velocity?

I have a space craft in a 3d world that moves along the X Z plane. Given that I have 4 thrusters with one at each cardinal direction, and the ship can rotate itself about the y axis. Is it possible to ...
Jeremy's user avatar
  • 15
2 votes
1 answer
391 views

Use one collider for Rigidbody2D.Cast, and another for a hurtbox

I'd like to do the following: Characters (player, enemies) have a collider for collision with the world (= other characters/obstacles/etc) Characters have another collider acting as a hurtbox (most ...
Gerrit Begher's user avatar
0 votes
1 answer
199 views

Imitate simplified bird-flight behavior

I am developing a first-person player movement in which the player should "fly" in the direction of his local forward vector. This is working perfectly fine, however, when I turn the player ...
Omer Simchoni's user avatar
0 votes
0 answers
92 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: ...
FeelZ's user avatar
  • 1
0 votes
1 answer
82 views

Player is able to interact with objects but enemy isn't able to

Newbie here, I have a player script that interacts with objects just fine and I made an enemy script for the same object and it gets completely ignored: Below there are 4 scripts. The ...
desperrrr's user avatar
0 votes
2 answers
514 views

Why is Vector3.ProjectOnPlane() "drifting" further from desired rotation on steep slopes

I'm writing a simple player movement script in Unity 3D, and I've been using Vector3.ProjectOnPlane() to accomplish slope/ramp movement. For the most part, this ...
Mr. Slug's user avatar
0 votes
1 answer
349 views

how to have player stay on a rotating platform?

Im making a top down game in unity. in my game there is a platform where the player can stand on. while this platform is moving the player moves with it. here is an example: This almost works like i ...
yente paternotte's user avatar
2 votes
1 answer
165 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 ...
Bastian Born's 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, ...
Object's user avatar
  • 289
0 votes
0 answers
253 views

How can I pragmatically move a navmesh rigid body when changing scenes?

I have an object with both rigid body and NavMeshAgent attached Which I want to set to a new location on scene change, but there is something weird going on with it. If I just try to set the position ...
Michael's user avatar
  • 101
1 vote
0 answers
273 views

2D faux gravity walk/stick to a planet

I'm trying , to make a Player walk on a planet , through searching , I figured out that I can achieve this effect using Faux gravity , I tried to Implement it , but it's not working as intended: ...
Abanoub's user avatar
  • 239
0 votes
0 answers
308 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 ...
AAron_-51's user avatar
1 vote
1 answer
133 views

Making interacting gears in 2D

I want to create mutually rotating gears for a puzzle game. I looked at a lot of material, but didn't understand how to make a RigidBody2D stay in one place correctly and interact with each other. ...
Андрей Тарасков's user avatar
0 votes
1 answer
756 views

Why do colliders have a tendency to spin and develop crazy angular velocity in Unity when used as my "player"?

I am trying to create a basic collider for a rigidbody player in Unity 3D. I have been experimenting with numerous shapes but found it hard to get what I want. The primary issue seems to be if the ...
mike's user avatar
  • 481
1 vote
1 answer
157 views

How do I apply real time physics to a 2D game in Java?

I'm developing a 2D Brick Breaker style game in Java and want to apply some real time physics to it, especially to the paddle/ball interections. Nothing too complex; just applying some of the physics ...
Andre's user avatar
  • 13
0 votes
0 answers
14 views

Unity3D object falling from high are passing through ground [duplicate]

First, you can see the bug in action here: https://www.youtube.com/watch?v=vqbo3rweEmA When rigidbody objects are falling from high position (300 in my test), the ground collision doesn't works, the ...
Ben's user avatar
  • 101
1 vote
0 answers
973 views

No Collision while rotating. Object rotating with Rigidbody.Rotate passes through other collider

I'm working on a 3D game, and having issues with the colliders. My Cube Controller has movement input by keyboard, with collider and rigidbody components. Cylinder objects have basic colliders and ...
Sheath9's user avatar
  • 11
0 votes
0 answers
23 views

Is there a lighter way to implement "object stops when hit wall" without relying on Dynamic gameobjects in Unity3D (2D)?

I am currently using a Dynamic GameObject for my entities, but I feel as if that will risk slowing down the game on weaker hardware (especially when there are hundreds of entities). Not only that, but ...
Hdis's user avatar
  • 1
1 vote
1 answer
999 views

How do I get OnTriggerStay2D to consistently work in Unity?

(2D Project) I have a very basic set-up in which I have a Hallway with a door and a bunch of other objects. I have a player that starts on the left side of the hallway and only moves on the x-axis. ...
bogorian cooking oil warrior's user avatar
0 votes
1 answer
175 views

Why does my code intended to stop Rigidbody from sliding prevent player from jumping?

I have the following code which gives a Rigidbody capsule the ability to move and jump (if on layer Ground). After Player stops input, the Rigidbody slides. I ...
Max's user avatar
  • 11
1 vote
1 answer
815 views

How to make a code-generated mesh interact with a rigidbody?

I'm using a sphere and an empty game object that generates a mesh upon playing/starting. On the mesh, I place a Mesh Collider component with ...
Andrew Q's user avatar
0 votes
0 answers
545 views

What causes Rigidbody character to suddenly move at fast speeds?

I'm trying to make a Rigidbody-based movement script for a character. It behaves pretty much as expected, but every once in a while the character will suddenly run at a massive speed. I can't find a ...
yunum's user avatar
  • 47
0 votes
0 answers
68 views

High rigidbody drag value gives weird speed readings

when calculating speed in unity ...
Object's user avatar
  • 289
0 votes
0 answers
47 views

How to change fall delay of a gameobject by time?

I want my gameobjects to fall faster by time as the player collides with them. What I mean is, when the game starts, the gameobjects fall off after 1 second the player collided with them, but after 60 ...
imbruceter's user avatar

1
2 3 4 5 6