Fri Jan 21, 2022 4:10 pm
VelFromAngle and Vel3DFromAngle are incredibly useful functions for those of us who lack trigonometry skills, however I have noticed there doesn't seem to be a function or functions to retrieve the relative angle and/or pitch an object is traveling toward based on its velocity. This function would be basically the inverse of the two functions already mentioned. I need such a function so that I can adjust an object's relative forward velocity to include its pitch all without changing the direction the object is facing.
I may not have explained that very well. Basically what I want to do is spawn an object and be able to set its velocity relative to the direction it is facing. So XVel would be forward/backward, YVel would be side to side, and ZVel would be up/down. I have no problem setting that up, the issue is, I want to be able to pass a flag to the function that will also include the object's pitch in its forward velocity calculations. I thought I could just use Vel3DFromAngle until I realized that the object might not necessarily be traveling toward the direction it is facing, so I need a way to pass on an angle to Vel3DFromAngle that is based on the object's current velocity independent of the angle it is actually facing. It would also be helpful to be able to get a pitch value based on an object's velocity as well, but that is not as important right now.
Fri Jan 21, 2022 4:40 pm
do what you want to do?
Fri Jan 21, 2022 4:59 pm
Thanks for the quick response. I never even thought about that function and it may be a rather genius workaround. Of course I will have to save the object's angle and pitch before using that function so that I can reset them after using it but that shouldn't be a problem. I will try this out and see how it goes.
Sat Jan 22, 2022 3:20 am
You can recover the horizontal angle with
VectorAngle(vel.x, vel.y) and pitch with
Sun Jan 23, 2022 9:41 pm
Thank you so much, that is exactly what I was looking for, much appreciated.
Powered by phpBB © phpBB Group.
phpBB Mobile / SEO by Artodia.