I want to change a part orientation like for example x by +15 degrees
I tried to search around but its only about orientation = Vector3.new()
Bullet.Orientation = script.Parent.Tool.Handle.MeshGun.Orientation * Vector3.new(math.deg(math.random(-1,1)),math.deg(math.random(-1,1)),math.deg(math.random(-1,1)))
--Bullet.Orientation = script.Parent.Tool.Handle.MeshGun.Orientation + Vector3.new(math.deg(math.random(-1,1)),math.deg(math.random(-1,1)),math.deg(math.random(-1,1)))
This is some of the codes I tried. Note that some of the names are replaced by other things because this would be easier to read for others
Anything helps, thanks
1 Like
DataSigh
(DataSigh)
April 26, 2023, 2:47pm
#2
In the example below, I’m using the spawnLocation (only thing I had in studio) and rotating it by 45 degrees on the X.
local modelToSpin = workspace.SpawnLocation
modelToSpin.CFrame = modelToSpin.CFrame * CFrame.Angles(math.rad(45), 0, 0)
5 Likes
This didn’t work for me
It made the bullets stuck in the Handle for some reason
1 Like
gertkeno
(Gert)
April 26, 2023, 2:58pm
#5
Could you explain more about why these two examples did not work for you? What was the result you saw?
1 Like
Here what it does with the uh thing
Screen Recording (4-26-2023 10-08-41 PM).wmv (3.1 MB)
local Bullet = game.ReplicatedStorage.Bullet:Clone()
Bullet.Parent = game.Workspace
Bullet.CFrame = script.Parent.Sword.Handle.a1.WorldCFrame
Bullet.Orientation = script.Parent.Sword.Handle.Shotgun.Orientation * Vector3.new(math.deg(math.random(-1,1)),math.deg(math.random(-1,1)),math.deg(math.random(-1,1)))
Bullet.Speed.Value = 300
Bullet.Creator.Value = script.Parent
game.Debris:AddItem(Bullet,5)
Here are the lines for the bullet things
ifkpop
(ifkpop)
April 26, 2023, 3:42pm
#8
You should set .Parent
last, everything else should be done beforehand. Also, you should probably do the orientation change on the CFrame
line, just as @DataSigh ’s example shows. As for why it is stuck, there may be a few reasons, unrelated to if you change roation or not.
Have you made sure that:
It isn’t anchored?
The location it spawns at isn’t collidable?
It actually has a velocity?
KJry_s
(MalleoZephyris)
April 26, 2023, 3:49pm
#9
This should work:
Bullet.Orientation -= Vector3.new(0, 15, 0)
2 Likes
Just add a vector3 from part.Orientation or multiply the CFrame by CFrame.Angles. I’d prefer CFrame tho as it will rotate the part on the relative axis and not the world one, which is very useful for most cases.
system
(system)
Closed
September 11, 2024, 3:51am
#11
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.