Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 CashewCraft · May 17, 2014 at 09:08 AM · rigidbodyparentboorigidbodies

OnCollisonEnter refrence not working

I am trying to make a game where a rolling ball picks up items with rigidbodies as a proof of concept, however I keep getting the error message: "'transform' is not a member of 'object'". I use boo for scripting so that might be the problem. The code:

import UnityEngine

class ParentOnCollide (MonoBehaviour):

 def Start ():
     pass
 
 def Update ():
     pass
 
 def OnCollisonEnter(NewCollide):
     NewCollide.transform.parent = gameObject.transform.parent

 def OnCollisonExit(NewCollide):
     NewCollide.transform.parent = gameObject.transform.parent.transform.parent
Comment
Add comment · Show 5
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 Noob_Vulcan · May 17, 2014 at 09:14 AM 0
Share

Change

 NewCollide.transform.parent

to

 NewCollide.gameObject.transform.parent


Its is giving the error because a transform is a member of gameObject ,not the object.

GameObject is subclass/derived of Object.

avatar image CashewCraft Noob_Vulcan · May 17, 2014 at 09:25 AM 0
Share

"'gameObject' is not a member of 'object'"

avatar image Noob_Vulcan Noob_Vulcan · May 17, 2014 at 09:32 AM 0
Share

try def OnCollisonEnter(NewCollide col): col.gameObject.transform.parent = gameObject.transform.parent

avatar image CashewCraft Noob_Vulcan · May 17, 2014 at 10:04 AM 0
Share

"Unexpected token: col."

Show more comments

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by meat5000 · May 17, 2014 at 10:55 AM

col in Noob_Vulcans comment should be replaced by the name of your Collision as defined in the function argument.

But in your code you have missed the Collision definition and the return type

 def OnCollisonEnter(NewCollide as Collision) as void:

I have noticed in JS that, even though you should be able to access the collision transform directly, sometimes it makes you go through the gameObject, just as Noob_Vulcan stated.

Look at this page:

Select Boo from the "Scripting Reference using" dropdown box.

Comment
Add comment · Show 1 · 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 CashewCraft · May 17, 2014 at 05:34 PM 0
Share

It's not returning any compiler errors now, but it doesn't appear to detect that it is colliding with any of the blocks and just rolls over them. I added a debug print on the functions and it doesn't return anything, so it must not be detecting collisions, any guesses as to why?

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

22 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

Related Questions

Why is my object tilting when moving? 2 Answers

AddForceAtPosition to Parent's rigidbody...C# 0 Answers

Child rigidbody clipping through walls. 2 Answers

Should i be able to add gameobjects as children to a parent with a rigidbody? 1 Answer

Apply force to a rigidbody based on the rotation of a child object. 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