- Home /
Lerping objects Vector3.up in 3d space
Ok so this is what I am trying to do,
I want a spaceship to be able to land on any surface in any direction so the code i have at the moment works like this:
It fires a raycast out the bottom of the ship, It uses the 3 vertices of where it hit to create 2 vectors (2 sides of the triangle) It then uses the cross product of those to find the normal to that face It then normalizes it (all that works perfectly) I think lerp the ships transform.up to to the normal, this is where my problem arises:
I am getting random rotation values for the 'spin' of the normal and it creates very strange behavior (snapping to the start point or end point of the lerp because it has a different spin). ... does anyone know how I can stop this? I believe it has something to do with quaternions but I don't have the foggiest, my maths isn't up to scratch.. I found this in another thread and I either dont understand it or it doesnt work too well in 3d space.
Any help would be appreciated?
Your answer
Follow this Question
Related Questions
Use Lerp to rotate object 2 Answers
better way to rotate instead Coroutine 1 Answer
How can I use lerp to rotate an object multiple times? 2 Answers
Quaternion.Lerp and Vector3.MoveTowards arent smoothing 1 Answer
Rotate object: script works if applied to that object, but not if referencing object in scene 1 Answer