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 markTheDesigner · Mar 01, 2013 at 03:42 PM · gravityaddforceaddforce movement

Smooth movement along an uneven surface

Hi,

I'm experimenting with moving a round object along various curved surfaces (circles and bends, etc). I'm using the method of raycasting to get the surface normal and then inverting it and using that as either a downward force or setting gravity in that direction (after normalizing/multiplying the vector). Both work ok but since I'm using polygons, the round object kind of bumps along the surface (see picture).

Using gravity I got smoother results but I was wondering if there were any other solutions apart from maybe a smoother collision mesh?

Here's some pictures using the trail renderer to show the bumps.

With Force alt text

With Gravity alt text

screen shot 2013-03-01 at 14.10.47.png (12.7 kB)
screen shot 2013-03-01 at 14.38.39.png (9.1 kB)
Comment
Add comment · Show 2
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 Tarlius · Mar 01, 2013 at 04:13 PM 0
Share

Could you not just get a vector that points to the centre of your "planet" and apply a "gravity" force towards it? (ie: via AddForce, as opposed to changing gravity, or is that what you are doing?)

Did you consider a sphere collider?

avatar image Tarlius · Mar 02, 2013 at 05:19 AM 0
Share

When you use the sphere, does your "planet" have a mesh collider too? It could be that the bumpiness is caused by the planet's collider poking through in places.

A sphere collider should be a perfect sphere since I assume it works by distance vectors (to be fast) as opposed to a bumpy mesh. Perhaps if you made the sphere very slightly bigger than the planet it would fix it? I'm not sure of the nature of your game, of course, so that might not be appropriate.

As for the L-shapes... Hmmm... Have to think about that :/

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by markTheDesigner · Mar 01, 2013 at 04:35 PM

Hi, yes that possible (and I'll try that for the completely round platforms) but some platforms are L shaped (like a pipe curving upwards) so their centre will be in an odd place. So that won't work for that.

Yup, I'm using a sphere collider but even that is not perfectly round (at least it's not visibly perfectly round in Unity). I zoomed in to see why the bumps were happening and the sphere actually goes though the surface of the 'planet' just a little bit after each face. I've fiddled with the physics properties but nothing makes it any better. I guess what happens is that after each peak (the angle difference between each face) the sphere realigns, via the normals calculation and then pushes back into the 'planet'. Maybe if I play around with the strength of gravity it won't be so obvious. The Sphere (moving object) is 1m size btw, if it makes any difference.

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
avatar image
0

Answer by lekk8282 · Oct 31, 2014 at 01:57 PM

http://www.41post.com/4123/programming/unity-normal-walker

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

11 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

Related Questions

Very simple water bouyancy script not working? 1 Answer

Change rigidbody's jumping speed 2 Answers

How do i make the Impulse i give to my Player not be lowered by acceleration of gravity? 1 Answer

Keep current force applied based on Vector3.forward? 1 Answer

Applying force to my object has no effect. 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