I wanna make my rocket face the same direction as it’s launcher or just straight, using attachments.
It keeps spawning facing right.
local Rocket = RocketName:Clone()
Rocket.Position = Tool.FirePos.WorldPosition
Rocket.Anchored = false
Rocket.Parent = workspace.__SPAWNEDSTUFF
Rocket:SetNetworkOwner(nil)
Rocket.Sound:Play()
local RS = Config.Speed
local RUPF = Config.UpF
local Vel = Instance.new("BodyVelocity")
Vel.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
Vel.Velocity = (Data.LookVector + Vector3.new(0,0,0)) * RS
Vel.Parent = Rocket
2 Likes
Katrist
(Katrist)
July 24, 2023, 4:09pm
#2
Is your attachment rotated to the right?
2 Likes
Perhaps. If I were change the orientation will it also fix the rocket?
1 Like
Katrist
(Katrist)
July 24, 2023, 4:12pm
#4
Yes, there might be other problems though but you should try.
1 Like
Didn’t realy fix it, still faces incorrect direction.
1 Like
Katrist
(Katrist)
July 24, 2023, 4:16pm
#6
Can you take a video? I don’t know if you mean that it turns after you fired it, or if it spawns misoriented.
1 Like
RatiusRat
(Boopmaster)
July 24, 2023, 4:24pm
#7
Rocket.CFrame = Tool.FirePos.WorldPosition + CFrame.LookAt(Vector3.new(), Data.LookVector)
1 Like
Surely you should rather be using a LinearVelocity
instead? If you put the attachment in the front of the rocket that should rotate it correctly. Also maybe try using an AlignOrientation
with the orientation of the launcher.
1 Like
It sometimes spawns misoriented, depending where you’re looking at.
1 Like
I don’t think it plays a role Data is just mouse direction and it’s used to thrust the rocket foward.
1 Like
As @TestyLike3 suggested, BodyVelocity
is deprecated and should be avoided. AlignPosition
or LinearVelocity
should be used instead. AlignOrientation
should be used to keep the orientation fixed, or you can just set the orientation at the start of launch.
RatiusRat
(Boopmaster)
July 24, 2023, 4:27pm
#12
the reason it isn’t rotating at all is because bodyvelocity is applied at the center of mass by default.
Mystxry12
(Mystxry)
July 24, 2023, 4:34pm
#14
Vel.Velocity = Rocket.LookVector * RS
Also, yeah use VectorForce
1 Like
BV doesn’t play a role in here because when I face left the rocket spawns orientated correctly but when I face straight, it faces(the rocket) left.
How would I use AlignOrientation
exactly? I have never used it before.
Mystxry12
(Mystxry)
July 24, 2023, 6:09pm
#17
Try this:
Rocket.CFrame = CFrame.lookAt(Tool.FirePos.WorldPosition, workspace.CurrentCamera.CFrame.LookVector)
Bump, Still looking for help, I’ve tried this but my rocket comes out looking the wrong direction.
Rocket.CFrame = CFrame.new(Tool.FirePos.WorldPosition, Data.LookVector) * CFrame.Angles(Tool.FirePos.WorldOrientation.X, 0, 0)
RatiusRat
(Boopmaster)
July 24, 2023, 8:34pm
#20
Rocket.CFrame = Tool.FirePos.WorldPosition + CFrame.LookAt(Vector3.new(), Data.LookVector)
RatiusRat
(Boopmaster)
July 24, 2023, 8:37pm
#21
oops i meant this
Rocket.CFrame = CFrame.LookAt(Vector3.new(), Data.LookVector) + Tool.FirePos.WorldPosition