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
0
Question by PiLigand · Oct 12, 2015 at 07:38 AM · crashtransform.positionhangfixedjoint

Adding FixedJoints causing crashes and hangs

I am encountering a series of errors when trying to attach fixed joints during runtime through a particular script. I have a little robot that moves by a grappling hook. The base of that hook (the arm) is attached to the robot through a couple joints. During gameplay, a button press instantiates and attaches another object - the grapnel head - to the arm and adds a velocity to the grapnel head. The same press will delete the grapnel. The head has a collider on it and this script:

 using UnityEngine;
 using System.Collections;
 
 public class Grab : MonoBehaviour {
 
 
 
     // Use this for initialization
     void Start () {
     }
     
     // Update is called once per frame
     void OnTriggerEnter(Collider other){
 
         gameObject.GetComponent<Rigidbody> ().velocity = Vector3.zero;
         FixedJoint sticky = gameObject.AddComponent<FixedJoint> ();
 
         if (other.gameObject.GetComponent<Rigidbody> () != null) {
             sticky.connectedBody = other.gameObject.GetComponent<Rigidbody>();
         }
 
         gameObject.GetComponent<Collider>().enabled = false;
     }
 
 }
 

This script is triggered when the grapnel encounters something, creates a fixed joint on the grapnel, and then does one of two things: nothing and allows the fixed joint to remain attached to the world, or attaches the grapnel to whatever rigidbody it encountered if the collider it hit had an associated rigidbody.

This works about 7/10 times. 1/10 times Unity straight crashes. 2/10 times Unity hangs and I get these errors: alt text

All five of these objects are children of the whole player. One player contains three meshed objects and two empty ones used as anchors and joints. The only one that ever has its transform hard set is GrabbleHead_Red(Clone) when its position is set to the same point as the robot's arm. It also seems that the head occasionally passes through a collider too far before realizing and stopping. This seems more likely to cause a crash or hang.

I'm inclined to believe that the script shown is the cause for the following reason: Everything functions fine without the script attached at all. Also, everything works fine when the script is attached and the body of the onTriggerEnter () function is commented out. The robot may fire the (albeit useless) grapple about without crashing. It's only when any FixedJoints are added that the crashes or hangs occur.

This also seems to be a recent development. The script hadn't changed at all over the past couple days, but only just today has there been any issue with the robot. Additionally, I removed all the changes that I have made since the problem started, and the problems persisted. If anyone/deity out there has any ideas on what hell this is, plz help.

Thanks!

Summary: -Error believed to be from Fixed Joints -Causing problems in transforms -Error object transforms never set with script

screen-shot-2015-10-11-at-32916-pm.png (32.7 kB)
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

Answer by PiLigand · Oct 12, 2015 at 03:36 PM

Hi All. Sorry to answer my own question. I did some more digging while waiting for moderation to go through. To be fair, I spent a couple hours searching beforehand too.

Unchecking "Enable Preprocessing" on the problematic joint solved this problem. I don't really understand why, but perhaps that will come with time. Regardless, Thanks to any and all that read this.

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

How can I make sure my app actually closes when I manually shut it down through iOS? 1 Answer

Why does this code hang the system?? 2 Answers

hangs up my android game! 1 Answer

Webplayer hangs on loading scene 2 Answers

Unity Debugging hangs 4 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