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 /
  • Help Room /
avatar image
0
Question by unity_kxRUio0XfKZqGQ · Jun 30, 2021 at 02:55 PM · rigidbodyblendercarsnakestretch

We can't give snake movement to 3D car

Hello, we've been working on a problem for about 3 weeks and couldn't find a solution. This is the game we want to make

https://www.youtube.com/watch?v=nkUqtcLrmag

However, the problem we face is this;

https://drive.google.com/file/d/1fvqeA-1qYzedIr2JS9mKLT5gXrmFpsTf/view?usp=sharing

As the car rotates, breaks occur, I guess every rig rotates on its own axis.

Solutions we tried;

-increase the polygon of the car -Increasing the number of rigs and putting them in different places -Painting with Weight Painting -Physical body

We rig the car in blender. Blender also does not have a problem with its stretching, but when it comes to Unity, it does so.

The solutions we think are;

-if each rig rotates from the same pivot point the problem can be solved but we don't know how to do it.

-Can it be done with shaders?

We would be very happy if you could help :)

This is the source code we used

void Start() {

     for (int i = 0; i < listBones.Count; i++)
     {
         GameObject newPivot = new GameObject();
         newPivot.transform.parent = transform;
         newPivot.transform.position = pivot.transform.position;
         listPivots.Add(newPivot);

         listBones[i].transform.parent = newPivot.transform;
     }

     listBones.Clear();

     for (int i = 0; i < listPivots.Count; i++)
     {
         listBones.Add(listPivots[i].transform);
     }

     bone1 = listBones[0].gameObject;

 }    


void Move() { if (listBones.Count <= 0) return;

     float mouseX = Input.GetAxis("Mouse X");
     float mouseY = Input.GetAxis("Mouse Y");

     if (Input.touchCount > 0)
     {
         mouseX = Input.touches[0].deltaPosition.x;
         mouseY = Input.touches[0].deltaPosition.y;
     }

     if (Input.GetAxis("Horizontal") != 0)
         listBones[0].Rotate(Vector3.up * 5 * Time.deltaTime * mouseX);

     for (int i = 1; i < listBones.Count; i++)
     {
         curBodyPart = listBones[i];
         prevBodyPart = listBones[i - 1];
         
         dis = Vector3.Distance(prevBodyPart.position, curBodyPart.position);

         Vector3 newPos = prevBodyPart.position;

         newPos.y = listBones[0].position.y;
         newPos.z -= 1f;

         float T = 0;
         T = 45 * Time.deltaTime;

         if (T > 0.3f)
             T = 0.3f;

         //curBodyPart.position = Vector3.Slerp(curBodyPart.position, newPos, T);
         curBodyPart.rotation = Quaternion.Slerp(curBodyPart.rotation, prevBodyPart.rotation, T);
     }

     transform.Translate(-bone1.transform.right * Time.deltaTime * speed);
     //bone1.transform.Translate(-bone1.transform.up * mouseX * Time.deltaTime * speed);
     //transform.Translate(transform.right * mouseX * Time.deltaTime * speed);
     bone1.transform.Rotate(Vector3.up * mouseX * Time.deltaTime * sensitiviy * 15);


     //Limits
     if (transform.position.x >= 3.5f) transform.position = new Vector3(3.5f, transform.position.y, transform.position.z);
     else if (transform.position.x <= -3.5f) transform.position = new Vector3(-3.5f, transform.position.y, transform.position.z);

 }
Comment
Add comment
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

0 Replies

· Add your reply
  • Sort: 

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

223 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 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

Ragdoll from Blender doesnt work in Unity 0 Answers

I'm making a car system and my car isn't moving even though the wheels are turning. Everything has a RigidBody. I'm using Bolt Visual Scripting. 0 Answers

Make an object follow another object's path (Snake game) 0 Answers

Importing blender model with rigid body 0 Answers

Car steering on a Rigidbody (Mario Kart) 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