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 charnew · Jan 07, 2012 at 02:36 AM · collidersmesh collider

click a gameobject with a mesh collider

I imported a model from Maya, ticked the Generate Colliders, added a mesh collider to it and attached the script onmousedown () {transform.position} and it's not working how should I do it?

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 syclamoth · Jan 07, 2012 at 02:56 AM 0
Share

What do you expect that script to do? I wouldn't expect it to do anything, for several reasons!

avatar image charnew · Jan 07, 2012 at 03:20 AM 0
Share

well sorry for not putting my whole code

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by snowconesolid · Jan 07, 2012 at 03:17 AM

I think you have to be more specific with the position, where do you want to move it to?

you have to do something like this:

transform.position = Vector3(0,0,0);

the 0s = x,y,z

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 charnew · Jan 07, 2012 at 03:21 AM 0
Share

i did that but when i clicked, the object did not move

avatar image
0

Answer by Lo0NuhtiK · Jan 07, 2012 at 08:57 AM

well sorry for not putting my whole code
-- charnew


Maybe you should post more of your code then, rather than having everyone try to guess whats wrong when they have no idea what your script looks like.
Can you point to an exact location specified by another person on a map, if the map they hand you is a blank sheet of paper?
Maybe it's not even your script that is the problem, which could be determined if we saw your script.

if your script doesn't look something similar to this (UnityScript since I don't know what you're using) ->

 function OnMouseDown(){
    transform.position = someVector3 ;
 }

then your code is screwy....
if your code isn't screwy, then maybe the game object you attached the script to is a parent game object of objects with the mesh colliders, and the parent has no collider. Check to see. If that's the case, then clicking on it won't do anything. Move the script onto the child with the collider, then click that and see if it moves. Add a Debug.Log to your mousedown function to see if your click is being detected, then if it doesn't move but you do get the debugger, then your movement is messed up somewhere.
If you want the parent object to be the one you click to move the whole family of objects, then attach a primitive collider to it (sphere,box,capsule,etc) , put the script back on that parent object, then click it to test again.

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 charnew · Jan 08, 2012 at 05:18 AM 0
Share

i find out that the mesh colliders are automatically in the child of the parent, how am I going to mention those gameobjects to my script for later? I'm making a calculator just for you to know where my questions are leading.

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

7 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How to add mesh collider into terrain-trees? 1 Answer

Mesh collider falling through floor. Cannot troubleshoot! 0 Answers

physics.OverlapSphere colliders 1 Answer

Can't go into building because of collider around it 1 Answer

Mesh Collider falling through Box Colliders 2 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