bleintant
(bleintant)
October 5, 2022, 5:30am
#4
Yes it does. Basically I have a dart and when it hits a player, I weld it to whatever part of the player it hit(Left Arm, Right Arm etc). However, it doesn’t face the direction it came from, so I’m trying to figure out how to make it so that it does.
Example:
You could also use the align position and align rotation constraints
1 Like
SirHoog
(Hoog_Rider)
October 5, 2022, 5:31am
#6
Do what @SomeFedoraGuy said. CFrame.LookAt()
bleintant
(bleintant)
October 5, 2022, 5:34am
#7
Could you demonstrate this? Here’s my code for reference.
local Weld = Instance.new("Weld")
Weld.Parent = bullet.PrimaryPart
Weld.Part0 = hit
Weld.Part1 = bullet.PrimaryPart
local WeldingCfr = CFrame.new(m)
local ObjectCframe = hit.CFrame:ToObjectSpace(WeldingCfr):Inverse()
Weld.C1 = ObjectCframe
What is the part you’re trying to rotate?
1 Like
bullet.PrimaryPart.CFrame = CFrame.lookAt(bullet.PrimaryPart.Position,hit.Position)
bleintant
(bleintant)
October 5, 2022, 5:42am
#11
For some reason doing this completely destroys whatever was hit.
What do you mean by “destroys”? Could you send a video? Does it destroy in the meaning of :Destroy()
?
bleintant
(bleintant)
October 5, 2022, 5:52am
#13
Try doing it before you weld the bullet.
bleintant
(bleintant)
October 5, 2022, 5:57am
#15
I did. Here’s my current code.
bullet.PrimaryPart.CFrame = CFrame.lookAt(bullet.PrimaryPart.Position,hit.Position)
bullet.PrimaryPart.Anchored = false
local Weld = Instance.new("Weld")
Weld.Parent = bullet.PrimaryPart
Weld.Part0 = hit
Weld.Part1 = bullet.PrimaryPart
local WeldingCfr = CFrame.new(m)
local ObjectCframe = hit.CFrame:ToObjectSpace(WeldingCfr):Inverse()
Weld.C1 = ObjectCframe
Unanchoring the RootPart is not needed. What is your bullet tree (how it’s structured)? Are there other parts not welded the the RootPart?
bleintant
(bleintant)
October 5, 2022, 6:02am
#17
This is what it looks like:
If I don’t anchor the part then it ends up moving whatever it hit:
https://gyazo.com/b42b9a65de385b2ac4fb94168968933c
Ok. Try making all of the Yellow Dart parts un-can-collide-able, and unanchored. Make the RootPart of the Yellow Dart Anchored, and try again.
bleintant
(bleintant)
October 5, 2022, 6:09am
#19
Still the same result for some reason. Do you think it may be the way it’s welded? I feel as if I might need to change something, but I don’t know what.
Try using a WeldConstraint instead of a Weld.
bleintant
(bleintant)
October 5, 2022, 6:12am
#21
I’ve never used a WeldConstraint before. Do you think you could demonstrate?
local Weld = Instance.new("WeldConstraint")
Weld.Parent = bullet.PrimaryPart
Weld.Part0 = hit
Weld.Part1 = bullet.PrimaryPart
2 Likes
bleintant
(bleintant)
October 5, 2022, 6:27am
#23
Oh wow, that fixed basically everything. I’m going to mark you solution, it just seems like my PrimaryPart needs to be facing the other way. You got any ideas?
Edit: Nevermind, I figured it out myself
2 Likes