you do look familiar, maybe we met on roblox or script helpers.
but I think I may need to make another question because I dont know how this is going to complete my needs, this question was made for a test model in the hopes that It would help me finish this:
the original plan was to use the hinges to hook up the gun as seen here, I wanted the gun to rotate along the cabin, and the cabin along the base. but a new problem arises and thats how its going to be controlled. im not sure if its a good idea to ask another topic on top of another, but for the sake of time I want to try:
along with CFrame is there a way for me to track the mouse and have the gun move around as the mouse moves around (FE of course).
if not then ill accept the provided response as it does answer the first question.
as the player moves their mouse, the gun will rotate up and down, while at the same time the cabin and gun will rotate sideways along the base, the base itself wont be rotating and the whole thing will be in one place.
the mouse is also locked in the center just like those other games too.
I actually did something quite similar w/ CFrame on this post:
However, if u want to use these fancy new objects…
I tried downloading the file you posted but I couldn’t find the HingeConstraint.
Personally I’ve never bothered to play around with these fancy new objects much.
After fiddling around with it for a while, I’ve figured out the jist of it.
Here’s the math if you’re interested:
This is my code
-- Wait for player to join game
repeat wait() until #game.Players:GetChildren() > 0
Player = game.Players:GetChildren()
-- Wait for Player's character to load
if not Player.Character then
-- define some variables
Char = Player.Character
CharPart = Char:WaitForChild('HumanoidRootPart')
Hinge = script.Parent
RootPart = Hinge.Parent
while wait() do
-- define position of origin
HKpos = Vector2.new(RootPart.Position.X,RootPart.Position.Z)
-- define position of target
XYpos = Vector2.new(CharPart.Position.X,CharPart.Position.Z)
-- the ratio to get the triangle's width over the height
ratio = (XYpos.Y-HKpos.Y)/(XYpos.X-HKpos.X)
beta = math.atan(ratio) -- converting this to radians
-- turn it from radians into degrees
beta = beta*(180/math.pi)
Hinge.TargetAngle = -beta -- beta has to be negative so it points at you