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
0
Question by greenshadow · Jan 04, 2014 at 09:15 PM · collisioncharactercontrollerlerpmoving platform

Character Controller and moving/lerping object collisions

Seems simple enough. In this scenario, there are several moving platforms that lerp back and forth.

When one of these platforms hits the player (character controller), it should push the player along with it, instead of moving through the player.

The problem is that if the player isn't moving (is standing still), OnControllerColliderHit is never called. Attaching Rigidbodies to the moving objects does not call OnCollisionEnter properly in this circumstance either.

Currently, I am working around the issue by raycasting to the right and the left every frame. If there is a hit and the hit object is moving, the player will make itself a child of the moving object - giving the illusion that the player is being pushed.

This works fine, but when I want the player to run faster, the effect is hit or miss. Aside from that, the constant raycasting is a bit messy and feels somewhat hacky.

Is there a cleaner, more efficient, more reliable way of determining collisions between a Character Controller and a moving/lerping object?

Comment
Add comment · Show 3
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 BigRoy · Jan 04, 2014 at 09:58 PM 0
Share
  1. Did you try OnCollisionEnter on the platform or the character? I'm pretty new to Unity, but I think both should work.

  2. Are the moving objects set as kinematic? (Shouldn't be the biggest issue, but might help.)

  3. You can try setting the RigidBodies check from discrete to continuous if it's missing the object in-between frames. Though that is more computationally expensive.

avatar image greenshadow · Jan 04, 2014 at 10:57 PM 0
Share

Roy:

  1. I have tried OnCollisionEnter on both the platforms and on the character.

  2. I have added a RigidBody to the player, which also uses a Character Controller. is$$anonymous$$inematic is true for each.

  3. I have set the collision check to both continuous and dynamic continuous.

However, OnCollisionEnter is not getting called on either the player or the platform.

avatar image BigRoy · Jan 04, 2014 at 11:26 PM 0
Share

Its hard to tell what the problem is. Are you sure that the colliders are NOT set as trigger? See: http://forum.unity3d.com/threads/23126-Character-OnCollisionEnter And http://answers.unity3d.com/questions/210220/apparently-i-dont-understand-oncollisionenter.html

0 Replies

· Add your reply
  • Sort: 

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

19 People are following this question.

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

Related Questions

Any way to ignore collision between rigidbodies and colliders/character controllers? 1 Answer

Character Controller meets Rigidbody 1 Answer

Problem with character controller and collisions 1 Answer

Collision CharacterController vs CharacterController 2 Answers

NPCs fall through hills in terrain 1 Answer


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