# Tag Info

1

You should not mix Transform changes (like transform.Translate()) with Rigidbody/Rigidbody2D movement. Use one or the other exclusively. If you want your object to move with physics, let the physics engine handle all its movement. Mixing these means anytime you edit the Transform, you're ripping the object out of the control of the physics engine, ...

3

I think we can do this more simply. This demo uses about 80 lines of code (the interesting ones being just the dozen below), instead of over 300, with no angles/trigonometry functions needed: At the time $t^*$ when we reach the vertex, we know the acceleration due to gravity has completely wiped out our vertical launch velocity: \begin{align} v_y + a_g ...

1

Note my original response suggested simply increasing maxMotorTorque, but it appears this has no apparent effect by itself. Try adding force to the parent (car_body) rigidbody along with the motor values of the wheel colliders. Something like this: float motor = maxMotorTorque * Input.GetAxis("Vertical"); rb.AddForce(transform.forward * motor); ...

0

I said in the OP I was struggling to find the way to use a PID controller in this case, but I've figured how to do it. Here are the few steps: Calculate the thrust required to go at the speed of B Use the distance to B as an input error for the PID Use the values returned by the PID as an offset applied to the thrust Tune the PID (the funniest part of ...

1

(I started to answer this before the post was closed soon after the question was posed and before I could finish it. DMGregory's answer is more complete and sophisticated, but I'm offering this anyway because I think it should be very easy for a beginner to understand.) The first part of your question is pretty simple. For demo purposes, here's our set up: ...

2

You can do this with a variation on this bobblehead script I wrote. Keep the spring stiffness high and the conservation low to make the object stay more upright and bounce less. using UnityEngine; public class Bobble : MonoBehaviour { // We'll sproing about this transform's origin point. public Transform pivot; // Tunable parameters for ...

1

In general you should not set a rigidbody’s velocity directly, as it often results in weird behavior, per the docs: Rigidbody2D.velocity Instead, try AddForce(), AddTorque() or AddForceAtPosition()

1

No, Unity does not offer you the option to apply different drag on different axis'. However what you can do is: Implement your own drag mechanic, as in the answer by Acme Nerd Games Change the drag coefficient in FixedUpdate depending on the current direction of the velocity vector. This is a solution I used once to implement a "drifting" mechanic ...

2

I can think of two ways to address your problem (while still using Physics2D) : Increase Gravity You could try increasing the gravity scale to offset the extra drag. Implement your Own Drag You could zero the rigidbody drag factor and instead add a script that adds an force on the x-axis only of the rigidbody that increases with speed. Here's a (simplistic) ...

0

One problem with many physics engines is that they are not deterministic. That means that two computers executing the same physics simulation with the same input parameters might end up with two different results. For example because one of them runs at a higher framerate leading to a more detailed resolution. This is often not much of a problem in ...

0

Is there something that makes client prediction/corrections easier in the kinematic version than the physics version? This is a good example. If you want an authoritative server, you would run all of your physics on the server. There is no need to run it again on the client for important parts, such as the player. So when the server tells the client the ...

Top 50 recent answers are included