Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [rigidbody]

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

0
votes
0answers
86 views

Raycast collision Detection different results?

So I'm trying to make a collision detection system for a kinematic rigidbody for a gameobject but for some reason the results in which the gameobject stop is always different. I tried missing around ...
1
vote
1answer
36 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
2answers
104 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 -...
1
vote
2answers
106 views

Move rigidbody using WASD keys but rotate it based on camera/mouse movement

I am very new to unity and my scripts are based on some scripts found on the web. I want to make a first person view so the camera is attached to my rigidbodys head. Then i want to move my rigidbody ...
0
votes
2answers
19 views

Dividing properties between RigidBody and Collider

I am currently making a physics engine in Rust. The 2 main data structures concerning collision detection are: RigidBody: Physics-related aspects of the body. Contains a reference to a Collider ...
0
votes
1answer
52 views

How to stop Objects with Rigidbodies from explosion when dragging

I have a sequence of capsules linked with fixed join and each capsule have a Rigidbody and a cube collider (the picture bellow shows how it's look like) and this ...
0
votes
1answer
42 views

How to make a rigidbody come to rest faster

I'm trying to move around a 3D rigidbody in Unity 2018.1.0f2 Personal. I am using a C# script with the basic vector3 and velocity stuff from a YouTube video: ...
7
votes
3answers
3k 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: ...
1
vote
1answer
56 views

Is Rigidbody needed and what move function to use in 2D games?

I don't really fully understand how to use rigidbody and which movement functions in a 2D game. There seems to be so many options and it's just a mess in my head right now. If I'm making a game like ...
2
votes
0answers
17 views

Unity - kinematic rigidbody character calling OnCollisionEnter and OnCollsionExit on every frame for specific collisions

I'm encountering an issue with my character collider behavior. I have several elements that are relevant to this issue: a "character" gameobject (capsule mesh), that is assigned with a kinematic ...
0
votes
0answers
31 views

Changing Unity Rigidbody.centerOfMass throws off AddRelativeTorque() calculations

This is an odd one, that has me kind of stumped. If I execute the code: void FixedUpdate() { rigidbody.AddRelativeTorque(0, 1000, 0); } I get this: Normal, ...
0
votes
0answers
24 views

Adding a collider to a wheel in a way that does not interfere with the suspension

I want to add a collider to a wheel so that it does not interfere with the suspension in any way but will allow the car to run into walls or other cars. The implementation of the wheel is as follows: ...
0
votes
1answer
19 views

What are constraints and how are they pluggable?

I have been reading this book called "Game Physics Engine Development" and Came across this image in the context of Collision Resolution. See the contact Generator part. Can someone tell me what are ...
1
vote
1answer
76 views

Unity tilemap collider not colliding with rigidbody

In the wireframe you can see the tilemap collider for this hill. The red circle falls right through however. The circle has a 2D rigidbody attached. Everything is on the Default sorting layer and on ...
0
votes
0answers
29 views

How can I stop my character's velocity in only one direction?

I'm moving a character by setting its velocity. It works perfectly and stops how I want it to however when I'm moving forwards and sideways at the same time and I stop moving either sideways or ...
0
votes
0answers
58 views

why are my 2d game objects passing through each other?

So I've been looking around for a while and can't seem to find an answer for this. I am trying to make a game where you stack shapes as high as possible. I have an OnMouseDrag script so I can grab a ...
0
votes
2answers
45 views

RigidBody.MoveRotation Resetting to (0,0,0);

I'm trying to rotate a character on along the y axis but rather than continuing to rotate, it rotates then the y rotation goes back to 0. I'm not sure what I'm doing wrong. The same thing happens if I ...
0
votes
0answers
17 views

Rigidbody Jump acceleration with no reason

I'm doing some jumping behaiour, and i'm going crazy: I have a planet oriented gravity. When I precisly jump just after my player is OnGrounded, the next jump is bigger (the 2 last one in the pciture)....
0
votes
0answers
33 views

Center of World Map not the same as the center of my Bullet Physics World

As you could see in the image, the center of my map should be located at the intersection of the diagonal lines. When I import 3D buildings within the area into my Bullet physics world, I want to set ...
1
vote
0answers
60 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
30 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
34 views

Pushing Rigidbody forward doesn't go straight

I have a object that pushing rigidbody forward when it's instantiated: ...
0
votes
1answer
72 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 ...
0
votes
1answer
45 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
44 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
46 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
47 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
52 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
199 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
301 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
210 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
44 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
166 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
240 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
126 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
285 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
77 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
41 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
2k 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 ...
0
votes
2answers
1k 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
96 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
316 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
53 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
595 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. ...
0
votes
1answer
3k 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 ...
1
vote
1answer
2k 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
727 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
67 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
390 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
105 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....