-- @Context Client
-- Send a request to the server for a projectile to be created.
-- @param WeaponDefinition weaponDefinition
-- @param Vector3 position
-- @param Vector3 direction

function ProjectileReplication.SendProjectile(weaponDefinition, position, direction)
	--print("Sending projectile!",weaponDefinition,position,direction)
	
	local clientRaycastParams = RaycastParams.new()
	clientRaycastParams.FilterType = Enum.RaycastFilterType.Blacklist
	
	-- Ignore the character and the camera which has the first person view model attached
	clientRaycastParams.FilterDescendantsInstances = {
		Local_Player.Character,
		workspace.CurrentCamera,
	}

	local hitResult = workspace:Raycast(position,direction*99999,clientRaycastParams)
	
	local hitCharacter = nil
	
	if hitResult then
		hitCharacter = PartUtility.GetCharacterFromInstance_R(hitResult.Instance)
	end
	
	-- Send to server the request to create the projectile
	RE_CreateProjectile:FireServer(weaponDefinition:GetIDName(), position, direction, hitCharacter)
	
	return hitResult
end
