Help with Camera Orientation

It’s because i’ve set up a position already for the camera and the models.


It should be looking towards it on the viewport, like this:
Screenshot_3

I’m pretty confused because i’ve never worked with cameras before so, sorry if i’m looking dumb

Yeah, but now it’s his choice whether to put camera. I’m trying to think it so hard.

Maybe let it remain how the orientation is, as you can see, normally without any script it’s the orientation you want though. Or even if you wanna change the orientation, you may just multiply the lookVector by some studs of the pet and place the camera there.

It’s okay, I can see how this can be confusing. My first recommendation to fix your script is to remove the hardcoding. I’m assuming the pets are not all positioned in the same place, so you need to determine the camera position based off the LookVector of the pet, like this:

viewcamera.CFrame = CFrame.new((Pet.CFrame + (Pet.CFrame.LookVector * 5)).Position, Pet.Position)

Which is a long line of code, but basically it makes the camera look at the pet from 5 studs infront of the pet.

They actually are :stuck_out_tongue:

I’ll try to use CFrames.Angles with the CFrame.new(pos), i’ve searched a bit about it on the doc and found something that maybe i can work with

Ok, it’s good. Good luck with it !

1 Like

The lookat variable is not the same as orientation, lookat is a unit vector to where you want the look vector to be aiming, if you want to create a new cframe from a position and a euler rotation you need to use this code

CFrame.new(Pos)*CFrame.Angles(math.rad(lookAt.X), math.rad(lookAt.Y), math.rad(lookAt.Z))
2 Likes

Thank you! That was what i actually was looking for, CFrame its kinda confusing to me :stuck_out_tongue:
Thank you everyone who tried helping me, appreciate it :smile:

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.