|
| 04 Mar 2017 11:07 AM |
I'm so lost how to make this ball float. On the touch of a player i just want it to float up a tad toward their direction they hit it from and go down, JUST A TAD
ugh |
|
|
| Report Abuse |
|
|
| |
|
|
| 04 Mar 2017 11:14 AM |
What exactly do you mean with "float up toward their direction".
Do you want to make it float straight up or at an angle towards the user? |
|
|
| Report Abuse |
|
|
|
| 04 Mar 2017 11:16 AM |
| whatever way they hit it upward a tad but then it will fall |
|
|
| Report Abuse |
|
|
|
| 04 Mar 2017 11:18 AM |
| Alright, so when I come from the south, the ball flies up towards the north and goes down just after? |
|
|
| Report Abuse |
|
|
|
| 04 Mar 2017 11:20 AM |
| yes, it's sorta like a lesser gravity ball but not even close to no gravity, it just flioats |
|
|
| Report Abuse |
|
|
|
| 04 Mar 2017 11:22 AM |
The basic idea of that would be as soon as the user hits the ball, check the magnitude between the ball and the torso of the human. The magnitude is basically the length of a vector. Even better would be to take the unit, this is a normalized version of the magnitude so you can multiply it for accurate results.
After that you'd have to invert the unit because you want the ball to fly the opposite direction.
Then make a BodyThrust object and set the force to the value of the unit you calculated. |
|
|
| Report Abuse |
|
|
|
| 04 Mar 2017 11:25 AM |
| Can u code it I'm confused |
|
|
| Report Abuse |
|
|
| |
|
| |
|
| |
|
|
| 04 Mar 2017 11:35 AM |
Something like this, I haven't tested it so it may not work:
script.Parent.Touched:connect(function(other) if other.Parent:FindFirstChild("HumanoidRootPart") then local unit = (script.Parent.Position - other.Parent.HumanoidRootPart.Position).unit local inverse = CFrame.new(unit):inverse() script.Parent.BodyThrust.Force = inverse end end) |
|
|
| Report Abuse |
|
|
| |
|
|
| 04 Mar 2017 11:39 AM |
| Yeah I made a mistake, BodyThrust.Force is a vector, not a cframe: Use this instead and change out BodyThrust ### # ######### script.Parent.BodyForce.Force = Vector3.new(inverse.X, inverse.Y, inverse.Z) |
|
|
| Report Abuse |
|
|
|
| 04 Mar 2017 11:40 AM |
| Also, put this script inside the ball and place a BodyForce object under the ball aswell. |
|
|
| Report Abuse |
|
|
| |
|
| |
|
|
| 04 Mar 2017 11:48 AM |
| Instead of posting "IT DOESN'T WORK" or "error error" it would be more useful if you posted what error ... |
|
|
| Report Abuse |
|
|