Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 meozdemir90 · Jul 27, 2020 at 02:09 AM · 3djointsspringjointsoftbody

Whats the best way to make softbody phyiscs

Hello friends! I am trying to have a jiggly behavior on my character as he rolls and jumps.


My first approach was using bones and adding spring joints, rigidbodies, sphere colliders and connect them to each other but this somewhere causes my movement script to not work. Technically what happens is the sphere collider on the model rolls out of the model's body.


I am using this video https://www.youtube.com/watch?v=tTdKEJpX2HI&t=29s but i lose the movement. What exactly i am trying to achive is this gif https://i.gyazo.com/a6fc870b1bf90b750f157a5090830e5a.gif


I dont want to use some assets like megafiers or whatnot so i can learn and improve a skillset and a mindset on the concept.


Here is my movement code;

     using System.Collections;
     using System.Collections.Generic;
     using UnityEngine;
     
     public class PlayerMovement : MonoBehaviour
     {
         public Rigidbody rb;
     
         //forward speed 
         public float forwardForce = 100f;
     
         //left and right position definition
         private float xPosition;
     
         //Jump system
         public LayerMask groundLayers;
         public float jumpSpeed = 10f;
         public SphereCollider col;
     
         private void Awake()
         {
             rb = GetComponent<Rigidbody>();
         }
     
         // Start is called before the first frame update
         void Start()
         {
             xPosition = rb.position.x;
             col = GetComponent<SphereCollider>();
         }
     
         // Update is called once per frame
         void Update()
         {
             //forward speed definition
             rb.AddForce(0, 0, forwardForce * Time.deltaTime);
     
             //left and right position to key controls
             Vector3 pos = rb.position;
             pos.x = Mathf.MoveTowards(pos.x, xPosition, forwardForce * Time.deltaTime);
             rb.position = pos;
     
     
             if (Input.GetKeyUp(KeyCode.LeftArrow))
             {
                 xPosition -= 6f;
             }
             if (Input.GetKeyDown(KeyCode.RightArrow))
             {
                 xPosition += 6f;
             }
     
             //jump info
             if (IsGrounded() && Input.GetKeyDown(KeyCode.Space))
             {
                 rb.AddForce(Vector3.up * jumpSpeed, ForceMode.Impulse);
             }
     
             //Limiting the movement to right and left as 5f (invisible wall)
             transform.position = new Vector3(Mathf.Clamp(transform.position.x, -6f, 6f), transform.position.y, transform.position.z);
     
         }
     
         //fall info
         private bool IsGrounded()
         {
             return Physics.CheckCapsule(col.bounds.center, new Vector3(col.bounds.center.x, col.bounds.min.y, col.bounds.center.z), col.radius * .9f, groundLayers);
             
         }
     }
     





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

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by canslp · Jul 27, 2020 at 12:30 PM

your instinct to make a bunch of rigidbodys with joints is probably the way to go, seems like there's just some kind of organizational hangup. you could also try having raycasts apply force if they detect a surface nearby, like car tire suspension style

Comment
Add comment · Show 1 · 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
avatar image meozdemir90 · Jul 28, 2020 at 12:07 AM 0
Share

How i could solve the movement script to work with though? I achived the jiggly behaviour but the movement no...

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

246 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 avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image 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 do I model a piston? 0 Answers

Spring Joint Grappling Hook help please 0 Answers

Unity 3D Balloons tied together (Physics) 0 Answers

Trying to simulate a "Slime" like soft body ball. 0 Answers

How can I use a Spring Joint to pull two objects together? 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