How could I anchor a part's rotation but not it's position?
I'm making an iron man inspired flight suit with an old buddy of mine, but I've been tasked with the flight script, and I can't get the character to point in the direction of the mouse. * The script works, but looks dull in-game without the character pointing in the direction. Here's the script (it's a server script):
01 | b = Instance.new( "BodyPosition" ) |
03 | b.Position = torso.Position+(tuple [ 2 ] -torso.Position).unit * power |
04 | b.MaxForce = Vector 3. new( 50000000 , 50000000 , 50000000 ) |
05 | game:GetService( "Debris" ):AddItem(b, 0.1 ) |
07 | local ray = Ray.new(torso.Position, (tuple [ 2 ] - torso.Position).unit * power) |
08 | local a, position = workspace:FindPartOnRay(ray, character, false , true ) |
10 | local beam = Instance.new( "Part" , workspace) |
11 | beam.FormFactor = "Custom" |
15 | beam.CanCollide = false |
17 | local distance = (torso.Position - position).magnitude |
18 | beam.Size = Vector 3. new( 0.3 , 0.3 , distance) |
19 | beam.CFrame = CFrame.new(torso.Position, position) * CFrame.new( 0 , 0 , -distance / 2 ) |
20 | beam.Position = torso.Position |
22 | weld = Instance.new( "Weld" , beam) |
23 | weld.C 1 = CFrame.Angles(math.rad(- 90 ), 0 , 0 ) |
27 | game:GetService( "Debris" ):AddItem(beam, 0.09 ) |
tuple[2] is the mouse.Hit.p at the current time. This script is mostly copied off robloxdev.com/. Also, is there any way to not have to put the a in "a, position"? I tried but that's the only way to make it work for me. Thanks for your time. :)