- Home /
Unity Animation Causes Clipping
I am working on a 3d platformer / puzzle game. This game will involve massive ammounts of moving platforms. Some of which have tunnels just imagine a floating cube with an entrance from the side. An issue I have come across is that when these cubes are moving they can cause clipping.
A specific example of this is when you are standing on the divider line between two tunnel sections, and one starts to move. I am using the unity animation system to move the objects. It would be convenient if I could still use that to move the level as it would save a lot of headaches. I am curious if there is any way I can move objects in a direction UNTILL they hit another collider. At which point they either stop or send a message.
any solutions would be great. Animate physics is on so it pushes the objects when it touches them, but it will push them through the walls of other things.
Have a look at the Script Reference for OnCollisionEnter, also look at OnTriggerEnter. If this doesn't help, there is an entire Platformer tutorial that involves what you are doing, provided by Unity themselves. HERE
Irrelevant to question. I am asking about clipping and animation, not collision. A platformer tutorial such as lerpz does not even brush upon these topics.
So I take it you have gone through this tutorial and know everything about it. Then why are you asking this question? I think you should look at all the information I have provided and test it out before you try to label my answer irrelevant.
" I am curious if there is any way I can move objects in a direction UNTILL they hit another collider"
The lerpz tutorial is irrelevant, yes. It does not cover clipping: which is my issue. OnCollisionEnter on the enviroment can work, though the way it would have to be implemented would make things complicated:
OnEnter: change VAR1 on player to += 1; On exit: Change VAR1 on player -= 1; Simple enough there... if the objects had a single collider for each moving piece. and could set the event to happen when VAR1 reaches 2. However That creates problems of its own: It would be touching two colliders while crossing seems.
To counter this it would require many many tags on the level and a small library of comparisons between tags to see when it should proc and when it should not.
I am asking if there is a way to stop animation(because I do want to use animation if possible) when a collider blocks the objects path, at that point it would call the message. If there is no builtin function in the animation system, then how would I go about doing this.. considering the problems I have listed (and that the player will ALWAYS be touching one or two of these moving objects)?
Your answer
Follow this Question
Related Questions
How to animate collider along with object for 2D game? 1 Answer
Raycasting colliders moved by Mechanim animation? 0 Answers
Complex Animated mesh and Colliders 1 Answer
Physics colliders don't follow animation 0 Answers
Does unity take disabled colliders into account with the collider limit? 1 Answer