Casing Ejection Acting Weird

I have a simple casing ejection module for some VR guns, but it works nowhere near how it should.
The issue:

How it should work:
Pistol Firing GIF - Find & Share on GIPHY

Emitter function:

	local function EmitParticle(cframe: CFrame)
		local particle = part:Clone()
		particle.CFrame = cframe*offset
		particle.Parent = workspace
		particle.Transparency = 0
		particle.Anchored = false
		particle.Velocity = cframe:VectorToWorldSpace(velocity+Vector3.new(math.random(-gainMax.X,gainMax.X),math.random(-gainMax.Y,gainMax.Y),math.random(-gainMax.Z,gainMax.Z)))
		particle.RotVelocity = angularVelocity
		AddSounds(particle)
		debris:AddItem(particle,lifetime)
	end

-gainMax.X is sending the casings backwards

It was an easy fix. I forgot to make the casings not collide with the gun.

Hey, unrelated but what are you using any VR modules to make it work like that? I want to get into VR development but don’t really know what to use.

Everything here is custom made. I would recommend learning about UserInputService:GetUserCFrame() and Quaternions. It’s actually pretty straightforward when though about correctly.

Nice, thanks a lot!

ignore this

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.