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
1
Question by jmgek · Jan 02, 2013 at 01:40 AM · how

How can you allow the player to use Vertex Snapping in order for them to build a vehicle.

I need some documentation on this. Even if you can show me a simple code by example I can figure this out. So far I have looked into mathf but I am stuck.

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 Bunny83 · Jan 02, 2013 at 01:55 AM 0
Share

Vertex snapping for the player? Do you have a mesh editor in your game or do you talk about the Unity editor? Can you be expand your description "a little bit" because it's not clear what you're doing here...

If you really want something like the vertex snapping function in the Unity editor in game, it's not that trivial since you have to find near geometry and search for the best fitting vertex, but first of all you need to be able to pick a target vertex.

avatar image jmgek · Jan 02, 2013 at 03:38 AM 0
Share

I am trying to get the user to make make their own vehicles. So they can place items anywhere they want onto the "body" of the car or plane. Think of something like 'lego racers' or gummy ships in $$anonymous$$ingdom hearts, for the PS2. I need to know how to get the items to attach to another item from a drag and drop input.

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by Vonni · Jan 04, 2013 at 10:09 PM

Could you maybe create custom "joints" which you could use to attach these parts together on?

If not, i recentrly did something similar myself.

  • used raycast to assign an object to a lastHoveredObject varible. -Then it stores all vertices of that objects mesh to an array I keep reseting as I get new targets.

  • also converted all the vertices in the array to screenposition and then iterated through them all to check if they were touching my invisible rectangle near my mouse, and chose the closest vertex and placed a GUITexture on it. -It then stored that worldposition (Vertex) as a Vector3 varible i used to place an element there.

Don't have the code I used here I'm afraid, but should get you started!

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
avatar image
0

Answer by DaveA · Jan 05, 2013 at 12:37 AM

I did this for a sorta Lego game. What I did was assign 'snap points' (empty game objects) as children of the object. Then a script converts the location of those snap points to world coords. As the mouse position (ray casted into the scene) is a minimum distance from any snap point, the dragged part snaps there. Use the snap point's transform and possibly a snap point on the dragged object to align the parts x,y,z, and have fun with the rotations lining up (a bit trickier but doable).

If you really just need the vertices on a mesh, then you can create an array of vertices and TransformPoint the mesh's verts into it to have a handy list of world-space points to look through.

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

12 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

Related Questions

how can i make an explosion 2 Answers

Rotating object towards mouse point 1 Answer

3D Grappling Hook? 0 Answers

Why is an Instance of Prefab not being Destroyed? 2 Answers

How do I save a three dimensional array? 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