Questions tagged [rigidbody]

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

Filter by
Sorted by
Tagged with
0 votes
1 answer
34 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
49 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: ...
  • 1
0 votes
1 answer
54 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 ...
0 votes
2 answers
106 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
93 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 ...
1 vote
1 answer
79 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
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, ...
  • 169
0 votes
0 answers
23 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 ...
  • 101
1 vote
0 answers
110 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: ...
  • 229
0 votes
0 answers
142 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 ...
1 vote
1 answer
78 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. ...
0 votes
0 answers
117 views

I'm using a *Floating* Capsule Collider, but it keeps contacting floor especially if I fall at high speeds?

I have the below code for a "Floating Capsule" style Rigidbody controller. Based largely on a tutorial (https://www.patreon.com/posts/astro-kat-moving-21343562) although I've modified it a ...
  • 45
0 votes
1 answer
174 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 ...
  • 419
1 vote
1 answer
58 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 ...
  • 13
0 votes
0 answers
13 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 ...
  • 101
1 vote
0 answers
312 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 ...
  • 11
0 votes
0 answers
16 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 ...
  • 1
1 vote
1 answer
250 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. ...
0 votes
0 answers
80 views

Using ProjectOnPlane to stick to slopes and avoid getting stuck on difficult terrain?

I have a simple Rigidbody movement script. I am having difficulty getting the rigidbody to stick to slopes, and also to collide with difficult terrain without getting stuck. I read that ProjectOnPlane ...
  • 45
0 votes
1 answer
96 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 ...
  • 11
1 vote
1 answer
127 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 ...
0 votes
0 answers
98 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 ...
  • 45
0 votes
0 answers
33 views

High rigidbody drag value gives weird speed readings

when calculating speed in unity ...
  • 169
0 votes
0 answers
34 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 ...
1 vote
0 answers
147 views

Maths behind Unity rigidbody.AddForce

I've tried to understand the Maths behind AddForce, as to reproduce it using rigidbody.velocity +=. Based on the formulas ...
11 votes
1 answer
3k views

How can I "zero out" velocity in an arbitrary direction?

I'm currently running into an issue with my character controller using physics-based movement of rigidbodies in Unity. Here's an illustration of the issue I'm facing: Basically, after a jump, my ...
  • 530
0 votes
1 answer
102 views

How to knock animated character backward when sword strikes wall

I was wondering how to make animation and physics interact. Specifically, I want to make it so when my character (rigidbody) plays a sword hit animation (swinging the sword in front of it), it makes ...
0 votes
1 answer
61 views

How do I use a ball as a wheel?

I'm brand new(ish) to Unity with a strong programming background. I understand the basics of "how to roll a ball" in Unity, but I have a custom model I made in Blender which I have imported ...
  • 165
-1 votes
2 answers
166 views

Parent object does not rotate on its own axis with its children. How do I fix it?

My parent object components: Rigidbody2D and the script I shared below. Children(Head, Body, Arm, Backpack...): There is only collider. There is no rigidbody2D. (I want the parent object to use the ...
  • 13
1 vote
1 answer
277 views

Firearm magazine ejection

I am playing around with a VR game where the player can fire a hand gun. When the magazine is empty they can press a button on the controller to eject the magazine from the gun. As its VR, I would ...
1 vote
1 answer
57 views

Make a rigidbody walk around a planet

I have my character with a rigidbody and attracted by the planet. I am trying to move it with its velocity. I tried this script: ...
0 votes
1 answer
72 views

Why addForce creating some small movement in my game object?

I'm working in a project with Unity 2d where player walks on a small planet. I try to use some code from youtube tutorial to apply gravity to my planet.This code consists of two parts, Attractable and ...
  • 88
3 votes
1 answer
136 views

Why my player can suddenly fly?

I'm working in a project with Unity 2d where player walks on a small planet. I try to use some code from youtube tutorial to apply gravity to my planet.This code consists of two parts, Attractable and ...
  • 88
0 votes
0 answers
53 views

Why does Lerp not reach target if setting rb.position, but setting rb.transform.position works?

I don't understand the logic here. I have the following script which makes a player jump towards a target: ...
  • 45
1 vote
0 answers
63 views

Root Motion animation clipping through Rigidbody objects? (Unity 3D)

I am trying to program a climbing system. Player has rigidbody, ledge has rigidbody. Both also have Colliders, and the Player animator is set to use Root Motion. When Player grabs ledge and climbs up ...
  • 45
0 votes
0 answers
583 views

Sprite jitter on movement with pixel perfect camera and Cinemachine in Unity

I have been struggling to get rid of jittery sprites in my game. I've been pulling my hair out for past 4 weeks trying to fix this issue. So I cooked up a small show case project with my player that ...
  • 1
-1 votes
3 answers
240 views

Object is not moving after collision

I have player and walls. When the player hits the wall, its not moving. This is the code for moving: ...
0 votes
0 answers
121 views

Unity 3D - Grappling Gun not making Player lift off the ground at all?

I have the following code (based on https://www.youtube.com/watch?v=Xgh4v1w5DxU but tried to convert to work with world space points for Third Person Character usage): ...
  • 103
1 vote
0 answers
258 views

With Unity, why this character with a rigid body and child element colliders doesn't collide with the floor and go through it?

I got an issue with my character going through the ground and actually going through all other elements with a collider. I'm going to try and show as much as I can of the current state of things. My ...
1 vote
1 answer
32 views

Dynamic bridge via joints

When a new object is added to the bridge, the bridge shakes violently, and when objects are added even faster, it breaks. I've tried changing mass and changing time step, but that doesn't solve the ...
  • 105
0 votes
1 answer
95 views

Control does not work if motion is set in FixedUpdate

I made touch controls, but when I set forward movement, the control stops working. ...
  • 105
0 votes
1 answer
107 views

add force to object that has 2 different rigid bodies

I need add force to object that has 2 different rigid bodies and someone said that the best way of this is using fixed joint. The case is this ; I have player object and it has a pusher object that ...
1 vote
0 answers
66 views

How to get a consistent behavior for a rigid body hooked platform?

Consider this platform made of RigidBody2D and PinJoint2D objects: PinJoint2D setup is: <...
1 vote
0 answers
118 views

How to make a catapult work with physics and colliders?

This should be my final question regarding getting a catapult to throw something in unity. On my last question, someone suggested starting with something simpler (which I apologize for not doing ...
0 votes
1 answer
305 views

add random force and direction to rigidbodies every x seconds

i need to add a windForce to multiple rigidbodies, with random direction and random force every x lapse of time. I'm using ...
-1 votes
2 answers
468 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
1 answer
370 views

How to Get VR Controller's Velocity in Unity with SteamVR?

Back when I used Unity 2017 and controller bindings weren't a thing, I simply attached a rigidbody to my Vive controller and read out the velocity of the rigidbody to know how fast the player was ...
0 votes
1 answer
781 views

How do I adjust my rigidbody velocity on a local axes?

I have an fps rigid body script, code listed here: ...
  • 490
0 votes
1 answer
543 views

Rotating fps rigid body on the Y axis

I'm currently attempting to make a first person character using a rigid body. I am aware that the character controller exists, but I believe my game will be very physics based so it's better if my ...
  • 490
0 votes
4 answers
971 views

Sticking the Rigidbody2D player to a moving platform without parenting & transform fiddling

I have a player entity with Rigidbody2D component and I have a moving platform which is a kinematic Rigidbody2D. Player movement is done by setting it's velocity (...
  • 337

1
2 3 4 5 6