• 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 thunderdragonca · Sep 06, 2011 at 08:29 PM · characterwalldetail

How to make a script which will let the character not enter the wall(solid)

How to write a script w$$anonymous$$ch let the character not enter the wall? Plz tell me details, caz i really have no idea after i saw some answers on internet.

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

3 Replies

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by msknapp · Sep 06, 2011 at 08:37 PM

My first instinct: the wall needs a mesh collider component.

If you have a reference to the game object for the wall in your script, try in C#

if (myGameObject.collider==null)
myGameObject.AddComponent<MeshCollider>();


Or from the editor you can just add the collider to the wall.

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 thunderdragonca · Sep 06, 2011 at 10:04 PM 0
Share

I tried add mesh collider to the wall, but my character can still go thru the wall. why?

avatar image msknapp · Sep 07, 2011 at 06:06 PM 0
Share

Just some guesses here:
are the colliders considered "active" and "enabled"? In the inspector view for you wall/character, make sure the collider has a check box on it.
Otherwise, there is probably something misconfigured with the script that controls your camera. Might want to read through that script to figure it out.

avatar image thunderdragonca · Sep 08, 2011 at 12:39 AM 0
Share

thx for u time tho.. I used another way to solve this problem.i used rigidbody.

avatar image
0

Answer by taddmencer · Sep 06, 2011 at 08:39 PM

Make sure your walls (objects) have colliders ($$anonymous$$ghlight character, components > Physics > Mesh [box, etc] Collider)are are set to static objects (select object, check upper right box in the Inspector saying 'static')

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 thunderdragonca · Sep 06, 2011 at 10:06 PM 0
Share

U want me add colliders to walls or character? I tried both but doesn't work

avatar image
0

Answer by xiangeeb · Sep 08, 2011 at 12:51 AM

╭⌒╮WELCOME ONLINE STORE :

▲ http://www.goodshopping100.com ▲ 

very good shopping web

The website wholesale for many kinds of fas$$anonymous$$on shoes,

like the nike,jordan,prada, also including the jeans,s$$anonymous$$rts,bags,hat and the decorations.

All the products are free s$$anonymous$$pping, and the the price is

competitive,

and also can accept the pyapal payment.

after the payment, can s$$anonymous$$p wit$$anonymous$$n short time.

watches price 75$

Air jordan(1-24)shoes $30

Nike shox(R4,NZ,OZ,TL1,TL2,TL3) $35

Hndbags(Coach lv fendi d&g) $35

┏☆━━━━━━━━━━━━━━━━━━━━━☆┓ website: http://www.goodshopping100.com ┗☆━━━━━━━━━━━━━━━━━━━━━☆┛

Ts$$anonymous$$rts (Polo ,ed hardy,lacoste) $16

Jean(True Religion,ed hardy,coogi) $30

Sunglasses(Oakey,coach,gucci,Armaini) $15

New era cap $10

Bikini (Ed hardy,polo) $25

we wii give you a big discount

FREE SHIPPING,accept paypal

lower price fast s$$anonymous$$ppment with $$anonymous$$gher quality

BEST QUALITY GUARANTEE!!

SAFTY & HONESTY GUARANTEE!!

FAST & PROMPT DELIVERY GUARANTEE!!

our moncler coat website: ★ http:// www.goodshopping100.com

★

Believe that you will fall in love with it

Opportunity knocks but once

Comment
Add comment · Show 4 · 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 msknapp · Sep 21, 2011 at 05:38 PM 0
Share

Can we delete this spam post?

avatar image taddmencer · Sep 21, 2011 at 06:03 PM 0
Share

But if we do - where woudl I get my discount shoes!?

avatar image thunderdragonca · Sep 23, 2011 at 03:16 AM 0
Share

don't think so

avatar image thunderdragonca · Sep 23, 2011 at 03:16 AM 0
Share

no buttons

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Platform moves when character steps on it 1 Answer

How to "Increase score with Y axis"? 1 Answer

My character jumps infinitely, even when in mid-air 1 Answer

how do I create a character 2 Answers

2D Character Flip 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