Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
80 views
in Technique[技术] by (71.8m points)

c# - How to make the game object unthorough able?

I was looking for most of the threads that have the similar question as mine, but still cant seem to solve my issue. I'm working on a game, that in the ends when u finish the tasks, a gate should open up and after u walk thought it you're up to the next level. - got the gate, got the animation working when the goal is complete. but for some reason my player can go through the gate even though both player and gate have Box collider + Rigid Body. (I'll put here the pic) I think I know is because the player is trigger so that what makes the player go through. but is there a code? or another way to make that gate solid? as long until it opens and then the player can go through.(I know that what makes it happened is because the player isTrigger, I need it to be trigger so other function will work as they should be, but still there is other ways to make it work?)

Gate Inspector(Left Door for now)

Player Inspector

Thank you soo much for the help

question from:https://stackoverflow.com/questions/65860607/how-to-make-the-game-object-unthorough-able

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

It is possible to have more than one collider added if you want that. isTrigger will always allow things to pass through, it's a trigger zone when you enable that boolean, that means it doesn't block objects by colliding with them.

So if you want both an "isTrigger" and a normal collider you would need to use 2 colliders on the object in question. Or on both if you want it on both.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...