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
 

Re: Grenade physics

Previous Thread :: Next Thread 
affectless is not online. affectless
Joined: 28 Dec 2014
Total Posts: 1084
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
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
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
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
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
affectless is not online. affectless
Joined: 28 Dec 2014
Total Posts: 1084
22 Jan 2015 08:41 PM
Thanks I'll try this
Report Abuse
affectless is not online. affectless
Joined: 28 Dec 2014
Total Posts: 1084
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
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
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
affectless is not online. affectless
Joined: 28 Dec 2014
Total Posts: 1084
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
affectless is not online. affectless
Joined: 28 Dec 2014
Total Posts: 1084
22 Jan 2015 09:05 PM
I just realized that would look really crappy.
Report Abuse
128GB is not online. 128GB
Joined: 17 Apr 2014
Total Posts: 8056
22 Jan 2015 09:07 PM
http://www.roblox.com/item.aspx?id=206909706
Report Abuse
affectless is not online. affectless
Joined: 28 Dec 2014
Total Posts: 1084
22 Jan 2015 09:13 PM
@128: Could I use the math you have there to CFrame?
Report Abuse
128GB is not online. 128GB
Joined: 17 Apr 2014
Total Posts: 8056
22 Jan 2015 11:11 PM
No
Report Abuse
affectless is not online. affectless
Joined: 28 Dec 2014
Total Posts: 1084
23 Jan 2015 05:58 PM
i understand
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