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 Feref2 · Sep 28, 2020 at 11:27 PM · scalemathcurvesequationsimplify

How to simplify the equation of a moving vertex if its object is squeezed?

I originally had this equation: startPoint + direction * t;

Where t is a range float that goes from 0 to 1. The idea was to get a point defined by t between a start point and an end point. However, then I discovered that these lines were curves... so the whole thing became more and more complicated:

 void ShowCurveEquation()
 {
     float xVertex = originalVertex.x;//* 1
     float xVertex_T = originalVertex.x * frameMultX;//both are originalVertex.x * (1 + frameMultX * t)

     //1 is original scale. frameMultX is how much it changes to reach its end scale, in this case 1 since it goes from 1 to 2.

     Vector3 movementX = transform.right * xVertex;
     Vector3 movementX_T = transform.right * xVertex_T;//Get that relative to the object´s rotation.

     Vector3 movementY = transform.up * originalVertex.y;//y axis doesn´t change.

     //Now here is the problem. With Z is the same as X, but  dividing to get the curve: WE ARE WRITING ONLY THE FIRST PART and, once we know for sure the value of t, we do the rest to get the full number: 
     float incompleteMove_Z = transform.forward * originalVertex.z; // / (1 + frameMultX * t) 

     float curveEquation = transform.position + movementX + movementY;
     float curveEquation_T = movementX_T;

     //final equation = curveEquation + curveEquation_T * t + incompleteMove_Z / (1 + frameMultX * t);
 }

All of this is the movement of a vertex from its start position to its end. So basically I have an object that´s being squeezed, incresing its x scale and reducing ts z scale while keeping a constant area.

So I went from this: Vector3 + Vector3 t;
To this: Vector3 + Vector3
t + Vector3 / (1 + float * t);

It works; but because am doing a lot of dot products and other stuff with those equations, this becomes longer and longer and results in cubic, quatric and quintic equations sometimes (which involve a lot of hard calculations), so keeping this structure is not an option.

...My question is, is there a way of getting another equation with the same result, but skipping the division?

I know that (1 + frameMultX t) is the current scale on the x axis. And I know that 1 / (1 + frameMultX t) is the current scale on the z axis, because the scale area divided by the scale on one axis gives the scale on the other axis. But all of this leads to the same. I always end up dividing by a linear equation, which is what causes the problem.

I also tried applying the same principle on the other axis, which is 1 + frameMultZ itsRelativeT; itsRelativet is: (1 / (1 + frameMultX t) - 1) / frameMultZ; But as you can see, it has the same problem.

I was thinking of finding a way of getting this that doesn´t involve dividing the area by the opposite axis, but I can´t find a pattern. I know, for example, that if t = 0.5 , then the scale on x is 1.5 and z is 0.6666. Again, x goes from 1 to 2 and z from 1 to 0.5, so x has advanzed its half and z two thirds.

Thanks in advance.

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

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

147 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 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 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 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 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 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 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 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

Adjust scale of object based on distance to maintain same perceived size 2 Answers

Intersection Point Between 2 AnimationCurves 0 Answers

equation game question need help 1 Answer

How to you make a number squared in C#? 2 Answers

[Maths] How to project a curve in two axis? (Grav y + RelativeVelocity x) 4 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