Jump to content
  • Advertisement
Sign in to follow this  
Sidd

How to calculate local velocity if you know it's world velocity and local rotation?

This topic is 888 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm trying to simulate slip/tracking friction forces for my vehicle in UE4. 

 

  • I have the component velocity in World Space
  • I have its local rotation

I used the following code to get the local directions for the my vehicle in World Space:

	// Getting direction realtive to the cuboid; Used in steering and friction calculations. 
	FRotator Rotation = VMesh->GetComponentRotation();
	FRotator Yawrotation(0.f, Rotation.Yaw, 0.f);
	ForwardDir = FRotationMatrix(Yawrotation).GetUnitAxis(EAxis::X);
	RightDir = FRotationMatrix(Yawrotation).GetUnitAxis(EAxis::Y);
	UpDir = FRotationMatrix(Yawrotation).GetUnitAxis(EAxis::Z);

I can't figure out how to get it's Local velocity. Can I use the above syntax to solve problem somehow?

 

 

Share this post


Link to post
Share on other sites
Advertisement

Thank you so much! It works like a charm :) saved me hours of troubleshooting different methods 

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!