Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to set this Vector3 orientation in a CFrame?

Asked by 6 years ago

I need a rotation inside a CFrame because otherwise the part will keep teleporting because the game thinks it's inside another brick :/ I don't know how to do this though

This is the orientation

Vector3.new(laser.Orientation.X + 90, laser.Orientation.Y, laser.Orientation.Z)

This is what I tried

local head = script.Parent
local LTP = script.Parent.Parent:WaitForChild('LockToPart')

while wait() do
    if workspace:FindFirstChild('laser') then
        local laser = workspace.laser
        local rot = laser.Orientation
        head.CFrame = CFrame.new(head.Position) * CFrame.Angles(math.rad(laser.Orientation.X), math.rad(laser.Orientation.Y), math.rad(laser.Orientation.Z)) 

    --  head.Orientation = Vector3.new(laser.Orientation.X + 90, laser.Orientation.Y, laser.Orientation.Z)
    end
end

1 answer

Log in to vote
0
Answered by 6 years ago
local head = script.Parent
local LTP = script.Parent.Parent:WaitForChild('LockToPart')

while wait() do
    if workspace:FindFirstChild('laser') then
        local laser = workspace.laser
        local rot = laser.Orientation
        head.CFrame = CFrame.new(head.CFrame) * CFrame.Angles(math.rad(laser.Orientation.X), math.rad(laser.Orientation.Y), math.rad(laser.Orientation.Z)) 

    --  head.Orientation = Vector3.new(laser.Orientation.X + 90, laser.Orientation.Y, laser.Orientation.Z)
    end
end

hope that shall help i didint test it but still try it

0
so i made Position to CFrame instad of position cuz vector 3 cuz vector 3 looks liek this : X,Y,Z and CFrame has more numbers it will do the same as u want i think Benjamin_pro1000 3 — 6y
0
I have no clue what you are thinking but you can't make a CFrame with a CFrame dude User#20388 0 — 6y
0
hmm weird for me i need to use cframe Benjamin_pro1000 3 — 6y
0
You CANNOT use CFrame inside A CFrame, a cframe already has rotation data inside it. This script will result in an error User#20388 0 — 6y
Ad

Answer this question