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
0answers
365 views

How can I avoid jitter when working with a 2D movement system?

How can I avoid jitter in Unity? Let's suppose that I want to create a 2D movement system using a Rigidbody 2D(Dynamic), and I want make the camera follow the character (which is a pixel art sprite)....
0
votes
0answers
56 views

Calculating Damage from from object collision

I need to calculate the damage resulting from a crash of two objects. I found the formula of the resulting kinetic energy: E = m * v² / 2 I guess I also have to ...
0
votes
2answers
99 views

Pushing Rigidbody forward doesn't go straight

I have a object that pushing rigidbody forward when it's instantiated: ...
0
votes
1answer
334 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
vote
1answer
2k views

How to give and remove authority of an object between multiple clients (Or how to let the client controller push a rigidbody)

I'm doing a cooperation FPS game in which players can push big rigidbody cubes with their rigidbody characters (the one from the standard assets). The problem is that the player hosting the game has ...
0
votes
1answer
116 views

Unity Rigidbody sitting on top of another Rigidbody does not move with the Rigidbody its sitting on

I have a mesh with a rigid body that moves back and forth like a platform. Other rigidbodies fall onto the upper surface of this cube. The problem I have is that when the platform rigid body moves the ...
1
vote
1answer
156 views

2d sprite topples over due to circle collider

I am completely new to unity nd was trying to create a simple 2d platformer. I a trying to use a box collider and a circle collider for my Player. I am using circle collider because I have heard it ...
0
votes
1answer
92 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 ...
1
vote
0answers
60 views

How can I make a ball accelerate while moving down?

I am making a super monkey ball game. I want my ball to gain velocity while rolling downwards infinitely, and I cannot find any solution to this on Google. I'm new with c# so I am having a hard time ...
0
votes
2answers
751 views

Hinge joint is not firm, leaving connected anchor position

I have a hook with hinge joint which is working fine but as my object quickly move my hook leave its position for a while. And here is the hinge joint settings with rigidbody: Here is a short clip ...
1
vote
1answer
1k 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
2answers
3k views

Unity3d Move player with UI buttons

I'm trying to move the player based on UI buttons. I found this topic which covers the button listener: https://forum.unity.com/threads/touch-and-hold-a-button-on-new-ui.266065/#post-1944748 Now I ...
-2
votes
1answer
106 views

Why does my OnTriggerStay method throw a NullPointerException when I access the collider's attachedRigidbody?

I set the trigger void OnTriggerStay(Collider other) { other.attachedRigidbody.AddForce(Vector3.up * 100, ForceMode.Impulse); } But when player walks on, ...
2
votes
2answers
553 views

Unity c#: How to slow down rotation over time?

I am making a space combat game, in which the player can press q and e to roll their ship. I did this by adding torque to the rigid body when the player press q or e. However, after they do so, they ...
0
votes
0answers
717 views

Detecting collisions without rigidbody

I have a car with the following aspect: As you can see, colliders are locally static, because they are separated from the original rigidbody component. Well, as you can suppose, I have a problem, ...
0
votes
0answers
227 views

Object moving by adding force to Rigidbody bouncing off where ground objects met

I have a object that moving by adding force to rigidbody. With just big flat plane, it works fine but with connected small planes, sometimes(actually not sometimes, a lot) the object bouncing off or ...
1
vote
1answer
722 views

How to check if NPCs are on ground or not?

I'm using Unity Engine. I see the common way to check if player is on ground is shooting a Raycast: How to solve the ground check problem? How to check if grounded with rigidbody I have a simple ...
1
vote
1answer
146 views

Rotate player to a specific angle using Rigidbody2D

First of all, I'm an absolute beginner in unity and coding so please excuse my lack of knowledge and my mistakes. I didn't achieve to fix my issue with others posts. I'm trying to do a little top-...
0
votes
1answer
80 views

Circle colliders dont work

I have a destination and 2 players. I want the players to reach the destination and not overlap in the process. I attached to each player a circle 2D collider and a rigidbody 2D. Also this script: ...
1
vote
3answers
7k views

Problems applying movement to a RigidBody in Unity

I'm working on a driving game, and I've been using RigidBody.MovePosition (non-kinematic) to move the car. I've read that this is not the best method for physics reasons, but I've had massive ...
2
votes
3answers
4k views

Unity, rb.MovePosition and transform.Rotate at the same time

I can't figure out why my object can't move and turn at the same time. ...
0
votes
1answer
134 views

Rigidbody has unintended effect, velocity limiter from unknown source

I have made a script that alters a rigidbody's angular velocity. It works well but has one issue, its speed plateaus past a certain point. Here is the script: ...
1
vote
1answer
502 views

Make a game object move inside circle and bounce from walls without gravity

I have a circle with a RigidBody2D and CircleCollider2D components on it. I'm trying to make it move constantly inside a bigger ...
1
vote
0answers
97 views

2D: Scaling a character with multiple RigidBody2Ds?

So, this example is in the Godot Engine, but other engines porbably have this kind of problem, too: I have a character with multiple RigidBody2Ds, that also has a ...
0
votes
1answer
1k views

Unity Rigidbody stops directly after moving

I'm creating a skating game, my Idea now for moving was when I move and then dont press any button anymore to move, it should still roll a bit and decrease momentum after a short while to fully stop. ...
2
votes
1answer
7k views

Proper way to set a RigidBody's maximum velocity

I am trying to gradually accelerate a GameObject with a RigidBody attached until it reaches a maximum velocity, at which point it becomes unable to gain any more velocity. I know I can simply reset ...
2
votes
1answer
3k views

Problem when trying to use rb.MoveRotation in Unity

OK so I learned that rb.MoveRotation is different from rb.transform.Rotate(). But I am having trouble using it and hoping you can help me. I usually use transform.translate(Vector3.forward) (after ...
1
vote
1answer
2k views

Should I change velocity or apply force to implement a jump in Unity?

I have started making a basic platformer game just for fun. Its going to be the style of the original Super Mario Bros game, but with 3d assets. My problem is that I'm using a rigidbody and using ...
1
vote
2answers
131 views

Box collider/rigid body eventually moves through static collider

I found this question, but I'm not sure if it applies to my problem. I'm hacking together a Pong-style game, and my problem is with the walls (box collider, no rigid body) not completely stopping ...
2
votes
1answer
588 views

How can I rotate RigidBody and not violate physics?

I'm trying to create a game that we have a falling ball and an spinning object that spin based on user mouse position. user should rotate the object and hit the ball on time to throw the ball into sky....
0
votes
2answers
131 views

Issue giving object player's hand position

I'm trying to put an object (for example a sword) in my player's hand. To do so i set the player's hand transform as the object's parent, in order to have the same movement for the object and the hand....
1
vote
3answers
1k views

Rotate Rigidbody2d slowly for 360 degrees

I would like to perform a 360 degree rotation on a GameObject with rigidbody2d component. You should be able to see the rotation, so I thought of rotating the object 8 times with 45 degrees each ...
3
votes
2answers
2k views

Using collision.contacts to determine if on a floor

I'm trying to make my own first-person character (because I get lost in the sea that is Unity's FP character script), and am trying to make it so it detects when it is standing on a floor. I tried ...
1
vote
1answer
666 views

Character on platform move slowly

I'm having a problem similar to this link: http://answers.unity3d.com/questions/1295955/character-on-a-moving-platform-slows-down.html But... My 2D character is on an elevator (which does not have ...
0
votes
1answer
878 views

Removing Hinge Joint from script doesn't work

I'm facing serious problem with handling hinge joints dynamically in Unity. I made bunch of chains and they are all linked for make something like "sealed door". When I remove HingeJoint component ...
0
votes
1answer
59 views

How to set end of joint that has fixed transform?

I'm implementing chains locked the door, and used Hinge joints to linked the chains like this picture: As you can see, last chain doesn't have connected body because it is end. And when the game ...
0
votes
2answers
429 views

Only subtract velocity on one axis

I'm really slow in uptaking this! I have a GameObject with a Rigidbody. Now I add via AddForce a velocity to the y-axis. But after that, I want to lerp it to zero. But how? My problem is, that I use ...
1
vote
1answer
6k views

Unity - How do I make non-convex Meshes collide with physics?

Whenever I add a Rigidbody component to an object with a non-Convex Mesh, Unity throws this error: Non-convex MeshCollider with non-kinematic Rigidbody is no longer supported in Unity 5. If you ...
3
votes
4answers
5k views

How to disable gravity for a RigidBody moving on a slope?

I created a script that handles movement for my player (moving around, going down and up slopes). However, since I'm using a RigidBody not a CharacterController when I go up slope and stop on the ...
2
votes
2answers
553 views

Unity Engine 2D rigidbody inaccurate jumping whilst on a platform that moves downwards

I'm currently hard at work on a little platformer in the Unity3D engine, utilizing its 2D capabilities. Now I have been having a problem where eventhough an object is clearly grounded it somehow ...
3
votes
0answers
384 views

Add Rigidbody and MeshCollider at runtime : is it a bad practice?

Good day. To simulate an explosion of a vheicle, I decided to do this: When I need to explode veichle , at runtime, i add rigidibody for every single part of veichle (5-10 part: door, wheel, hood ...
2
votes
3answers
772 views

OnTriggerEnter doesn't detect collision until at least one of the two colliders move

I'm having trouble coding a melee attack script. I've set up an attack hitbox that toggles enabled/disabled whenever you press a button (The hitbox itself doesn't move, it just blinks in and out) ...
2
votes
1answer
4k views

Unity's CharacterController vs. Rigidbody with Collider

With a few friends I started to make a 3D game in the style of the old platformers à la Super Mario 64 / Spyro / Banjo Kazooie. So now we are thinking about the controls and how to do them. There ...
1
vote
2answers
717 views

Unity Rigidbody2d jittering movement in the y-axis

As said, rigidbody moves fine, even smoothly in the x axis. Problem comes in on the y axis. Whenever the character goes up or down, it noticeably shakes. Additional Info: Unity 5.6 Using linear ...
0
votes
2answers
4k views

Unity RigidBody2d.MovePosition() not working on dynamic rigid body

As it says, .MovePosition() won't move my character. I know other ways to move but I want .MovePosition() in particular as I think it will solve the camera's jittery movement when the player pushes ...
0
votes
2answers
1k views

Unity Physics - Attract(Rigidbody body)

I have this script Gravity.cs ...
0
votes
1answer
198 views

Problem resolving rotation between sphere-sphere collision

I have developed a collision detector that return collision data, as collision normal, collision point, interpenetration, etc. And now I am developing a collision solver. The collision solver compute ...
2
votes
3answers
3k views

implementing magnet like system in unity

I'm implementing magnet like behavior in unity3d. the red object have a script that add force to it toward a blue object. to do that i use this code: ...
0
votes
1answer
954 views

Obtaining vector representing local z axis orientation

I've been trying to get the vector that represents the local rigid body's true forward pointing (z axis, or blue colored) vector. I've been using Debug.DrawLine(...)...
0
votes
0answers
48 views

Wrong contineous rotation to car

In my 2d game, I want to rotate car face based on collision detected. But at present after 3 to 4 collision its doing continuous rotation only rather than moving straight after collision. Here is my ...