generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

I want to make accurate gun ballistics

Previous Thread :: Next Thread 
MrJoeyJoeJoey is not online. MrJoeyJoeJoey
Joined: 20 Aug 2011
Total Posts: 20787
12 Dec 2016 04:44 PM
Are there any examples of how to find the proper ballistics bullet travel? With angle of course.
Report Abuse
SwifterZee is not online. SwifterZee
Joined: 04 Apr 2015
Total Posts: 1010
12 Dec 2016 04:45 PM
free models
Report Abuse
MrJoeyJoeJoey is not online. MrJoeyJoeJoey
Joined: 20 Aug 2011
Total Posts: 20787
12 Dec 2016 04:47 PM
1. I doubt they they would have accurate anything
2. I'm looking for more math sided instead of "here it is" lua code
Report Abuse
Pxkez is not online. Pxkez
Joined: 24 Sep 2015
Total Posts: 1066
12 Dec 2016 04:48 PM
search "Dot Product" on roblox wiki


~Help me u dirty cookie
Report Abuse
MrJoeyJoeJoey is not online. MrJoeyJoeJoey
Joined: 20 Aug 2011
Total Posts: 20787
12 Dec 2016 04:52 PM
Well I know i can get the angle from that, thanks actully. I have no idea how to incorporate it though.
Report Abuse
Pxkez is not online. Pxkez
Joined: 24 Sep 2015
Total Posts: 1066
12 Dec 2016 04:55 PM
local tool = script.Parent
local handle = tool:WaitForChild("Handle")

function reflect(input, normal)
-- using dot method b/c vector3
return -2 * input:Dot(normal) * normal + input
end

function drawray(ray, parent)
local part = Instance.new("Part")
part.Material = Enum.Material.Neon
part.Size = Vector3.new(.2, .2, ray.Direction.magnitude)
part.CFrame = CFrame.new(ray.Origin + ray.Direction/2, ray.Origin + ray.Direction)
part.Anchored = true
part.CanCollide = false
part.BrickColor = BrickColor.new("Bright red")
part.Parent = parent or game.Workspace.CurrentCamera
return part
end

function fire(from, to, bounce)
local bounce = bounce or 0
if bounce <= 5 then -- how many times can it reflect
-- first ray is to calculate distance and normal
local ray = Ray.new(from, (to - from).unit * 500)
local hit, pos, normal = ga#################################o############
-- this is the actual ray we use and draw
local ray2 = Ra####################rom))
local part = drawray(ray2, tool)

-- throw out the laser beam later
game:GetService("Debris"):AddItem(part, 2)

-- calculate the reflected ray
local ref = reflect((pos - from), normal)
if hit then
local hum = hit.Parent:FindFirstChild("Humanoid")
if hum then
hum:TakeDamage(math.random(10, 15))
end
-- shoot a ray in the reflected position
fi#########o### ref, bounce + 1)
end
end
end

script.Parent.Equipped:connect(function(mouse)
mouse.TargetFilter = game.Workspace
script.Parent.Activated:connect(function()
fire(handle.CFrame.p, mouse.Hit.p)
end)
end)

this was on the wiki, if u want it to reflect only once then just make sure it doesnt run "fire" twice


~Help me u dirty cookie
Report Abuse
MrJoeyJoeJoey is not online. MrJoeyJoeJoey
Joined: 20 Aug 2011
Total Posts: 20787
12 Dec 2016 05:01 PM
I don't think you know what Im talking about, because I dont actually want it to bounce.
Report Abuse
Pxkez is not online. Pxkez
Joined: 24 Sep 2015
Total Posts: 1066
12 Dec 2016 05:09 PM
oh, how to find it?



~Help me u dirty cookie
Report Abuse
MrJoeyJoeJoey is not online. MrJoeyJoeJoey
Joined: 20 Aug 2011
Total Posts: 20787
12 Dec 2016 05:24 PM
####################################################################################################################################################################################################################################################
Report Abuse
MrJoeyJoeJoey is not online. MrJoeyJoeJoey
Joined: 20 Aug 2011
Total Posts: 20787
12 Dec 2016 05:24 PM
######################################################################################################################################################################################
Report Abuse
MrJoeyJoeJoey is not online. MrJoeyJoeJoey
Joined: 20 Aug 2011
Total Posts: 20787
12 Dec 2016 06:31 PM
Run this code in any server script

pastebin
/
8BqfGRVG
Report Abuse
sircfenner is not online. sircfenner
Joined: 29 Aug 2008
Total Posts: 2430
12 Dec 2016 06:35 PM
Have a look at VolcanoINC's ProjectileLibrary.

https://www.roblox.com/library/370071622/ProjectileLib
Report Abuse
MrJoeyJoeJoey is not online. MrJoeyJoeJoey
Joined: 20 Aug 2011
Total Posts: 20787
12 Dec 2016 06:46 PM
That looks terribly messy
Report Abuse
TeslaMotors is not online. TeslaMotors
Joined: 11 May 2013
Total Posts: 437
12 Dec 2016 06:48 PM
Create a formula and plug in values, like in math class.
Report Abuse
MrJoeyJoeJoey is not online. MrJoeyJoeJoey
Joined: 20 Aug 2011
Total Posts: 20787
12 Dec 2016 07:07 PM
Well I mean that is the obvious goal lmao. The problem is how to manipulate those values
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image