Recently, I have creating a topic concerning a similar matter however I haven’t found a answer which solves my problem. This time however, the issue is that I’m trying to get a turrent to move to the right or left 360 degrees wherever the mouse is facing but instead what it does it it moves the whole entire boat with it.
Here is my code:
while true do
for i,v in pairs(Turrent.Parent:GetDescendants()) do
if v:IsA("Part") then
v.CFrame = CFrame.new(v.Position, Mouse.Hit.Position)
end
end
task.wait()
end
I’m not sure on how to fix this as I have been stuck on it for a few days now. Any help is appreciated, thanks!
I am using the qPerfectionWeld in the whole entire Boat so it doesn’t fall apart. Is this the issue? if so, how would I use Weld.C0 t0 change the CFrame?
I think it may have an issue regarding the Welding script however I’m not sure. I was told to use the Weld.C0 however I’m also not sure on how to manipulate it into how I want it to be. I can show you the properties of the Turrent if you would like.
yeah, so what I think the issue is that because you’re editing the cframe directly, it also moves all the parts that are welded to it. The c0 and c1 properties of a weld just determine how the parts are offset from each other. So if you edit those values directly, you can achieve the correct rotation without moving the entire assembly. Don’t 100% remember off the top of my head if you have to edit the c0 or the c1, but you can play around with those values and figure out which one needs to be offset.
Could also try adding a motor6d instead of a weld for the turret, because it has the c0 and c1 properties displayed and you can use that to figure out how the parts are supposed to work with welds because it’s the same thing
Don’t both motor6d’s and weld’s have the C0 and C1 properties? I’m not too experienced with motor6d’s and my history working with them isn’t great either.
I can try edit the C0 and C1 values directly, do you reckon I’d just set it to the CFrame of the mouse?
Yeah, so for the motor6d comment I just said that because it has the c0 and c1 properties that can help you visualize the offset on the properties window. (welds don’t have this)
Also found this similar thread from a while back where I did something similar but instead of connecting it with a weld, i connected it with an alignposition and rigidity enabled, then changed the cframe of an alignorientation to match what I wanted.
It shouldn’t be a Motor6D, since those are not as performant and are slower for performance. A Weld is always better unless you’re planning to use DeiredAngle or Transform (animation editor).
False. They do have this.
What I mean by object space is CFrame.ToObjectSpace, which is very easy to use. You’d do yourCFrame:ToObjectSpace(yourTurretRootPart.CFrame.