Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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
1
Question by Marnix · Sep 19, 2011 at 07:15 PM · physicsfriction

Frictionless physics

We are trying to create an educational game that only has very basic physics. Friction should be rejected. But somehow, objects still slow down when we put them in a half-pipe of planes.

Also, colliding two objects against one another will stop them both. As in: they absorb all energy, instead of bouncing back.

This are both two phenomenons that I cannot think of with my basic physics knowledge.

So my general question is: How do I make a physics system with the rigid bodies in unity that will keep all energy during collisions, instead of stopping the objects?

EDIT:
It seems that what I'm doing with the physics is not exactly how it works in physics. The problem is: I try to let my ball roll from a slope. The sharp angle that is made with the ground makes the ball lose energy. This is actually quite logical.

So I'm actually looking for a way to keep all energy in the ball when colliding against a wall.

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 syclamoth · Sep 19, 2011 at 10:49 PM 0
Share

I should warn you that Unity's physics engine is hardly what I would call 'educational'!

3 Replies

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by jtbentley · Oct 11, 2011 at 12:46 AM

As well as making the physics material and setting the bouncyness to a high value (1 will do crazy things), you need to remove drag from the equation, as this will make everything slow down. This is done on the rigidbody itself, not on the physic material.

Angular drag might also need to be tweaked, but if you don't (especially in a half pipe) have any, it might go absolute beserk after a few trips around the pipe :)

Comment
Add comment · Show 4 · 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 Marnix · Oct 11, 2011 at 08:02 AM 0
Share

Yes I did that, but it's not what I'm looking for. I already made a frictionless material, but it doesn't fix my problem. See updated question.

avatar image jtbentley · Oct 11, 2011 at 11:17 PM 1
Share

Based on your edited question, sounds to me like you'll be forcing a velocity onto the ball with script, since it's not likely going to behave how you want it to otherwise.

avatar image Marnix · Oct 13, 2011 at 09:43 AM 0
Share

Your comment is actually the correct answer. I created a script that maintains the speed of the object by adding some force in the direction of the tangent of my hill. It works perfect and contains a lot of cross-products, but it does do as I want. There is no energy lost when colliding anymore.

avatar image jackson31 · Mar 23, 2014 at 03:41 AM 0
Share

^ $$anonymous$$arnix, would you share your code with me? I am trying to achieve the same type of physics, but I don't know where to start with program$$anonymous$$g this scrape/drag nullifying script

avatar image
0

Answer by Ludiares.du · Sep 19, 2011 at 07:31 PM

Create a physics material, set its friction to 0 and its bouncyness to 1

Comment
Add comment · Show 3 · 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 Marnix · Sep 19, 2011 at 07:36 PM 0
Share

The bounciness is a bit scary. A bouncing object will obtain a greater height as where it has been dropped during a couple of bounces.

avatar image Jason B · Sep 19, 2011 at 10:53 PM 0
Share

Write a script to lock the speed of a moving rigidbody to a maximum value.

avatar image syclamoth · Sep 19, 2011 at 11:15 PM 0
Share

What, and make the physics even weirder?

avatar image
0

Answer by Enniwhere · Jul 14, 2014 at 11:02 AM

I had the exact same problem, and I've found a somewhat simple way of guaranteeing the required behavior. I know it's an old post, but someone might get the same problem at some point. I figured, that what I really needed was energy conservation, since my ball lost energy in each collision. So what I did was use that fact that height, mass and other physical variables were already given courtesy of the fantastic physics engine, and I calculated my ball's total and potential energy at the start, and set the kinetic energy as required. The following short script seems to guarantee energy conservation.

 public class EnergyConservationMovement : MonoBehaviour {
 
     public Transform cannon;
     private float speed;
     private float totalEnergy;
     private float potentialEnergy;
     private float kineticEnergy;
     // Use this for initialization
     void Start () {
         speed = cannon.GetComponent<Cannon> ().velocity;
         potentialEnergy = rigidbody.mass * 9.82f * transform.position.y;
         kineticEnergy = 0.5f * rigidbody.mass * Mathf.Pow (speed, 2);
         totalEnergy = potentialEnergy + kineticEnergy;
     }
     
     // Update is called once per frame
     void Update () {
         potentialEnergy = rigidbody.mass * 9.82f * transform.position.y;
         kineticEnergy = totalEnergy - potentialEnergy;
         speed = Mathf.Sqrt (kineticEnergy * 2 * rigidbody.mass);
         rigidbody.velocity = rigidbody.velocity.normalized * speed; 
     }
 }

The cannon is the thing firing my ball, so just replace it with some other source of velocity or simply 0, if you want to start out with no speed.

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

9 People are following this question.

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

Related Questions

Angular Friction 0 Answers

How to make moving objects stack, without sliding over each other? 0 Answers

Calculating required force for pushing a body to a desired position at once 0 Answers

What is the appropriate value of Friction Direction 2? 1 Answer

How can I change friction of a Physic material in script? 1 Answer


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