Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by sspeedy007 · May 08, 2021 at 10:45 PM · car physicswheel colliders

wheel collider input lag problem

hi, im using unity 2020 and I have a problem. I followed a tutorial for a car controller, and have an issue. in link below there is a video, and when I put motorForce from a 1000 to 2000 or 3000, and try to break, it will wait a few seconds before breaking, I think it is the problem with wheel colliders itself, not with the script, does someone know how to fix this?

sorry if it is a begginer question or a stupid one, but I just started learning unity and c# so im not the sharpest tool in the shed for this one hehe.

edit: here is the code: using System.Collections; using System.Collections.Generic; using UnityEngine; public class carController : MonoBehaviour { private float horizontal; private float vertical; private float currentSteerAngle; private float currentBreakForce; private bool isBreaking; private bool isInInterior; [SerializeField] private float motorForce; [SerializeField] private float breakForce; [SerializeField] private float maxSteerAngle; [SerializeField] private WheelCollider frontLeftWheelCollider; [SerializeField] private WheelCollider frontRightWheelCollider; [SerializeField] private WheelCollider rearLeftWheelCollider; [SerializeField] private WheelCollider rearRightWheelCollider; [SerializeField] private Transform frontLeftWheelTransform; [SerializeField] private Transform frontRightWheelTransform; [SerializeField] private Transform rearLeftWheelTransform; [SerializeField] private Transform rearRightWheelTransform; [SerializeField] private Camera camInside; [SerializeField] private Camera camOutside; // Update is called once per frame void Update() { getInput(); HandleMotor(); handleSteering(); UpdateWheels(); } void HandleMotor() { rearLeftWheelCollider.motorTorque = vertical * motorForce * 1.5f; rearRightWheelCollider.motorTorque = vertical * motorForce * 1.5f; currentBreakForce = isBreaking ? breakForce : 0f; applyBreakingForce(); } void applyBreakingForce () { frontRightWheelCollider.brakeTorque = currentBreakForce; frontLeftWheelCollider.brakeTorque = currentBreakForce; rearRightWheelCollider.brakeTorque = currentBreakForce; rearLeftWheelCollider.brakeTorque = currentBreakForce; } void handleSteering () { currentSteerAngle = maxSteerAngle * horizontal; frontLeftWheelCollider.steerAngle = currentSteerAngle; frontRightWheelCollider.steerAngle = currentSteerAngle; } void getInput() { horizontal = Input.GetAxis("Horizontal"); vertical = Input.GetAxis("Vertical"); isBreaking = Input.GetKey(KeyCode.Space); } void UpdateWheels () { updateSingleWheel(frontLeftWheelCollider, frontLeftWheelTransform); updateSingleWheel(frontRightWheelCollider, frontRightWheelTransform); updateSingleWheel(rearLeftWheelCollider, rearLeftWheelTransform); updateSingleWheel(rearRightWheelCollider, rearRightWheelTransform); } void updateSingleWheel (WheelCollider wheelCollider, Transform wheelTransform) { Vector3 pos; Quaternion rot; wheelCollider.GetWorldPose(out pos, out rot); wheelTransform.rotation = rot; wheelTransform.position = pos; } }

Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image sspeedy007 · May 08, 2021 at 10:46 PM 0
Share

edit: this is the tutorial: https://www.youtube.com/watch?v=Z4HA8zJhGEk&t

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by ElmisteriosoYtz · May 09, 2021 at 03:02 AM

You know sometimes I have problems with the colliders too, although I have been in this for a while, one sometimes makes mistakes that should not be made, I say try modifying the colliders or if you do not pass the code, I will check it and tell you if they would be the colliders or the script, remember "the truth is out there"

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

117 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How to automatically stop car when fuel ends up ? 2 Answers

car accelerates too slow ? 0 Answers

Does anyone know good free wheel collider alterantives? 0 Answers

How to properly use WheelCollider GetWorldPos 0 Answers

Strange Wheel Colliders 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges