#Better ways to physically control projectiles?
32 messages · Page 1 of 1 (latest)
Show script
if requestInfo then
local projLaser=Instance.new('Part',workspace)
--projLaser.CanCollide=false projLaser.CanQuery=false
projLaser.Color=Color3.fromRGB(226, 93, 95)--projLaser.Color=Color3.fromRGB(82, 124, 174)
projLaser.Material=Enum.Material.Neon
projLaser.Size=Vector3.new(0.5,0.5,3)
projLaser.CFrame=requestInfo[2]
projLaser.CFrame=CFrame.lookAt(projLaser.Position,requestInfo[1].p)
local upforce = Instance.new("BodyForce")
upforce.force = Vector3.new(0, projLaser:GetMass() * game.Workspace.Gravity-ToolConfig[8], 0)
upforce.Parent = projLaser
projLaser:ApplyImpulse(projLaser.CFrame.LookVector*300)
end
@alpine yew I wont be able to respond until 3-4 PM WST
Hello there, I noticed that you are using BodyMovers on that projectile, and that makes the projectile run using the roblox physics handler. The Split Second Freeze happens because ROBLOX is auto managing the NetworkOwnership of the projectile
If you'd like to fix that, you could use the method SetNetworkOwnership(nil) available on BaseParts
Call it on the part as soon as you create it, and hopefully it will fix the delay
I don't have the API documentation of SetNetworkOwnership on me right now, but you can find more info about it on the API
If SetNetworkOwnership(nil) doesnt work, try using SetNetworkOwnership(Player)
** You are now Level 1! **
Also, avoid Instance.new(InstanceName, Parent), instead try to parent the projectile to workspace only once you finish setting up all of it's properties
Ok so i set the Ownership to nil and gave me the same result and when i set the Ownership to Player it, It seems as if :ApplyImpulse() doesnt work
any reasons to why its doing this @worthy karma
I'm not sure, but I have one guess
are you parenting the part to workspace prior to the SetNetworkOwnership call
I wasnt but i figured out why
Apparently you need to constantly set it
which is what i did and it worked
but when the part is out of the clients render, the part freezes
well you shouldn't need to call SetNetworkOwnership multiple times
this is bad for the networking and for physics emulation ya
well personally I'd avoid physics controlled projectiles
i'd rather use fastcast and run the projectile with raycasting
but since you've asked, the last time I mad a physics-controlled projectile was by 2017, when BodyVelocity wasn't deprecated. I had the same problem as you, and I think I fixed it by using SetNetworkOwnership and pre-generating Parts & BodyMovers when the script was initialized. These 'TemplateParts' and 'TemplateBodyMovers' were then cloned per request afterwards, speeding up the script
hmm
Maybe i wont physically control the projectile
any guides on the internet that control projectiles without physics and have a smooth trajectory
that you know of
well, there is the FastCast module, it's really good
You can straight up simply google it and find it, it's an open source asset for roblox
If you don't want to use FastCast, you can CFrame projectiles on the server using math, and then tell the clients to interpolate the projectile's position according to it's velocity, acceleration and other properties