Hello, I’m trying to make a monster model that jumpscares you and when it jumpscares you it tweens your camera in the monsters face.
here is my current script:
game.Workspace.CurrentCamera.CameraType = Enum.CameraType.Scriptable
local p = monster:GetPivot().LookVector
local tween = game:GetService('TweenService'):Create(workspace.CurrentCamera,TweenInfo.new(.25),{CFrame = CFrame.new(Vector3.new(p.X,p.Y,p.Z))}):Play()
However it doesn’t work.
How do I get the position of the front of the monster model then offset it a little bit?
You can use CFrame.new(Vector3.new(p.X + 2, p.Y, p.Z) or whatever works for you. Adding or subtracting from the X, Y, or Z values moves the CFrame that many studs.
Strictly speaking, the technical front face of a part is always negative Z. You can almost never go wrong on the scripting side if you keep that in mind during building.
As it stands though, unless you have another way to determine the “front” as you have it, you’d need to configure it individually for each monster.
the monster is an AI and moves around dude. It’s not “Always Negative Z” I am talking about when the model orientates itself the front still remains the orientation
Imagine in your head if you are walking around the front of you is in front of your face. If you turn your body toward the right the front is still the front of your face but a different rotation now
Oh I see. Yeah that should have been obvious but I misunderstood your recent reply.
So just to be clear before I type all this out, you want the camera to be in front of the monster, looking at the front of the monster. Is that correct?
CFrame is the same thing as position but also with orientation. CFrame is not related to world space and object space.
In your response you showed the elementrary formula for creating a new CFrame. You did not show anything about owrld space or object space
Adding +3 to the X axis in your basic formula does not move the camera +3 on the X axis relative to the object but it just moves it plus 3 in the world space.
But if you read the link I put in my post above you’d see that CFrame can be accessed in either World space and Object space.
It all depends on how you want to use the CFrame.
You can use the Object space of the monster face to place the camera, then point the Orientation to face the face. CFrames | Roblox Creator Documentation
So instead of giving a response and being helpful you’re just going to give me a link to the documentation? No example or any sort of logic at all except for “Use object space of monster face to place the camera.” then just shove a link down my throat and force me to have to find out what you’re talking about. You suck man like nobody wants to do that! I dont want to dissect a link dude.
After reading dissecting the link I got these lines of code
local pivot = monster:GetPivot()
local startPosition = vector3.new(0,3,0)
game.Workspace.CurrentCamera.CameraType = Enum.CameraType.Scriptable
local tween = game:GetService('TweenService'):Create(workspace.CurrentCamera, TweenInfo.new(0.25), {
CFrame = CFrame.new(startPosition , pivot.Position)
})
tween:Play()