# Tag Info

## New answers tagged physics

0

The 3D soft bodies can be implemented using spring joints and mesh bones. Assign spring joint to each bone and connect it to all the other bones. Tutorial link: https://www.youtube.com/watch?v=tTdKEJpX2HI&feature=youtu.be&t=1088

0

Your error message tells you exactly what's wrong: when you implement the OnTriggerEnter message, Unity expects the parameter to be of type Collider. But the way you wrote your OnTriggerEnter(Collider2D other), its parameter is of type Collider2D. These are completely unrelated types - one is from the 3D physics system using PhysX, the other is from the 2D ...

2

You're not applying just a horizontal force. You're applying a vertical force too. Your desiredVelocity is constructed with a y component of zero, saying "I desire that this object should hover instead of falling," and the rest of the code then tries to honour this stated desire. To fix that, just set delta.y = 0 before you calculate your ...

1

When you set the velocity of your rigidbody directly, then: It will (obviously) cancel all other forces acting on the rigidbody. So you lose the option to use any force-based effects at all on this object. That means no knockback, no explosions, no wind... (unless you program the low-level physics for those yourself) When there are other non-kinematic non-...

0

Let's say we want our acceleration to be an affine function of time, meaning we have a constant jerk. That makes our velocity vs time graph take the form of a parabola, with its directrix parallel to the time axis. The general equation for such a curve is: $$v(t) = a \cdot t^2 + b \cdot t + c$$ Since your parabola goes through the point $(t, v(t)) = (0, 0)$...

1

This solution is for grid based games. The idea is to have "turns". A turn will happen regardless of whatever or not there is input or not. At the end of the turn the avatar will be aligned to the grid, and a turn always takes the same time. Pseudo-code: var current_time = get_current_time(); var elapsed_time = current_time - start_time; ...

1

(I can copy this over to your original question if you'd like to undelete that one and delete/close this one instead) I'd solve this by storing an array of the grid points the snake head has run through, and the next point it's on its way toward. Then we'll store a progress variable between 0 and 1, that represents how far the snake has progressed from its ...

1

The Methods Vector3.RotateTowards or Quaternion.RotateTowards can help you here. They turn the object towards the desired direction, but put a limit on how far the object is allowed to turn by specifying a maxDegreeDelta parameter. So when you put this in your Update method to turn the object into the direction of the stick, but set a small maxDegreeDelta ...

0

I found that I must add gravity to the velocity before add velocity to the position. And I have also changed collision code. public override void Update(GameTime gameTime) { velocity.Y += gravity; position += velocity * (float)gameTime.ElapsedGameTime.TotalSeconds; } public void CheckBounce(SpriteGameObject other) { ...

Top 50 recent answers are included