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 /
  • Help Room /
avatar image
0
Question by legendarytaco32 · Apr 28, 2017 at 05:48 AM · not workingfalseiskinematic

IsKinematic = false doesnt work.

I am trying to make my own Pickup and Drop system. When I pick the object up, I set isKinematic = true, and when i drop it i turn iskinematic = false. Yet every time i try to drop the object, it doesn't fall. it just floats in the air and does nothing. The weird thing is if i delete the object and make a new one it works, but all of the other objects decide not to.

lets say i have a cube and cylinder. I will pickup and drop the cube no problem, but the cylinder work drop it just floats when i drop it. Yet if i delete the cylinder from the Hierarchy and put it back in, the cylinder will drop to the ground but now the cube wont. It makes no sense to me and is really confusing.

Every script is the same. I just switch around the object name like Stick, Block, etc... And i put the scripts the correlating object. Also I've tried Rigidybody.wakeup() but it doesnt work either.

Here is my code:

public class stickPickup : MonoBehaviour {

     public Transform itemPosition;
 float StickDistance;
 public GameObject Stick;

 // Use this for initialization
 void Start () {
     Stick = GameObject.FindWithTag ("Stick");
 }
 
 // Update is called once per frame
 void Update () {
     StickDistance = Vector3.Distance (Stick.transform.position, itemPosition.transform.position);

     if (StickDistance <= 2)
         if (Input.GetKeyDown (KeyCode.E))
             if (GameObject.Find ("Player").GetComponent<FpsController> ().canHold == true)
                 StickPickup ();
     if (GameObject.Find ("Player").GetComponent<FpsController> ().canHold == false) 
         if (Stick) 
             if (Input.GetMouseButtonDown(1)) 
                 StickDrop ();
 }
 void StickDrop () {
     itemPosition.transform.DetachChildren();
     Stick.transform.position = Stick.transform.position;
     Stick.GetComponent<Rigidbody> ().isKinematic = false;
     GameObject.Find ("Player").GetComponent<FpsController> ().canHold = true;
 }

 void StickPickup () {
     Stick.transform.SetParent (itemPosition);
     Stick.transform.position = itemPosition.transform.position;
     Stick.transform.localRotation = itemPosition.transform.localRotation;
     Stick.GetComponent<Rigidbody> ().isKinematic = true;
     GameObject.Find ("Player").GetComponent<FpsController> ().canHold = false;
 }

I know i could probably make the script better but im just a beginner. any help would be really appreciated.

Comment
Add comment · Show 2
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 Owen-Reynolds · Apr 28, 2017 at 02:15 PM 0
Share

Wakeup is usually the problem. You may have just done it wrong. When you try something, it's common to leave it in the code, but commented-out. That makes a record.

Giving it a little push up might also work, so it pops out of your hands (pushes also wake things up.)

Try testing more. Spin around to be sure the object isn't still tracking you. Bump into it. Drop a cube on it to see if it will fall. Usually something it does will give a hint as to the problem (if dropping something on it makes it more, it was a wake-up problem.)

avatar image sisse008 · Jan 08, 2018 at 08:57 AM 0
Share

https://answers.unity.com/questions/196287/rigidbodyiskinematic-false-does-not-work.html

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by hawkigamer · Dec 12, 2017 at 04:07 AM

Hmmmm.... i dont know why your not just using gravity instead of kinematic and unless you have a certain reason not to be instantiating and deleting you would be better of instantiating a pickup object deleting the one your holding... but personal opinion, try gravity and messing with the order of execution. (-: hope this helps

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

103 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

Related Questions

script enable=false 3 Answers

gameobject doesn't spawn in the assigned random positions? 2 Answers

Unity3D not Opening Help!! 1 Answer

Any idea why this is throwing a NullReferenceException ? 2 Answers

Access my scripts/assets from inside StandardAsset ThirdPersonuserControl.cs 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