Hello! I am trying to figure out how to align the ends so that they are always pointing towards the two parts if that makes any sense, at the tip of the gun is a part and at the end of where the mouse hits is another part that is generated. Currently my plan is to position bones so I can give it a wavy effect, but I have ran into some issues when moving the actual rigged cylinder there before moving the bones, it isn’t positioning properly.
My goal looks something like this, but I can’t seem to find searches that are pertaining to this situation unless I’m not using the right keywords
Since as seen in the photo of the game, it is more like this
The laser would also work just anyway, if you were to point it on the ground it would still be straight between those two points if that makes any sense. I apologize if this is confusing but I’d appreciate any advice that will point me in the right direction. Thank you in advance!
You could try to use CFrame.lookAt() to set the position and get the part to look at Part B.
Laser.CFrame = CFrame.lookAt(Position, PartB.CFrame, Vector3.yAxis)
-- Vector3.yAxis is the UP axis it's using for alignment, just mess with it till it works
It definitely does do something which I noticed, but it doesn’t necessarily go inbetween the points if that makes any sense. It would be something like this:
But it still does this:
Here is a glimpse of the code I used using what you suggested to me, would it just be the matter of changing the Vector3 or something like that?
The perspective on the images is confusing me on what the “intended” goal is however I’m guessing? that the “streamEffect” part is rotated the wrong way.
You can change the axis it is aligning by changing: Vector3.yAxis, to Vector3.xAxis or Vector3.zAxis.
If that STILL doesn’t work, I imagine you could just manually apply a rotation.
Something like: