- Home /
Moving 'platforms' not colliding with you
I got almost everything working with my character controller but I've hit a wall now.
The problem is, if a object moving in my direction (using built-in animation) and 'hits' me, it will go through me. but if i jump on it, i will collide normally.
Also, occasionally jumping on a rising platform causes me to fall through it
The character was mainly made by making a capsule and then Component->Character->FPS Input Controller. I modified the default character motor to make the jumping on walls thing, besides that i don't think i have made any other modification.
Anyone know what might be causing this or how to fix it? (if possible, without having to scrap the character motor)
Youtube video showing the issue (you might need to stop the video to be able to read the comments at the end): http://www.youtube.com/watch?v=G_zglbupI-E
Pastebin with the modified Character Motor class: http://pastebin.com/hfhDawgJ
So you are certain that the cube you were falling through (in the video) contained a box collider and you contained a capsule collider? If you do not contain these colliders in an object, this object may go directly through you. If both you and the cube have those colliders already (they probably would) try removing those components and replacing them again. $$anonymous$$aybe they contain some error. Also, make sure to check the green text in the error log. They might actually mean something. If you have tried everything that I just said and none of them worked, try removing the jump on wall script. It may have something to do with it.
I could not replace the character controller collider, but i re added the box collider on the platform, unhappily it did nothing.
What is this 'green text' in the error log? I've only saw black, red or yellow so far
Removing the wall jumping script caused the error to occur even when i go head on against the moving wall =/
From personal experience with box colliders, I've found them to be very unreliable. Even with slow moving objects I've found raycasting to be much better. If you can use raycasting to detect collisions I think you may be able to solve all your problems
Answer by ausiemick · Oct 07, 2012 at 08:56 PM
Too much code to read.. So I'm going to make guesses from what ive seen:
your move will work by changing a transform.. This is a bad idea as it will allow violation of the physics engine, to move a character (properly) in a physics engine you have to apply a force to it (lookup unity forces) apon applying a force through you w,a,s,d,space keys it hopefully shouldn't have any of the issues you described..
so yeah.. Use forces not transforms if physics is in use. Only use transform for things where you want to ignore physics
well, i am using the default character controller(and character motor), that does a '.$$anonymous$$ove' to move, that as far as i understood it's a modification on the transform checking if there was collision, and not moving if there was.
it seems everything is pointing to 'scrap all of what you did on character motor and make your own character controller using physics' =/
Haha, Only reason why I'm answering questions on this forum is because I asked one myself (and I feel bad if I don't put in 3x as much as I take out) I personally hate engines.. I like having full source access so If I use code I know fully 100% what it does... Too bad my assignment required me to use unity :P
But yeah.. Where ever theres a simple basic of a physics engine, as such as add force, you should always choose that as it's a basic engine feature so it's unlikely theres any code attached to it that will not act as intended.
Your answer
Follow this Question
Related Questions
A Character Controller with another shape. 0 Answers
colliding characters and meshes 0 Answers
Controller area of collision/contact 0 Answers
Not colliding with a box collider? 2 Answers