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 Josh 5 · Jun 15, 2010 at 04:41 AM · collisionphysicsiphonecharactercontrollervelocity

Removing velocity relative to the contact normal

Having an issue with a fast moving object going through the track; at the moment the track is detected using Raycasts and uses this information to position itself ontop of the track and oriented correctly (wipeout style game).

It's a classically case of object move increments being greater than the area being checked - I have moved the colliders higher which has helped a little. The problem is specific to hitting corners or tilted track segments.

The 2 solutions I have are:

1) Shoot rays from the bottom; if nothing is detected then shoot rays in the opposite direction (having performance issues at the moment so not wanting to go down this route).

2) Remove the velocity relative to the contact normal (or transfer that velocity to the facing direction or perpendicular to the track) - this is the approach I would like to take but not 100% sure how I can remove the this velocity. I have multiplied the -velocity by the normal and added this current velocity but this is (obvious that know what they're doing) not the right approach.

I noticed that the CharacterController's Move method is capable of 'sliding' the object along a collider - anyone know how the team at Unity would have implemented this?

Cheers

Comment
Add comment
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

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by Josh 5 · Jun 16, 2010 at 01:28 AM

This appears to have worked for me...

velocity -= Vector3.Project( velocity, trackContactNormal );

Where velocity is the (obviously) objects current velocity (done manually because I needed something similar to the CharacterController but specific to a vehicle of sorts) and trackContactNormal is the contact normal from the RaycastHit object.

Has stopped me falling through the track when moving at pace; it is possible to transfer this velocity to the forward direction but I have decided not too to save some processing time.

Comment
Add comment · 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

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

No one has followed this question yet.

Related Questions

Trying to avoid collision with sides and interiors of polygons 1 Answer

CharacterController collision disabled when modifying center 0 Answers

(Steam VR / Vive) Rigidbody moving in only one direction after collision 1 Answer

Double collision with Character Controller? 3 Answers

Voxel engine physics 3rd person character controller 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