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 zKici · Feb 13, 2014 at 01:21 AM · texturecolliderterraincolider

Creating Box Collider On Specific Terrain Textures

Hello,

I know how to get the information of which textures etc are in the Terrain, however for my game purposes I am trying to figure out how to create a box collider for where there is "dirt" for example as a texture as long as there is dirt I do not want to allow my character to move towards it, therefore need to create a collider about 10 units long in Y where the "dirt" texture exists... Any ways of getting this done effectively ?

In the meanwhile I will be brainstorming as well.

Thanks a lot

EDIT: This will be a phone game, therefore I'm not sure raycast is the best way, perhaps a box collider of where the character is and reads the texture its on?

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
Best Answer

Answer by whydoidoit · Feb 13, 2014 at 01:24 AM

I'd suggest using a raycast in the direction of movement and then work out what is on the terrain in that direction by using the RaycastHit textureCoord to get access to the splat map at the location intersected. You would then look to see how much of the "dirt channel" was present to limit movement.

Comment
Add comment · Show 3 · 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 zKici · Feb 13, 2014 at 06:15 PM 0
Share

Thanks for the answer, however I'm not sure that will work with a raycast - this is for a phone game

avatar image whydoidoit · Feb 14, 2014 at 04:15 AM 0
Share

Why would a raycast not work on a phone? If your talking about performance, one raycast is nothing. Even if you needed 3 or 4, still nothing to be worried about.

It would end up being much faster than all of the colliders you would create to cover the different areas that had your dirt.

avatar image zKici · Feb 14, 2014 at 10:00 PM 0
Share

So how do i go on about creating a raycast shooting out of a "cube" placed in front of my character, checking about 0.2 meters ahead of where he'll be stepping, to find out what texture is co$$anonymous$$g up, and if its "dirt" to prevent him from moving forward...??

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

19 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

Related Questions

Create Terrain in other Software 1 Answer

Specific Texture collision 1 Answer

Disabling colliders in Terrain Trees? 1 Answer

How can I delete grass texture from Terrain 2 Answers

Paint terrain texture with scripting 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