Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Can someone tell me why this projectile is shooting sideways instead of forward?

I have attachments welded to this so effects spiral around it with the AngularVelocity, the effects spiral around it, but the projectile is going sideways instead of forward.

        local RootPart = character.HumanoidRootPart
	projectile.CFrame = CFrame.new(RootPart.CFrame.Position) 
	projectile.Parent = game.Workspace     
        local BA = Instance.new("BodyAngularVelocity", projectile)
	BA.maxTorque = Vector3.new(math.huge,math.huge,math.huge) 
	BA.AngularVelocity = RootPart.CFrame.lookVector*10                      
	local BV = Instance.new("BodyVelocity", projectile)
	BV.maxForce = Vector3.new(math.huge,math.huge,math.huge)
	BV.Velocity = projectile.CFrame.lookVector*100

1 answer

✓ Accepted answer

The problem is that on line 2 you are creating a new CFrame instance from the RootPart's position rather than it's CFrame. This creates a situation where the game's physics chooses a default axis to travel upon because a Position vector doesn't have any kind of rotational information like CFrame does.

To fix this, simply replace line 2 with

projectile.CFrame = RootPart.CFrame

Hope this helped! :)

2 comments

0

Ohhhh, thank you soooo soooo mcuh!!!! :) That worked!

0

"much" that is. I apparently type about as well as I script. haha Thanks again!!

This discussion is preserved as it was. New answers, comments, and votes are closed.