• 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 Koen Van den Steen · Apr 15, 2015 at 12:52 PM · physx

How to add a force correctly to a sphere in a physic game

hi guys,

I am making a physic game like Hamsterball, and I'm trying to add in some ramps and loopings. but before them to work I need to ad a big force so the ball gets accelerated allot. First toughed was just adding a force to it and it should work, well it works but it gives allot of strange side effects which should not happen?

the sphere I am using is a normal sphere with a normal sphere collider. And I am using a torque to move it around.

     void OnTriggerEnter(Collider other){
         if (other.tag == "Player")
         {
             other.transform.GetComponent<Rigidbody>().rotation = Quaternion.Euler(new Vector3(0, 0, 0));
             other.transform.GetComponent<Rigidbody>().velocity = new Vector3();
             Debug.Log("transform.forward: " + transform.forward + " total: " + (transform.forward * SpeedUpPower));
             other.transform.GetComponent<Rigidbody>().AddTorque(transform.forward * SpeedUpPower, ForceMode.Impulse);
             other.transform.GetComponent<Rigidbody>().AddForce(transform.forward * SpeedUpPower, ForceMode.Impulse);
         }
     }

this is what I got now, but the strange behavior are the following points:

  • sometimes the ball just bounces to a complete random direction

  • sometimes the ball hits the level instantly and slows down completely so it just gets stuck into the level mesh

  • the forces are sometimes much more or much less depending on how I approach my ramp

this are the things I tried already: changing the physx materials to no friction changing the forcemodes * changing the speedup to go slightly in the air so it does not bounce in the level, but it can still bounce to random directions

I did allot more random stuff, but I am just to inexperienced with physx games to pinpoint my issue here so any help would really be appreciated!!

also some print screens of the things I would like to do:

ramp looping

problem.png (155.4 kB)
problem2.png (221.1 kB)
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 Koen Van den Steen · Apr 16, 2015 at 11:02 AM 0
Share

still trying to find a solution for this..

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.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

2 People are following this question.

avatar image avatar image

Related Questions

Can physx do hair physx like in the WWE 2010? 1 Answer

Dynamic animation and physics 0 Answers

Is there a Distance Constraint 3D or Distance Joint 3D in Unity? 2 Answers

multithreading physX 1 Answer

PhysX on ATI Cards 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