|
| 26 Mar 2016 05:26 PM |
Hi, I am a novice more or less at Lua code, and I have recently been coding a basic gun, firing bricks with Velocity. I know it may be in the interest of some to use a small movement every tenth of a second or so, but I believe the most efficient way to fire a bullet is with velocity. So I have indeed run into a problem, and it is that the bullet falls rather quickly. It is clearly an unrealistic rate for a bullet to fall, as the game does not account for aerodynamics. I came here to find out if anyone can help me find a way to stop the bullet from falling at all, so that I can do it manually. And, no, don't tell me to give the bullet Y velocity when I fire it, that, that'd be stupid... |
|
|
| Report Abuse |
|
|
YuriXI
|
  |
| Joined: 22 Sep 2012 |
| Total Posts: 92 |
|
|
| 26 Mar 2016 06:02 PM |
| You can change the gravity of the bullet. |
|
|
| Report Abuse |
|
|
| |
|
YuriXI
|
  |
| Joined: 22 Sep 2012 |
| Total Posts: 92 |
|
|
| 27 Mar 2016 10:30 AM |
...You asked how... THIS IS HOW! http://wiki.roblox.com/index.php?title=Gravity The wiki can actually be very useful. |
|
|
| Report Abuse |
|
|
|
| 27 Mar 2016 02:15 PM |
| Thanks for the help, I now know for sure to get help from professional d0uche bags. You are going to be very useful to many people when you grow up, sir. |
|
|
| Report Abuse |
|
|
| |
|
|
| 27 Mar 2016 02:18 PM |
| You know, there is such thing as firing a bullet UP, making this post that you told yourself you were oh so smart about COMPLETELY USELESS. Please, go to school then come back to me and try to be a smart A again. |
|
|
| Report Abuse |
|
|
| |
|
|
| 27 Mar 2016 03:40 PM |
| Holy cow what did they put in this kids easter basket today. Or did he even get one? |
|
|
| Report Abuse |
|
|
| |
|
|
| 27 Mar 2016 05:32 PM |
@BStandsForBuilding
Funny how idiotic children just think everyone else online is also a child... |
|
|
| Report Abuse |
|
|
Scerzy
|
  |
| Joined: 27 Dec 2010 |
| Total Posts: 1082 |
|
|
| 27 Mar 2016 05:35 PM |
Add a body force into the new instance that is a bullet with a BodyForce (0,196.2,0). This counteracts gravity and it makes it so that the bullet will travel in whichever direction it was fired.
|
|
|
| Report Abuse |
|
|
|
| 27 Mar 2016 05:46 PM |
@KillPowerAlex135
Why are you getting so angry? The first guy was just trying to help. e_e |
|
|
| Report Abuse |
|
|
YuriXI
|
  |
| Joined: 22 Sep 2012 |
| Total Posts: 92 |
|
|
| 27 Mar 2016 05:59 PM |
@Scerzy That was actually in the wiki page, I'm guessing KillPowerAlex135 didn't read the wiki page or is idiotic...... But considering how he's raging right now, it's the second option.
The wiki page wasn't wrong, KillPowerAlex135 just don't know what it means. |
|
|
| Report Abuse |
|
|
Scerzy
|
  |
| Joined: 27 Dec 2010 |
| Total Posts: 1082 |
|
|
| 27 Mar 2016 06:26 PM |
Oh yeah just checked the wiki page, looks like it is, just add a little line into the script under where you put bullet=Instance.new("part") force=Instance.new("BodyForce") force.Parent=bullet force.BodyForce=(0,192.2,0)
I know i didn't capitalize the properties right and it probably wouldn't work but you get the idea
Make sure you add a time limit and after the time is up or if it comes into contact with a surface the bullet disappears or the game would lag too much.
|
|
|
| Report Abuse |
|
|
|
| 27 Mar 2016 09:17 PM |
| Trust me moron, I know what it means, you just need to go to school, giving the bullet Y velocity will screw it up if you fire the bullet at all UP or DOWN, I am not firing a bullet only horizontally, idiot. Learn how to read. |
|
|
| Report Abuse |
|
|
|
| 27 Mar 2016 09:19 PM |
| Besides, if you knew anything about physical bullets instead of raycasting, you'd know that to do it right you'd be using lookVector, which makes it extremely difficult to change velocity of just one axis. |
|
|
| Report Abuse |
|
|
|
| 27 Mar 2016 09:20 PM |
@LoughDough
Because being an ignorant and arrogant smart A isn't helping for jack. |
|
|
| Report Abuse |
|
|
Scerzy
|
  |
| Joined: 27 Dec 2010 |
| Total Posts: 1082 |
|
|
| 27 Mar 2016 11:37 PM |
Actually no it would not. Giving a bullet Y velocity would counteract the force that is already acting on it in the Y direction: Gravity. If you cancel them both out then there are no forces acting in the Y direction and the bullet will only register the force you apply when shooting it. It's elementary physics.
|
|
|
| Report Abuse |
|
|
YuriXI
|
  |
| Joined: 22 Sep 2012 |
| Total Posts: 92 |
|
|
| 28 Mar 2016 06:39 AM |
@KilllerPowerAlex135 You mad? |
|
|
| Report Abuse |
|
|
|
| 28 Mar 2016 01:08 PM |
| If it WERE elementary physics you'd know how this method screws up the bullet. If I counteract the gravity entirely it will never fall, if I give the bullet additional velocity it will travel higher than normal as it already HAS velocity counteracting gravity as it travels UP. I am done with this conversation. none of you are helpful. |
|
|
| Report Abuse |
|
|
YuriXI
|
  |
| Joined: 22 Sep 2012 |
| Total Posts: 92 |
|
|
| 28 Mar 2016 03:11 PM |
Imma sum this thread up.
Guy asks for help. Two people try to help. Guy rages. Guy calls other people names. Guy leaves. |
|
|
| Report Abuse |
|
|
wayne2018
|
  |
| Joined: 04 Jun 2014 |
| Total Posts: 2509 |
|
|
| 28 Mar 2016 03:13 PM |
| This guy has some anger issues... |
|
|
| Report Abuse |
|
|
Scerzy
|
  |
| Joined: 27 Dec 2010 |
| Total Posts: 1082 |
|
|
| 28 Mar 2016 05:00 PM |
Well I just tested it in my studio and it worked. If it makes your bullet fly higher than usual then your script is interfering with it, all you have to do is lower the force. Once again it's elementary physics, just find the right balance through trial and error.
|
|
|
| Report Abuse |
|
|
|
| 28 Mar 2016 06:15 PM |
| If you are going to talk about physics don't use the phrase trial and error. I am pretty sure that I explained previously that I used lookVector to assign the velocity, which makes it pretty clear that even IF the method didn't make the bullet fly higher, it would be extremely difficult to do this. I switched to raycast anyway. |
|
|
| Report Abuse |
|
|