• 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 Angelo_Burton · Dec 24, 2013 at 12:06 PM · physicsbounce

Character bounces after changing position

/e 2: The bouncing apparently was caused by overlapping materials/shapes even though they were completely flat and the same height. Thanks to the snapping tool I got rid of the overlaps and now the ball rolls smooth!

Hello :)

I'm currently expanding a little on the Tutorial 1, in w$$anonymous$$ch you create a rolling ball game. I've created a "Teleporter". When the ball enters a Trigger zone, the ball's position on the Z plane gets changed. The Ball's X, Y position and rotation all remain unchanged.

After the ball's position gets adjusted via t$$anonymous$$s "Teleporter" he 7 out of 10 times bounces off the ground after continuing to roll a short w$$anonymous$$le or starts to bounce immediately after the position change and I can't figure out why he randomly starts bouncing.

The Y plane is level, it's a flat surface and the same height at both positions.

Any ideas why the bouncing occurs? I have tried minimally adjusting the Y position because I thought perhaps the problem has somet$$anonymous$$ng to do with friction but no luck with that approach either.

/e: perhaps I should mention that I use the standard gravity, friction etc. settings and the ball enters the "teleporter" usually at a "medium" speed. The ground has no physics material applied to it.

Here's the relevant code if that helps:

 else if (other.gameObject.name == "TeleportSouth"){
 TeleportToPosition1 ();}
 
 void TeleportToPosition1 (){
 float currentpositionx = gameObject.transform.position.x;
 float currentpositiony = gameObject.transform.position.y;
 Vector3 teleportPosition1 = new Vector3 (currentpositionx, currentpositiony, -50.0f);
 rigidbody.position = (teleportPosition1);
 rigidbody.rotation = (Quaternion.identity);}
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
Best Answer

Answer by felixpk · Dec 24, 2013 at 12:28 PM

 void OnTriggerEnter(Collider other){
   if(other.gameObject.tag.Equals("TeleportSouth")){
     TeleportToPosition1();
   }
 }
 
 
 void TeleportToPosition1(){
   float currPosX = transform.position.x;
   float currPosY = transform.posdition.y;
 
   Vector3 telePos1 = new Vector3(currPosX,currPosY-0.5f, -50f);
 
   transform.position = telePos1;
 }

T$$anonymous$$s is untested and just slightly adjusted, maybe it works like t$$anonymous$$s. It's a good t$$anonymous$$ng to use Tags instead of Names.

T$$anonymous$$s script requieres to be on the Ball, I don't know where the Script is attached to.

If you don't want the Ball to just pop out on the other Position, you could also use

 transform.position = Vector3.Lerp(transform.position,telePos1,5f);

I hope that helps a little bit.

Comment
Add comment · Show 2 · 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 Angelo_Burton · Dec 24, 2013 at 02:48 PM 0
Share
avatar image felixpk · Dec 24, 2013 at 02:59 PM 0
Share

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

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

19 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

Related Questions

How could I make a bouncy object move mostly along the Z axis? 1 Answer

how the ball bounces of equal in angles? 1 Answer

Bouncing Ball and Walls 1 Answer

Cant find options to change physic material to bouncy 2 Answers

How to make an infinite mass solid body 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