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 /
This question was closed Jun 19, 2013 at 08:48 PM by Kirbyrawr for the following reason:

The question is answered, right answer was accepted

avatar image
0
Question by Kirbyrawr · Jun 18, 2013 at 11:21 PM · vector3speedslerp

Vector 3. Slerp

Hi, i want to change the speed variable of Vector3.Slerp but when i do it, it changes the position because there is a transform.

Tried:

1- If you change the number only when the game start, it works perfectly.

2- I was trying to save the variable just a moment before changing the speed and apply it to the position, but it seems it doesn't work or it do weird things.

The thing i want to get

Changing the Vector3.Slerp velocity without changing the position.

FIRST CODE WITHOUT CHANGING ANYTHING:

Code:

 var TimeSpeed : float = 1;
 var Sun : GameObject;
 var sunrise : GameObject;
 var sunset : GameObject;
 
   var center = (sunrise.position + sunset.position) * 0.5;
         // move the center a bit downwards to make the arc vertical
         center -= Vector3(0,0.1,0);
     
         // Interpolate over the arc relative to center
         var riseRelCenter = GeneralSettings.Helpers.sunrise.position - center;
         var setRelCenter = GeneralSettings.Helpers.sunset.position - center;
 
 fracComplete = fracComplete*TimeSpeed;
 Sun.transform.position =  
 
 Vector3.Slerp(riseRelCenter, setRelCenter, fracComplete);
 LightSettings.Sun.transform.position += center;

SECOND CODE MODIFIED:

    var TimeSpeed : float = 1;
     var Sun : GameObject;
     var sunrise : GameObject;
     var sunset : GameObject;
     
       var center = (sunrise.position + sunset.position) * 0.5;
             // move the center a bit downwards to make the arc vertical
             center -= Vector3(0,0.1,0);
         
             // Interpolate over the arc relative to center
             var riseRelCenter = GeneralSettings.Helpers.sunrise.position - center;
             var setRelCenter = GeneralSettings.Helpers.sunset.position - center;
     
     fracComplete = fracComplete*TimeSpeed;
     Sun.transform.position =  
     
     Vector3.Slerp(riseRelCenter, setRelCenter, fracComplete);
     LightSettings.Sun.transform.position += center;
 
         
            if(timeSpeed2 == !ActualTimeGame.timeSpeed  && change2 == true){
            print("Bien hasta aquí");
            fracComplete = fracComplete*ActualTimeGame.timeSpeed;
         LightSettings.Sun.transform.position = Vector3.Slerp(riseRelCenter, setRelCenter, fracComplete);
         LightSettings.Sun.transform.position += center;
            }
                frac2 = fracComplete;
            
         
        
   if(ActualTimeGame.timeSpeed != timeSpeed2){
     frac = fracComplete;
     return;
    if(!oneTimeFrac){
             oneTimeFrac = true;
             timeSpeed2 = ActualTimeGame.timeSpeed;
             change= true;
             fracComplete = frac;
             change2=true;
     }

Thanks in advance, KirbyRawr. PD: the codes can contain some errors.

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

  • Sort: 
avatar image
0
Best Answer

Answer by Kirbyrawr · Jun 19, 2013 at 08:48 PM

Finally! I got it, three days but now i understand it perfectly.

  frac += Time.deltaTime*(ActualTimeGame.timeSpeed/33000);

Instead of Time.time-startTime

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

Follow this Question

Answers Answers and Comments

14 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

Related Questions

Controlling the speed of Vector3.RotateTowards 0 Answers

How can I create a follower Ai which is restricted on the Y Axis? 0 Answers

making a camera that moves depending on mousepos.y 0 Answers

Movement along with touch of finger 2 Answers

Comparing rigidbody speeds 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