Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I throw in Roblox?

Asked by 10 years ago

So, how would I make a throwing script, for like grenades and C4 and stuff?

0
Please ask a real quesiton. Teeter11 281 — 10y

4 answers

Log in to vote
2
Answered by
LevelKap 114
10 years ago

You would need to make an animation using welds and CFrame.

Ad
Log in to vote
0
Answered by 10 years ago

Like LevelKap said you need animations. After the animations you need to give the grenade a bodyobject of some sort (BodyVelocity,BodyPosition) and make it to the relative direction you are facing. Then you need to make an explode script to go inside the grenade. What you're asking for is not a complex script nor is it a simple script.

Log in to vote
0
Answered by 10 years ago

I would suggest just using the Animation Editor and detect when the player clicks with the tool grenade or something out, to play the animation.

Log in to vote
0
Answered by 4 years ago

Well, in physics, there are multiple formulas for the topic of trajectories. I'm assuming what you're looking for is the X and Y position of the projectile after a given time, given the angle of launch and the initial velocity.

First you need to find the velocity components for the X and Y values.

Vi = Initial Velocity

A = Angle of Launch

Vx = Vi * cos(A)

Vy = Vi * sin(A)

Now that we have the velocities in the X and Y directions, we can use that to get the position of a projectile after a specific amount of time.

T = Time in seconds

G = 196.2 (This is the acceleration due to gravity in roblox. In the real world, it's 9.81)

Px = Vx * T

Py = Vy * T - (0.5 * G * T^2)

Now we know the X and Y positions of a projectile at a given time.

You can use this to move a projectile by incrementing the time by small amounts and then positioning the projectile at the calculated location, or you can use this to predict the path of a projectile.

Hope this helped!

Further resources: Projectile Motion

0
You just copied and pasted from another forum. Trollapse 89 — 4y

Answer this question