How do you change the camera rotation to keep it leveld? When climing on an angle I want the camera to stay non rotated, how would I do this?
camera.CFrame = cameraPart.CFrame
camera.CFrame = camera.CFrame * CFrame.fromEulerAnglesXYZ(0,0,0)
How do you change the camera rotation to keep it leveld? When climing on an angle I want the camera to stay non rotated, how would I do this?
camera.CFrame = cameraPart.CFrame
camera.CFrame = camera.CFrame * CFrame.fromEulerAnglesXYZ(0,0,0)
Just use the position of what you want to focus on rather than its rotation too.
camera.CFrame = CFrame.new(cameraPart.Position)*offsetIfYouNeedIt
I guess it might be problem in your second line, have you tried this:
camera.CFrame = CFrame.fromEulerAnglesXYZ(0,0,0)
Now you don’t INCREASE angle by (0,0,0) but you SET it to (0,0,0)
I did this
camera.CFrame = CFrame.new(cameraPart.Position) * CFrame.new(0, 0, 0)
but I need the camera turned -180 on the Y (Orientation) how should I do this?
You can apply a rotational offset:
camera.CFrame = CFrame.new(cameraPart.Position) * CFrame.Angles(0, math.rad(-180), 0)
when turning right or left the camear doesnt follow, is there a way to do this? (its a car)
You can set an absolute rotation (not relative to the cameraPart
's CFrame).
camera.CFrame = CFrame.new(cameraPart.CFrame.Position)*CFrame.Angles(..., ..., ...)
I want the camera to follow the car as it goes turn right and left how would I do that?
This may work:
local offset = 5; -- // Some offset from the cameraPart.
camera.CFrame = CFrame.lookAt((cameraPart.CFrame * CFrame.new(0, 0, offset)).Position, cameraPart.Position)
You could leave the X and Z rotation alone, but just negate its Y rotation perhaps.
local lookDirection = camPart.CFrame.Position + camPart.CFrame.LookVector
camera.CFrame = CFrame.lookAt(camPart.CFrame.Position, Vector3.new(lookDirection.X, camPart.CFrame.Position.Y, lookDirection.Z))
Not sure, but try this and let me know.
works! Now lets say when turning I want the car to be shwon a bit, like the camera tils maybe 0.5 of a stud, how would I do that? left/right
If you’re happy with how the base camera looks, you can then add an additional offset to the final CFrame returned from lookAt
.
local offset = CFrame.new(0, .5, 0) --//Modify this
camera.CFrame = CFrame.lookAt(camPart.CFrame.Position, Vector(lookDirection.X, camPart.CFrame.Position.Y, lookDirection.Z)) * offset
Like for example, when you turn left the camera tweens 0.5 to the left then when right weens 0.5 to the right then when straight stays straight