I’m trying to add a shell-eject effect whenever you shoot a gun. However, while moving in the direction of where the bullet is to be ejected, it goes the other way.
Function that handles the shells ;
ClientEffects.ShellEject = function(Character, Tool, Position, Velocity)
local Shell = ReplicatedStorage.Assets.Misc.Shell:Clone()
Shell.Parent = workspace.Effects
Shell.Position = Position
Shell.AssemblyAngularVelocity = Vector3.new(10,10,10)
local BodyVelocity = Instance.new("BodyVelocity", Shell)
BodyVelocity.Name = "EjectVelocity"
BodyVelocity.Velocity = Velocity
Code that handles the positions ;
FirePosition = Camera.ViewModel.Tool.Handle.FirePosition.WorldPosition :: Vector3
ShellVelocity = Camera.ViewModel.Tool.Handle.ShellEjectPosition.WorldCFrame.LookVector * 10
ShellOrigin = Camera.ViewModel.Tool.Handle.ShellEjectPosition.WorldPosition
GIF showcasing the issue ;
If this is just meant to be viewed in first person, I think you could easily get away with just using particles and enabling the locked to part property.
If you still want to use parts you could also make the assemblyangularvelocity match that of the players so it moves with the player (but increase it in the direction u want it to go)
Alternatively you could simply just make it shoot farther if the characters assemblylinearvelocity is going towards the opposite direction.
Hope this helps.
Yeah, I dont really want to resort to particles for this.
Most FPS games already have a solution for this and I may be overcomplicating it by a lot. I’ve tried changing the velocity depending on the direction but it was quite inaccurate and I feel like there may be a better method for this. I will try it again though. I also read alot of other forums and none of them have worked for me so far.
I understand. Especially if u want the casings to be left on the ground for a little bit.
I remember having this same exact issue with shell casings but I dont remember what I did to fix it.
I’m pretty sure I may have done this or simply just increased the velocity in which it shoots out. I think you can get your desired effect if you play around with it more.
I’ve done this but the part is just moving way too fast if I increase the velocity too much.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.