#nested model changes entire parent models pivot

1 messages · Page 1 of 1 (latest)

pale sequoia
#

nest :
ship - model
ship - part
arrow - model
primarypart - part
part - part

i changed the pivot of the arrow, it say it only changes pivot for descendents, but it changes pivot of the whole ship?

I changed it so that it is unwelded, which worked, but my ship is fast and the arrow lags behind when i set position.

what do i do?

pale sequoia
#

also how do i reduce network traffic size with remote events
i figured this one out
but not the original question

keen jolt
#

Do you have any videos or photos?

#

I want to know how it is

pale sequoia
#

alright ill send it once i get home, or actually hold on

keen jolt
#

ok

pale sequoia
#

actually uhh

its a pretty simple script and nesting

i have

workspace :
target
Model :
part
model :
part
script

script :
script.Parent:PivotTo(cframe.lookat(script.parent.PrimaryPart.Position, workspace.target.Position))

The reason I cant have videos or photos is because i only have discord on my phone.

#

anyhow, lets say we have both parts having a forward direction. I aim to have one part, the descendant one, pivot to another, but it seems that it affects the ancestor.

keen jolt
#

I see

jaunty waveBOT
#

studio** You are now Level 1! **studio

keen jolt
#

PivoTo It will affect the entire model

#

More than just one part

pale sequoia
#

ah..... how will i do what i aim to do?

#

ive searched as much as i could

keen jolt
#

Try this

local childModel = script.Parent
local partToRotate = childModel.Part2
local targetPart = workspace.TargetPart

local function updateRotation()
local direction = (targetPart.Position - partToRotate.Position).Unit

partToRotate.CFrame = CFrame.lookAt(
    partToRotate.Position,  
    targetPart.Position
)

end

--Triggering method

pale sequoia
#

the same thing happened, was it because I had to weld it? it does work without welding, but i need it to be welded.

Also, where is direction used?

keen jolt
#

The direction can be deleted.

if you need it to be welded
You can try this:

local childModel = script.Parent
local partToRotate = childModel.Part2
local basePart = childModel.PrimaryPart -- or childModel.BasePart
local targetPart = workspace.TargetPart

-- Motor6D
local motor = partToRotate:FindFirstChildOfClass("Motor6D")
if not motor then
motor = Instance.new("Motor6D")
motor.Part0 = basePart
motor.Part1 = partToRotate
motor.C0 = CFrame.new() -- Part0 position:You can set it manually or motor.C0 = basePart.CFrame:ToObjectSpace(basePart.CFrame)

motor.C1 = CFrame.new()  

-- Part0 position:You can set it manually or motor.C1 = basePart.CFrame:ToObjectSpace(targetPart.CFrame)

motor.Parent = partToRotate

end

local function rotatePartOnly()
local relativePos = partToRotate.Position - basePart.Position
local lookCFrame = CFrame.lookAt(
Vector3.new(0, 0, 0),
(targetPart.Position - partToRotate.Position).Unit * 10
)

motor.C1 = lookCFrame

end

pale sequoia
#

ah it worked thx

jaunty waveBOT
#

studio** You are now Level 3! **studio