|
| 22 Jan 2015 08:31 PM |
I have this whole grenade thing going on and I currently use velocity to move the grenade to simulate an actual throw but I now realize this will not do for many aesthetic and function-oriented reasons.
I need to CFrame the GHandle (grenade handle) along a realistically curved path and end the CFrame when GHandle experiences a Touched event.
halp |
|
|
| Report Abuse |
|
|
|
| 22 Jan 2015 08:39 PM |
Start it by setting a Vector3 to represent velocity. Set a variable representing previous position equal to the velocity. Do a loop, in which you will add the velocity to the previous position, and send a ray between those points. If you get a hit, get the final position and stop the loop. If you don't get a hit on the ray, set previous position equal to the added velocity to previous position, as you used earlier. Wait for an amount of time. End the loop.
If you want to make it easier in the future, you can apply some long but not-complicated math so that you calculate it in studs per second. That is harder though because you are waiting in between each calculation, so the velocity is not already in studs per second. |
|
|
| Report Abuse |
|
|
|
| 22 Jan 2015 08:40 PM |
Okay, forget that. The math isn't that long either. I don't remember what it was that I was doing with rays that made the math complicated.
Also, look up Verlet Integration, it is similar or the same. |
|
|
| Report Abuse |
|
|
| |
|
|
| 22 Jan 2015 08:54 PM |
| Couldn't I just move the grenade along the Head's lookVector while decrementing the Y axis? |
|
|
| Report Abuse |
|
|
|
| 22 Jan 2015 08:57 PM |
Oh, I forgot to mention. Each loop you need to subtract gravity from the Y vector of the velocity.
Well you could do that, but that wouldn't get you a parabola. You need to change the angle, which is what I have done. Okay, mine wasn't the angle directly, but it is actually how I would have done it in physics class. |
|
|
| Report Abuse |
|
|
|
| 22 Jan 2015 09:02 PM |
I could increment then decrement.
I feel like it would save me some time though. I haven't gotten that far in physics class yet. |
|
|
| Report Abuse |
|
|
|
| 22 Jan 2015 09:05 PM |
| I just realized that would look really crappy. |
|
|
| Report Abuse |
|
|
128GB
|
  |
| Joined: 17 Apr 2014 |
| Total Posts: 8056 |
|
|
| 22 Jan 2015 09:07 PM |
| http://www.roblox.com/item.aspx?id=206909706 |
|
|
| Report Abuse |
|
|
|
| 22 Jan 2015 09:13 PM |
| @128: Could I use the math you have there to CFrame? |
|
|
| Report Abuse |
|
|
128GB
|
  |
| Joined: 17 Apr 2014 |
| Total Posts: 8056 |
|
| |
|
| |
|