![]() Now when I have a static projectile that is not moving, it rotates the correct amount in the correct duration. ![]() Then, in the animation loop, I have: projectile.CFrame = projectile.CFrame * CFrame.Angles(-(angleDelta), 0, 0) So instead of calculating the necessary angle for each step, I just have to calculate the change in angle between each frame: local angleDelta = ((math.pi / 4) / t) / 60īecause I couldn’t see a good way to calculate the number of times the animation loop will run, I took the amount of the rotation (45 degrees) divided by the time to take that rotation (t) divided by the number of frames per second (I assumed 60 because that is the cap and I don’t know a good way to get the actual value). Turns out that I can’t do the CFrame.Angles with the argument of the angle I want it pointed to, but I have to use an argument for how much I want it rotated by. I printed out all my angles as it calculates them, and they look correct, running from +.76 to -.80.ĮDIT 2: I figured out some of the mistakes I made in that code. However, when I run it, I don’t see the projectile actually rotating. The end result is moving from a +45 angle to a -45 angle by the end of the animation. Then, on each render step, it subtracts from that angle a proportion of the full rotation of the projectile. What this should do is start the projectile pointing at the target, then up at a 45 degree angle. Then, inside of the while loop I have: p.CFrame = p.CFrame * CFrame.Angles(0, angle, 0)Īnd after the RenderStepped update: angle = (math.pi / 4) - ((nt / (t * 2)) * (math.pi / 2)) ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |