# Modeling a projectile's motion

fixed the bug, but the beam is only straight?

``````local curve0, curve1, cf1, cf2 = beamProjectile(Vector3.new(0, -game.Workspace.Gravity, 0), direction, game.Players.LocalPlayer.Character.HumanoidRootPart.Position, heldFor)
``````

Is there any way to increase the time taken, without increasing the height?

Bump.

Is there any way to increase the time taken, without increasing the height?

Been stumped on this for a while, your current inputs are the time it takes, and the target position. How would one switch it up to determine the velocity using the angle of velocity, and the target position. Im sure its probably very simple once you understand the maths behind it, but I don’t…

Not sure if this works perfectly, but from my testing I think it worked.

What it does is that it creates a custom gravity, which is determined from the vertex of the parabola (zero of its derivative) which is at the point (timeHalf, h).

The gravity is basically the `a` value of the parabola, so we can just get it from the vertex.

It then uses a VectorForce to have its own gravity.

`timeTaken` is obviously the time to reach the point
`h` is the maximum height that it reaches

``````local timeHalf = timeTaken/2
local g = Vector3.new(0,-2*h/timeHalf^2,0)
local v0 = (to - from - 0.5*g*timeTaken*timeTaken)/timeTaken;

-- give it custom gravity
local vf = Instance.new("VectorForce")
vf.ApplyAtCenterOfMass = true
local att = Instance.new("Attachment")
att.Parent = ball
vf.Attachment0 = att
vf.Force = Vector3.new(0, workspace.Gravity*ball.Mass,0) + g*ball.Mass
vf.Parent = ball

ball.AssemblyLinearVelocity = v0
``````

One issue is that if you make the timeTaken too long, it will look like a feather falling downward.

Hope this helps.

1 Like