Hey I’ve got a weird issue going on with FastCast. I’m replacing my current system with it, but I’ve run into an issue that’s making it impossible currently. I’ve based it off the code from the example blaster you gave. Here’s my code:
EDIT: Bottom two lines are part of the script, but I couldn’t get it to past correctly. self.HitP is equivalent to
(Mouse.Hit.p - FirePointObject.WorldPosition).Unit
local Caster = FastCast.new() --Create a new caster object.
FastCast.VisualizeCasts = true
local directionalCF = CFrame.new(Vector3.new(), self.HitP)
local RNG = Random.new()
local TAU = math.pi * 2
self.HitP = (directionalCF * CFrame.fromOrientation(0, 0, RNG:NextNumber(0, TAU)) * CFrame.fromOrientation(math.rad(RNG:NextNumber(0, 0.5)), 0, 0)).LookVector
print(self.HitP)
local modifiedBulletSpeed = (self.HitP * 200) + self.Player.Character.HumanoidRootPart.Velocity;
self.Projectile.CFrame = CFrame.new(self.Player.Character.Weapon.Barrel.Attach.WorldPosition, self.Player.Character.Weapon.Barrel.Attach.WorldPosition + self.HitP)
self.Projectile.Parent = workspace.Projectiles;
Caster:Fire(self.Player.Character.Weapon.Barrel.Attach.WorldPosition, self.HitP * 1000, modifiedBulletSpeed, self.Projectile, self.Player.Character, false, Vector3.new(0,0,0));
Caster.LengthChanged:Connect(function(castOrigin, segmentOrigin, segmentDirection, length, cosmeticBulletObject)
local bulletLength = self.Projectile.Size.Z / 2 -- This is used to move the bullet to the right spot based on a CFrame offset
local baseCFrame = CFrame.new(segmentOrigin, segmentOrigin + segmentDirection)
self.Projectile.CFrame = baseCFrame * CFrame.new(0, 0, -(length - bulletLength))
end)
Caster.RayHit:Connect(onHit);
EDIT2: It seems to happen whenever the mouse is pointed at an object. That is, if I point towards a wall, it will go up. If I point towards the sky, it goes normally.
Basically, depending on which way the character’s is pointing, if it’s pointing down towards a baseplate, the rocket instead of shooting straight forward will shoot up at an angle. That’s not a behavior I want - i’d rather it go to the ground, even if that means it makes contact and explodes right away. I’ve attached a video belowrobloxapp-20200626-1302033.wmv (2.0 MB)