Questions tagged [rigidbody]
In game development, a rigidbody is usually referred to anything that is affected by physics.
303
questions
0
votes
0
answers
3
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
23
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
44
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
28
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
40
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
58
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
63
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
68
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
88
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
35
views
How do I move both the child & parent game objects at the same time?
My current code is:
...
0
votes
0
answers
60
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
71
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
79
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
43
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
104
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
86
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
684
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
365
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
121
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
262
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
150
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
169
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
67
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
127
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
334
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
154
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
142
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
265
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
71
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
70
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
111
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
505
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
140
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
70
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 ...
0
votes
1
answer
52
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
262
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
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
105
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
131
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
62
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
514
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
321
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 ...
0
votes
0
answers
102
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:
...
0
votes
1
answer
87
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 ...
1
vote
2
answers
668
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 ...
0
votes
1
answer
563
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 ...
2
votes
1
answer
211
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 ...
12
votes
2
answers
4k
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, ...