#red light green light problem
1 messages · Page 1 of 1 (latest)
Maybe you're rotating on the wrong axis? Could I see your code?
you get the offset from torso to head
local offset = Head.Position - pos
and than apply a rotation to the torso's position
than you add the offset back , but the offset is in the world space , not local to the roatted coorindate system
anyways to fix it , replace the getHeadCFrame fucntion with this
local function getHeadCFrame(yawOffset)
local torsoPosition = Torso.Position
local headOffset = Head.Position - torsoPosition
local yaw = Torso.Orientation.Y + yawOffset
local rotatedCFrame = CFrame.new(torsoPosition) * CFrame.Angles(0, math.rad(yaw), 0)
local rotatedOffset = rotatedCFrame:VectorToWorldSpace(
CFrame.new(torsoPosition):inverse():VectorToWorldSpace(headOffset)
)
return CFrame.new(torsoPosition + rotatedOffset) * CFrame.Angles(0, math.rad(yaw), 0)
end
more simply , you can replace it with this
local function getHeadCFrame(yawOffset)
local torsoPosition = Torso.Position
local yaw = Torso.Orientation.Y + yawOffset
local headOffset = Head.Position - torsoPosition
local rotationCFrame = CFrame.Angles(0, math.rad(yawOffset), 0)
local rotatedOffset = rotationCFrame:VectorToWorldSpace(headOffset)
return CFrame.new(torsoPosition + rotatedOffset) * CFrame.Angles(0, math.rad(yaw), 0)
end
TO FIND THE FUNCTION USE " CTRL + F " THAN PUT " local function getHeadCFrame" , THAN REPLACE IT TO THE
end
not fixed
can you make it a whole script?
its really dificult for me
@slate swan
heres my script
same , or no improvments ?
** You are now Level 5! **
sadly
its not roblox what hates me , its models ... i dont like models
i have no time to test models right now
lol
IM TWEAKING
did you try to rotate it manually
and is it also being this weird