tag:blogger.com,1999:blog-6433256125895820613.post1162222558146624237..comments2024-02-08T13:00:24.585-08:00Comments on Mommy's Best Games' Dev log: Grenade Throw EquationNathan Foutshttp://www.blogger.com/profile/04088421053683726036noreply@blogger.comBlogger9125tag:blogger.com,1999:blog-6433256125895820613.post-65181565829137538832012-08-09T17:52:35.636-07:002012-08-09T17:52:35.636-07:00===3D VERSION===
@jeffrey
It's almost the sam...===3D VERSION===<br /><br />@jeffrey<br />It's almost the same, but you have to account for the Z component. That means treat it just like the X. <br />(Assuming that Y is your up/down direction). <br />In that case, X and Z are just moving around on the ground (not up/down). <br /><br />So use a Vector3 instead. <br />Vector3 diff = (targetPos - throwPos);<br /> Vector3 grenadeVel;<br /><br /> startVel.X = (diff.X) / travelTime;<br /><br /> startVel.Y = (diff.Y - 0.5f * Grenade.gravityY * flyTime* flyTime) / flyTime;<br /><br /> startVel.Z = (diff.Z) / travelTime;<br /><br />Make sense?Nathan Foutshttps://www.blogger.com/profile/04088421053683726036noreply@blogger.comtag:blogger.com,1999:blog-6433256125895820613.post-41000603804910963002012-08-09T14:44:35.515-07:002012-08-09T14:44:35.515-07:00This comment has been removed by the author.jefferyhttps://www.blogger.com/profile/12046441613938469986noreply@blogger.comtag:blogger.com,1999:blog-6433256125895820613.post-72702777039645543612012-08-09T14:44:15.773-07:002012-08-09T14:44:15.773-07:00how do you do this in 3d and find out the ending p...how do you do this in 3d and find out the ending position though?jefferyhttps://www.blogger.com/profile/12046441613938469986noreply@blogger.comtag:blogger.com,1999:blog-6433256125895820613.post-7281313533834844952010-09-20T13:21:54.175-07:002010-09-20T13:21:54.175-07:00We did a very simple and fast raycasting algorithm...We did a very simple and fast raycasting algorithm for polygon objects for our game ToyBorgs: http://www.youtube.com/watch?v=O2Tbx0BTrnQ (watch the bots)<br /><br />May be we could share this too.<br /><br />btw: An ingame video of our game:<br />http://www.youtube.com/watch?v=l2ZAMQlNIYU<br /><br />I am very interested in seeing more infos like that from you. Thanks for sharing :)addmore gameshttp://www.addmoregames.denoreply@blogger.comtag:blogger.com,1999:blog-6433256125895820613.post-30841343874109820302010-09-19T12:38:51.170-07:002010-09-19T12:38:51.170-07:00Ohhh
Looks like I should have read the whole post...Ohhh<br /><br />Looks like I should have read the whole post before commenting X(Danielnoreply@blogger.comtag:blogger.com,1999:blog-6433256125895820613.post-52803557377058356982010-09-18T19:27:40.844-07:002010-09-18T19:27:40.844-07:00CJ Currie,
This equation gets you the starting vel...CJ Currie,<br />This equation gets you the starting velocity (a vector). From this you can calculate the starting angle (if you need it to rotate a gun to face the vector for instance). You can get the angle with arc tangent as such:<br />newAng = Math.Atan2(dir.Y, dir.X);<br /><br />Daniel,<br />C# is pretty fast in terms of development.<br />This game is called Explosionade (the image with the grenade shot is a close up of the game.) <br />Good luck with school!Nathan Foutshttps://www.blogger.com/profile/04088421053683726036noreply@blogger.comtag:blogger.com,1999:blog-6433256125895820613.post-45326973309403808162010-09-18T19:22:31.231-07:002010-09-18T19:22:31.231-07:00Hmmmm...
I'm currently learning C++ during bre...Hmmmm...<br />I'm currently learning C++ during breaks in my University courses, seeing all this C# makes me wonder who hard will it be to switch between the two...<br /><br />On the other hand I can't wait to see your new game! Are the screens from it? Or is it just Grapple Buggy?Danielnoreply@blogger.comtag:blogger.com,1999:blog-6433256125895820613.post-46623023934325817972010-09-18T10:51:51.180-07:002010-09-18T10:51:51.180-07:00Never mind... for a moment it looked like you were...Never mind... for a moment it looked like you were using the Unity3D engine, but I may be wrong. The basis of my question still stands... more extrapolation, please.CJ Curriehttp://cjcurrie.netnoreply@blogger.comtag:blogger.com,1999:blog-6433256125895820613.post-77155082904943854272010-09-18T10:34:16.235-07:002010-09-18T10:34:16.235-07:00Are you using physics and ForeceMode.VelocityChang...Are you using physics and ForeceMode.VelocityChange? If so, what do you use for the starting angle?CJ Curriehttp://cjcurrie.netnoreply@blogger.com