Jump to content
  • Advertisement

NoizullI

Member
  • Content Count

    2
  • Joined

  • Last visited

Community Reputation

0 Neutral

About NoizullI

  • Rank
    Newbie

Personal Information

  • Interests
    Art
    Programming

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Thank for your help, but i am finding a way to make it work the same at high time step, not to change the property to adapt the time step. And here is my current suspension code. private void SuspensionUpdate() { spring.preOverflow = spring.overflow; spring.overflow = 0f; if (grounded && Vector3.Dot(hit.normal, transform.up) > 0.1f) { spring.bottomedOut = spring.overExtended = false; spring.length = transform.position.y - hit.point.y; if (spring.length < 0f) { spring.overflow = -spring.length; spring.length = 0f; spring.bottomedOut = true; } else if (spring.length > spring.maxLength) { grounded = false; spring.length = spring.maxLength; spring.overExtended = true; } } else { spring.length = Mathf.Lerp(spring.length, spring.maxLength, Time.fixedDeltaTime * 8f); } spring.velocity = (spring.length - spring.preLength) / Time.fixedDeltaTime; spring.compression = (spring.maxLength - spring.length) / spring.maxLength; spring.force = spring.maxForce * spring.compression; spring.overflowVelocity = 0f; if (spring.overflow > 0) { spring.overflowVelocity = (spring.overflow - spring.preOverflow) / Time.fixedDeltaTime; spring.bottomedOutForce = parentRigidbody.mass * -Physics.gravity.y * Mathf.Clamp(spring.overflowVelocity, 0f, Mathf.Infinity) * 0.0225f; parentRigidbody.AddForceAtPosition(spring.bottomedOutForce * transform.up, transform.position, ForceMode.Impulse); } else { damper.force = spring.length <= spring.preLength ? damper.bumpForce * spring.velocity : -damper.reboundForce * spring.velocity; } spring.preLength = spring.length; }
  2. I am creating a simple raycast car, it work fine at 0.01 fixed time step but the suspension is very unstable at the higher time step, i want it to work well at 0.05.Does anyone have ideas to solve this?
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!