Why will the bullet always have the same rotation? The rotation axis i want it to rotate on is the y axis. I want it to move in the same direction as the gun is facing.
like if i aim the gun upwards the bullet still dont move upwards.
when i tried printing Dir.Y it printed values like 80 or 40 but the bullet has something completely else what do i do wrong? this is a localscript
if script.Parent.Parent.Humanoid.MoveDirection.X == 0 then
if Dir.Y > 0 then
Bullet.CFrame = CFrame.new(Pos.X,Pos.Y+0.3,50) * CFrame.Angles(math.rad(Dir.X),math.rad(Dir.Y),math.rad(Dir.Z))
elseif Dir.Y < 0 then
Bullet.CFrame = CFrame.new(Pos.X,Pos.Y+0.3,50) * CFrame.Angles(math.rad(Dir.X),math.rad(Dir.Y),math.rad(Dir.Z))
end
else
if Dir.Y > 0 then
Bullet.CFrame = CFrame.new(Pos.X+3,Pos.Y+0.3,50) * CFrame.Angles(math.rad(Dir.X),math.rad(Dir.Y),math.rad(Dir.Z))
elseif Dir.Y < 0 then
Bullet.CFrame = CFrame.new(Pos.X-3,Pos.Y+0.3,50) * CFrame.Angles(math.rad(Dir.X),math.rad(Dir.Y),math.rad(Dir.Z))
end
end
I’d recommend using the lookVector instead of the Orientation, as it’ll make your life a lot easier. The lookVector is the Vector as of which the part/whatever is looking at, hence the name. to get it, all you have to do is PART_HERE.CFrame.lookVector, and then you can use that in something like a BodyVelocity, BodyForce; whatever.
If you’d like to see the wiki page on lookVectors, check out this page on CFrames, which has lookVector in it.
i still dont understand lookvector even tho i read about it. It does not explain that good. I have done some testing and it seems so random like the lookvector of a part is 0.83453845 whilst the orientation is 50