Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
2 captures
12 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 Sankacoffee · Dec 04, 2016 at 12:12 AM · collisionphysicsrigidbodykinematic

Rigidbody is colliding terrain on isKinematic = false. call although meshes don't touch

Hello everyone,

So, I take a unity treeinstance, I delete it, clone an inactive prefab below terrain, move it to tree position and deactivate isKinematic to make it fall/break, this is my code, called from FixedUpdate:

     //tree
     GameObject treeBrokenInstance= GameObject.Instantiate(treeBroken);
     treeBrokenInstance.transform.parent = null;
     Vector3 newPosition = new Vector3();
     Terrain ter = Terrain.activeTerrain;
     Vector3 terPosition = ter.transform.position;
     Vector3 treePosition = tree.position;

     newPosition = (Vector3.Scale(ter.terrainData.size, treePosition) + terPosition);
     newPosition.y += 10f;
     
     treeBrokenInstance.transform.position = newPosition;
     treeBrokenInstance.transform.localScale = new Vector3(1, 1, 1);
     treeBrokenInstance.SetActive(true);

     treeBrokenInstance.GetComponent<Rigidbody>().velocity = Vector3.zero;
     treeBrokenInstance.GetComponent<Rigidbody>().angularVelocity = Vector3.zero;
     treeBrokenInstance.GetComponent<Rigidbody>().isKinematic = false;
     treeBrokenInstance.GetComponent<Rigidbody>().detectCollisions = true;

As soon as I call

     treeBrokenInstance.GetComponent<Rigidbody>().isKinematic = false;
     treeBrokenInstance.GetComponent<Rigidbody>().detectCollisions = true;

my cloned prefab recieves terrain collision events and fly's away, although I put it a lot above terrain.

I thought that maybe the object receives the collision events since it goes from inactive under terrain to active over terrain in one frametime. So i tried delaying call to these two lines by 5 seconds, so that frame physics is long resolved, but collision with terrain still triggers.

I must be misunderstanding something but I can't figure out what.

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

132 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

Related Questions

how to prevent a kinematic rigidbody from going through static colliders 0 Answers

[SOLVED] Ball rolling around a planet bounces off? 2 Answers

[3d]Rigidbodies are not working as expected with animations, They are not stopping on colliding, Am I doing anything wrong? 0 Answers

Car made from Different GameObjects and Empty GameObjects breaks on Collision with Terrain. 0 Answers

Different physics behaviour with identical setup? 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