Questions tagged [rigidbody]
In game development, a rigidbody is usually referred to anything that is affected by physics.
311 questions
0
votes
2
answers
111
views
When should an object with a collider have a rigidbody?
I had some questions about Physics / Rigidbody in Unity.
I have a 2D sprite with a collider. The 2D sprite is simply a card that I place on a table with the mouse. I use the collider for raycasting (...
0
votes
2
answers
121
views
Why is my rigidbody not moving when I press the buttons? I can't see any reason it shouldn't
The "Car" in question is a plane. The question is pretty self explanatory.
Here's the Car in the Hierarchy:
Here's the car in the inspector:
And here's the PlayerMovement script:
...
0
votes
1
answer
111
views
OnTriggerEnter called without a Rigidbody
I use Unity and the player controller in the game is acting strangely. It has a Character Controller but no Rigidbody. I use CharacterController.Move to make him ...
1
vote
0
answers
41
views
Inertia tensor (rigid bodies) in body space vs. world space
I'm currently trying to better understand the concept of the inertia tensor in the context of rigid bodies, and I was hoping someone could help clarify a few points for me.
From what I've gathered so ...
0
votes
1
answer
225
views
3D Dark Souls lock-on code: Player moves around target in a spiral, not perfect circle
I'm working on a 3D game in Unity that requires lock-on, or Z, targeting found in games like Dark Souls and Legend of Zelda: Ocarina of Time.
The code that I have achieves my intended goals fairly ...
0
votes
1
answer
104
views
How to make movement relative to player rotation using Rigidbody.AddForce() in 3D Unity?
I'm making a 3D game and I was trying to make movement relative to player rotation for several hours, but I failed. Here's the code, maybe I made a mistake there. Also, player doesn't rotate.
...
2
votes
1
answer
199
views
Character Keeps Entering and Exiting Trigger on Moving Platform in Unity
I'm developing a character controller in Unity and running into a problem with my character repeatedly entering and exiting a trigger collider on a moving platform. The character should stay within ...
0
votes
1
answer
59
views
Cannot resolve symbol 'detectCollisions' on Rigidbody2D
I'm simply trying to disable collisions for a Rigidbody2D:
rb.isKinematic = true;
rb.detectCollisions = false;
as per: https://...
1
vote
3
answers
1k
views
How to add a local gravity/force field in Godot?
I am trying to develop something in Godot and I was hoping it would be possible to create some sort of gravity field. I do not mean just the default falling down indefinitely. I mean like a kind of ...
0
votes
1
answer
71
views
How make a rigidbody not to change its trajectory by any external collsion?
I am trying to make a platformer game in which the player is able to run on the platforms. I have the platforms moving from the right to the left direction and the player is standing on top of the ...
0
votes
0
answers
89
views
Collision detection with CapsuleCast
I'm attempting to detect when a gameObject with a Capsule Collider and RigidBody attached it lands on the floor, which is a Mesh with a Mesh Collider attached it to it. Adding a tag to the Floor ...
0
votes
0
answers
94
views
Wheel collider for skateboard falls through the floor in Unity?
Problem: Why are the wheel colliders not colliding with the floor?
Here's a video that shows how the skateboard just falls through the ground:
https://imgur.com/a/Vx7QraF
I have this kind of hierachy:
...
0
votes
0
answers
61
views
In Unity, how can I check whether two objects are sliding on each other or rolling against one another?
I'm coding a script to make objects emit appropriate noises on contact with other objects, with different sounds for isolated impacts, sliding, and rolling.
Impacts work just fine, but for the other ...
0
votes
0
answers
84
views
Unity Rigidbody.AddForce stops adding force when there are too many objects in scene
As title stated, when there is too many objects in scene (made when a turret object in my scene shoots too many bullets, they do despawn after a duration so its not completely clogging my scene) my ...
2
votes
1
answer
204
views
Rigidbody Simulated vs Static vs none
I am confused about the usage of static / not simulated rigidbodies.
I get that it is better to disable simulated to temporarily stop a rigidbody rather than deleting and recreating it, especially ...
0
votes
0
answers
135
views
Why do I have to freeze my player's x and z rotation to make my player movement work and why does my camera stutter when colliding with things?
So I have an empty object called player with the PlayerMovement script and a rigidbody. I have the main camera and player visual as childs of it. The movement works ...
0
votes
1
answer
143
views
Why is my player not colliding with animated obstacles?
I can't figure this out. My obstacles have a basic box collider on them and my player has a rigidbody based controller and collsion detection is set to Continous and when obstacle hits him it just ...
1
vote
0
answers
96
views
What exerts a force on my rigidbody?
I'm trying to create a simple 2D scene with two rigidbodies, which are connected by two pin joints.
There is one large rigidbody, a green circle, which is slowly rotating at a constant speed (as its <...
0
votes
1
answer
78
views
How do I move both the child & parent game objects at the same time?
My current code is:
...
0
votes
2
answers
117
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
163
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
142
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
157
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
137
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" ...
6
votes
1
answer
1k
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 ...
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
646
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
209
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
434
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
237
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
239
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
101
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
217
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
502
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
193
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
168
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
312
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
2
answers
171
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
103
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
133
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
596
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
177
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
99
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
63
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 ...
0
votes
1
answer
95
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
340
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 ...
0
votes
0
answers
74
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
167
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
169
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 ...
0
votes
1
answer
93
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 ...