x


Player flies up into the air when walking

I have a character I'm using for the player, with a character controller and movement script attached. I also have an imported terrain model that the player is supposed to walk around on. But as soon as I press the up arrow key to move forward, my character gets launched into the air up to a certain height, and stays there. I've never had this problem before, and I've used these exact same scripts for the player in a different game and they worked fine. I even used the same character. I never had this problejm. The only thing that's different is the imported terrain model. I tried using rigidbodies, I made sure I was using gravity in both the rigidbodies AND the project physics, I tried a different movement script and I made sure there were no other colliders on my character except for the character controller. Nothing helps. Also, when my character shoots up into the air, she starts to fall back down but stops, and just floats there. If I keep moving, she starts to fall at certain points but goes back up to the same height. And everywhere I go, wherever the terrain slopes upward, my character does too, meaning she always stays at the same height above the ground. Even when I walk into the wall of a bulding, she flies up even further and stays above the roof at the same height she was from the ground. It's almost like there's an invisible layer covering the entire terrain, and everytime I move I just pop up to the top of it. Can someone please help me figure out what's causing this? Is there something I'm not checking?

more ▼

asked Apr 27 '12 at 01:53 AM

TheGoliath gravatar image

TheGoliath
5 5 6 7

@TheGoliath Is there a mesh collider on the imported terrain model. This sounds like what would happen if the mesh collider is set to convex.

Apr 27 '12 at 05:29 AM hijinxbassist

a script would help.

Apr 27 '12 at 06:10 AM GC1983

No, I haven't applied any kind of collider, except for just checking "Generate Colliders" in the inspector. But when I don't do that, my character just falls through the floor. And honestly, what script would I post? The movement script I'm using has never given me any problems before, and I already tried a completely different one. The same exact thing happened.

Apr 29 '12 at 08:40 PM TheGoliath

I was asking to see your movement script. Have you just tried using the character controller movement call? Or is that what youre using? It calls GetAxis which then you manipulate the speed upon the framerates. All you need is that, make sure you have your CC attached to your char and the terrain has a mesh collider to make the CC respond. Thats it. I literrally just did this to a project i made and all works great. If you already knew this, excuse me for preaching to the choir. =)

Apr 29 '12 at 08:59 PM GC1983
(comments are locked)
10|3000 characters needed characters left

2 answers: sort voted first

is your character controller properly sized to your character? Try hitting play, then pause, and see if it stays properly lined up with the character. Otherwise, it may be a problem with the export from 3ds or whatever you're using, in which case make sure the character is at the zero position when you export, just a guess.. If you think the terrain might be the issue, replace it with a big box or something and see if that fixes it, in which case it may indeed be the mesh collider.

more ▼

answered Apr 30 '12 at 04:16 AM

Seth Bergman gravatar image

Seth Bergman
7k 10 16 28

(comments are locked)
10|3000 characters needed characters left

I finally figured it out. My terrain was TINY when I imported it, so I sized my character down to match it. It turns out that was the problem. I made everything a lot bigger and now my character stays on the ground. I still appreciate you guys trying to help though, thank you.

more ▼

answered Apr 30 '12 at 04:09 PM

TheGoliath gravatar image

TheGoliath
5 5 6 7

Do you think the problem came due to when shrinking the character you also moved its reference to the terrain?

Apr 30 '12 at 05:52 PM WeBeSmartRocks

Honestly I have no idea. I'm still a bit new to this.

May 01 '12 at 08:06 PM TheGoliath
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

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

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x1948
x1081
x481
x401
x185

asked: Apr 27 '12 at 01:53 AM

Seen: 893 times

Last Updated: May 01 '12 at 08:06 PM