Hello there. I am trying to make kind-of mini map using a ViewportFrame, but I am struggling with the math. The mini map is not an actual duplicate of the map, it is another model made based on the map. What I am trying to do is get the players position, and CFrame the camera based on the position and rotation of the HumanoidRootPart.
Using Camera.CFrame = CFrame.new(HumanoidRootPart.Position + Vector3.new(0, 100, 0), HumanoidRootPart.Position) (code found in this video), the camera gets CFramed based on the HumanoidRootPart’s position, but not rotation. How would I go about scripting it so it CFrames based on both position and rotation. I am new to Viewport Frames so I really don’t know how I can accomplish this. Thank you for your time.
Thank you for the reply. It seems that with that code, the model rotates about the X axis instead of the Y. Here is how it looks like: https://gyazo.com/5ec804ca5f5c4c4767e371c23399c12d
Thank you for the reply though.
The CFrame.Angles(0, 0, math.rad(HumanoidRootPart.Orientation.Y)) seems to be the one that worked. Only thing that I needed to add was 90 degrees to the HumanoidRootPart.Orientation.Y, and it worked as it should. Thank you.