Questions tagged [rigidbody]

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

Filter by
Sorted by
Tagged with
3 votes
1 answer
3k views

Rigidbody slows down when its going up a slope. What can I do?

I am using unity and I am creating a 3d topdown game. There is no jump feature. The input handling supports only x and z axis player movement. Climbing slopes or falling from gaps is something I want ...
0 votes
1 answer
29 views

How do I move both the child & parent game objects at the same time?

My current code is: ...
5 votes
1 answer
441 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 ...
0 votes
0 answers
45 views

Physics Engine Collision Response

I'm making a game engine with my integrated physics engine and I've encountered a problem where rigidbodies tend to over react in collisions and move around without and intention to slow down, I have ...
0 votes
2 answers
62 views

How to implement rigidBody movement and collision in local axis X while moving the body automatically in local Z axis?

I'm making a very peculiar outrun clone. I need the player to move forward automatically while being able to change his position on the road in his local X axis. I made infinitely generated road and ...
0 votes
1 answer
461 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 ...
0 votes
1 answer
40 views

AddExplosionForce in 2D

Its a pretty simple question. I have a gun that shoots bullets, to make the game more fun i want the bullets to be used to navigate. For example shooting them below you would make the player jump up. ...
0 votes
1 answer
26 views

Can't move rigidbody2d when using animations

I have a player moving and jumping by changing its x or y velocity. It worked well until i created a walking and idle animation. Now, the player is animated correctly when idle or walking, but does ...
0 votes
2 answers
98 views

Why is my enemy not moving?

I'm trying to make a 2D Unity platform game for a school project, but I can't seem to get the enemy to move. ...
1 vote
1 answer
69 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" ...
0 votes
1 answer
733 views

Physics engine and rigidbody sleep optimization

I am trying to add sleep optimization to my little physics engine(just for learning). I use SAT for collision detection that returns penetration normal and depth without contact points. Objects are ...
-1 votes
3 answers
1k views

"Rotation Quaternions must be unit length" using rigidbody.MoveRotation in unity

I'm making a game that involves throwing things with catapults. The cup of a catapult needs to use Rigidbody.MoveRotation to let a ball respond to being thrown in ...
0 votes
2 answers
775 views

How to calculate the post Rigidbody2D velocity vector before applying a specific force in Unity?

I am trying to implement a space rocket in 2D. Whenever the player presses a button, a constant force (Both vertical and horizontal) is being added to that rocket. What I want to add is a maximum ...
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 ...
1 vote
1 answer
237 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 ...
1 vote
1 answer
109 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 ...
1 vote
1 answer
153 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. ...
0 votes
2 answers
121 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 ...
0 votes
1 answer
2k 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
1 answer
126 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: ...
0 votes
0 answers
60 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 ...
0 votes
1 answer
110 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 ...
0 votes
1 answer
282 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 ...
0 votes
0 answers
134 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 ...
0 votes
2 answers
123 views

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

I an using the following code for handling slopes: ...
0 votes
0 answers
237 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 ...
1 vote
1 answer
64 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 ...
2 votes
0 answers
57 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/...
0 votes
1 answer
1k views

Verlet rope between two moving points connected with a spring joint?

I'm connecting two moving rigidbodies using a spring joint in Unity. Between them, a rope will be rendered using a line renderer and I want it to move realistically as the joints move, without physics....
1 vote
2 answers
1k views

How do I change the gravity for just one object

I'm making a 2D game in Unity and I have a player character who needs to walk on the four walls of a room, so I gave them a Rigidbody so I can change the gravity. But my game has enemies too and when ...
1 vote
3 answers
2k views

How can I create a dice toss that results in a specific value?

I am trying to create a 3D dice for a game. Normal dice has been created by setting cube for dice with Rigidbody and apply force to throw a dice. Now the problem is, the user wants to give a value 1 -...
0 votes
1 answer
108 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, ...
0 votes
0 answers
437 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 ...
0 votes
1 answer
127 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 ...
0 votes
0 answers
58 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 ...
0 votes
1 answer
40 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 ...
8 votes
3 answers
5k views

How to move the player while also allowing forces to affect it

For now, that's how I move the player: rb.velocity = Vector2.right * input.x; And I affect him a force while he is damaged by an entity: ...
0 votes
1 answer
51 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 ...
0 votes
0 answers
228 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 ...
1 vote
1 answer
1k views

Rigidbody player controller on moving platforms

So basically, I was trying to make moving platforms. When I finished my prototype, I noticed that the movement on the platform is very wobbly: https://www.youtube.com/watch?v=hmBumsrlHGA&feature=...
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, ...
0 votes
1 answer
75 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: ...
0 votes
1 answer
124 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 ...
1 vote
1 answer
782 views

Character moving without control

i've been developing a third person adventure game on Unity with a grappling hook and i found a problem that i don't understand and it's driving me mad. Basically, if the player character collides ...
0 votes
1 answer
61 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 ...
2 votes
1 answer
463 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 ...
0 votes
1 answer
265 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 ...
1 vote
2 answers
323 views

Unity - movement code overriding rigidbody mass?

Unity noob here... I have a basic movement script, but whatever I set the objects mass at it still falls the same speed, floating down off ramps instead of sticking to the floor. I saw some posts ...
0 votes
1 answer
162 views

How do I rotate finger joints using controller input?

Suppose I have an index finger composed of 3 cubes which all contain Rigidbody which have isKinematic set to true. In a ...
0 votes
1 answer
244 views

Animating MultiPart 2D Character with RigidBodies

Some background to the question: I am attempting to animate and control a large multi sprite 2D Boss character for a platforming game. Up until this point I had been assigning individual animators for ...

1
2 3 4 5 6