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 Hoeloe · Sep 03, 2013 at 02:40 PM · collideranimationcurvevector3.project

Parameterising one axis of collider - projecting extents not quite working.

So, I'm trying to create what is essentially a "bump map" for my ground colliders. Basically, instead of a complicated collider, I'm just using an AnimationCurve to specify "bumpiness", and offsetting my collisions based on that. This works, but my issue is in parameterising the collider such that I can read off a 0-1 float value depending on the position within the bounding box. Now, my code so far is this:

             Bounds b = collider.bounds;
             return bumpiness.Evaluate(MagnitudeAlongDirection((point - b.min), Vector3.Project(b.max-b.min, transform.forward)))-1;

MagnitudeAlongDirection is a custom-defined function that calculates the magnitude of a vector along a specific direction (for example, if the two vectors have the same magnitude, and the same direction, it returns 1, if one of them is facing backwards, and is half the magnitude, it would return -0.5, etc.)

My issue here is that the parameterisation doesn't seem to cover the entire collider. I've tried drawing a ray of the parameterisation, and this is what it looked like:

The white line shows the parameterisation

You can see from this that the white line stops short of both ends of the collider, where it should, I think, just overshoot both ends (since the collider is at an angle). Can anyone help me work out what is wrong here?

boundsextentsissue.png (160.2 kB)
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
Best Answer

Answer by Hoeloe · Sep 03, 2013 at 05:29 PM

I solved this with an alternative method. I created a custom editor with some sliders and handles that would allow me to position the end points of the parameterisation manually. This way, I can customise the "bump mapping" more accurately, and with an approximate to the curves drawn on the editor, I can position the map perfectly for what I need.

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

16 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

Related Questions

Internal collisions 1 Answer

How to Change the collider position while playing animation? 1 Answer

Randomly some prefab instances have Character controller misaligned 0 Answers

Combining two hit box (colliders) to become one 3 Answers

I want 3 gameObjects to take damage every 1 second while staying in a trigger: What I'm getting is each cube taking damage one at a time. Help? 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