Shotgun spread changes depending on speed

I am currently scripting a shotgun for a team project, and I’ve been researching how to spread a directional vector to get that shotgun bullet effect. When I slow the bullet speed down, the bullets spread properly. However when I speed it up to the normal bullet speed, the spread is narrow. This happens no matter where the final position is.



local init_direction = directionalCF.LookVector
		
spread_direction = CFrame.new(Vector3.new(), init_direction ) * (CFrame.Angles(math.rad(math.random(-maxAngle,maxAngle)),math.rad(math.random(-maxAngle,maxAngle)),0).LookVector))

For the raycasting I am using @EtiTheSpirit’s fast cast module. I don’t know if this is part of the issue but raycasting a projectile requires a directional vector as part of the code, so its hard to think thats where the problem is occuring.

Please help meh :pray:t6: :pray:t6: :pray:t6:

2 Likes

You can try with a vector instead of a CFrame, then you can rotate the bullet:

local Bullet = YourBullet
Bullet.CFrame = CFrame.new(StartPosition)*CFrame.Angles(math.rad(math.random(-maxAngle,maxAngle)),math.rad(math.random(-maxAngle,maxAngle)),0))
Spread_direction = Bullet.CFrame.LookVector