- Home /
 
               Question by 
               MachinoDude · Aug 27, 2021 at 03:36 AM · 
                mathvector  
              
 
              How to split velocity into two smaller vectors at a chosen degree?
What I want is to go from a velocity of a rigidbody and then split that velocity into two smaller velocity's that go roughly the same way just at a higher or lower angle. I tried using SohCahToa but it only worked when the object was going a specific direction. The black arrow is the velocity and the red is what I want to find. Thanks.
 
                 
                capture.png 
                (23.2 kB) 
               
 
              
               Comment
              
 
               
               
               Best Answer 
              
 
              Answer by Eno-Khaon · Aug 27, 2021 at 03:54 AM
You can rotate a Vector by multiplying it with a Quaternion. For example:
 Quaternion rotA = Quaternion.AngleAxis(30f, Vector3.forward);
 Quaternion rotB = Quaternion.AngleAxis(-30f, Vector3.forward);
 // Don't know what you're using, so I'm guessing Vector3
 Vector3 baseVelocity = rb.velocity;
 // Halving them to give each new vector a lesser magnitude
 Vector3 halfVelA = rotA * baseVelocity * 0.5f;
 Vector3 halfVelB = rotB * baseVelocity * 0.5f;
Your answer
 
 
             Follow this Question
Related Questions
Draw a Vector line ??? 3 Answers
Trying to move an object towards another's axis. 1 Answer
,How to get a percent of a line 0 Answers
Calculate launch angle based on launch direction 2 Answers
Is there such a thing as Unity Algebra? 0 Answers
 koobas.hobune.stream
koobas.hobune.stream 
                       
               
 
			 
                