Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • 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
1
Question by JDB-Artist · Apr 23, 2012 at 10:47 AM · collisiongravityspeed

How to maintain collision while moving the player?

Well it's a basic problem: When moving a platform (Player is grounded on it) the camera first starts shaking and then when the speed is raised (platform moves vertically up and down with raising speed) the player simply falls trough the platform following the rules of gravity.

Question is: How can I prevent that from happening?

Comment
Add comment · Show 6
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 Kleptomaniac · Apr 23, 2012 at 10:56 AM 0
Share

Hmm, is your platform a plane? I read somewhere (can't find the link unfortunately) that physics doesn't really work very well on plane colliders because the collision sampling intervals won't actually detect the plane colliders and completely bypass it ... or something like that. Can't really remember ...

$$anonymous$$y basic question is: are you using a plane for your platform? If so, try using a very thin cube for your platform and see if that helps in any way.

avatar image JDB-Artist · Apr 23, 2012 at 11:16 AM 0
Share

Thanks for your hint, I am using a thick cube as my moving platform. Nevertheless the player falls through it whenever the cube moves faster than a certain rate (like 5-10 units per second).

avatar image aldonaletto · Apr 23, 2012 at 11:21 AM 0
Share

Is the character a CharacterController?

avatar image JDB-Artist · Apr 23, 2012 at 11:23 AM 0
Share

Yes, it is. Should I change the inbuilt settings?

avatar image venkspower · Apr 23, 2012 at 11:40 AM 0
Share

Why are you moving the platform? I am not getting this question. Can you please elucidate?

Show more comments

2 Replies

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

Answer by venkspower · Apr 23, 2012 at 12:05 PM

Alright. Make the Platform (or Plane, or whatever you have given) as the parent for the Character Controller like

CharacterController.transform.parent = Platform.transform

And do the animation for the Platform gameObject. I think, that would make it right.

Comment
Add comment · Show 2 · 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 venkspower · Apr 23, 2012 at 12:24 PM 0
Share

And apply the colliders to the Platform gameObject, if you haven't!

avatar image JDB-Artist · Apr 23, 2012 at 12:40 PM 0
Share

Thanks that solved it!

avatar image
0

Answer by aldonaletto · Apr 23, 2012 at 11:34 AM

This is a recurrent problem with the CharacterController: I suspect it only checks collision when Move or SimpleMove are used; if you don't move the character with these instructions while the platform is moving, the character can miss the movement and simply find himself a little below the platform surface, what makes him fall. A dirty hack usually solves this problem: slightly move the character horizontally each Update - something like this:

 function Update(){
   GetComponent(CharacterController).Move(Vector3.forward * 0.01 * Time.deltaTime);
 }

You can add this code to an existing character script, or create a new one.

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 JDB-Artist · Apr 23, 2012 at 11:49 AM 0
Share

Thanks for your help! I tried your solution, unfortunately the problem still exists... $$anonymous$$aybe I should lock the players movement and move the character controller itself once it collides with the platform?

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.

Follow this Question

Answers Answers and Comments

6 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Gravitational pull without losing speed 1 Answer

2D - no gravity when player jumps against wall? 2 Answers

how to reduce the speed of bike when collide with side walls. 1 Answer

Fast bullet ignor collision sometimes 3 Answers

Precise Collision Detection 0 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