|
| 17 May 2014 12:41 PM |
| Could this be Changed -b.Position = mouse.Hit.p- to -b.Position = Tool.Focus-? Cos I was testing a Gun in one of my Accounts, and it didn't work out well, am not sure though if thats cos of that line or not, but am asking guys, cos I dont want the Bullets to go were the Mouse is pointing... its so unrealistic! |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 17 May 2014 12:48 PM |
| Just change it to: barrel.CFrame.lookVector * scalar |
|
|
| Report Abuse |
|
|
|
| 17 May 2014 12:54 PM |
| thnx, also, u 100% sure it will work? and so, I have to insert *3 for lookvector so that its the Front Face thats used, am I right? |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 17 May 2014 12:56 PM |
| lookVector already gives you the direction the front face is pointing at, but as a unit vector, you multiply that by some number to make it go the far/travel that fast (depends if you are using velocity or not) |
|
|
| Report Abuse |
|
|
|
| 17 May 2014 01:05 PM |
| hmmm... strange, sure in the wiki were I got it, it said Vector3.new(0, 10, 0) then is this just multiplying the vector speed by the *50? |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 17 May 2014 01:07 PM |
| Vector3.new(0, 10, 0) is just a regular vector, the directional vector for that would be Vector3.new(0, 1, 0). multiplying 50 (or -50, which ever you wanted) will just make the first one: Vector3.new(0, 500 (or -500), 0) and the second one Vector3.new(0, 50 (or -50), 0) |
|
|
| Report Abuse |
|
|
|
| 17 May 2014 01:13 PM |
| lol... again so sry, but it sounds really complicating... |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 17 May 2014 01:18 PM |
Okay so Magnitude gets the length of the vector (I'm sure you know what the Pythagorean theorem is?)
magnitude = squareroot(x^2 + y^2 + z^2)
And Unit divides the vector in a way that makes the magnitude equal to 1.
unit = (x/magnitude, y/magnitude, z/magnitude)
Since a vector is simply direction AND length, it would just be: direction * distance.
vector (which is length and direction) = direction * length See that? So direction = vector/length (aka x/length, y/length, z/length) |
|
|
| Report Abuse |
|
|
|
| 17 May 2014 01:24 PM |
| hmmm... am still confused :/ anyway, is it like the Rotation of the Bullet? |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 17 May 2014 01:31 PM |
No. This is easier to understand with a graph. So I'll make it in 2D (it works the same way in 3D)
Here's something I made real quickly with some image of a graph I found online: prntscr/3k371b |
|
|
| Report Abuse |
|
|
|
| 17 May 2014 01:34 PM |
| I still cant seem to get it all into my Head :'( |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 17 May 2014 01:36 PM |
Okay, so magnitude is a simple number (in that case is the square root of 389) And you know a vector is "direction AND length" So:
vector = direction * length (10, 17) = direction * sqrt(389) direction = (10/sqrt(389), 17/sqrt(389))
To get direction, you just isolate it, divide by the magnitude. So unit = vector/magnitude |
|
|
| Report Abuse |
|
|
|
| 17 May 2014 01:40 PM |
| still sounds complicating, but I think am Getting it slowly... |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 17 May 2014 01:47 PM |
Okay, so a Vector is simple direction and length. But let's go more basic.
Direction is just direction, like "right" or "left" Length is just the size of something, so the length of 5 is 5, length of -5 is 5.
However, in 2D+, the amount of directions increase (so you get up, right, left, down) then in 3D, you get (up, left, right, down, forward, backwards)
So a unit vector like: (0, 0, 1) is direction "backwards" and length 1 So a regular vector like: (0, 1, 1) is direction "up and backwards" with the length of sqrt(2) [because length = sqrt(x^2 + y^2 + ...) depending on how many dimensions you are in]
So the unit vector for (0, 1, 1) would be (0, 1/sqrt(2), 1/sqrt(2)) which is ABOUT (0, 0.707, 0.707) |
|
|
| Report Abuse |
|
|
|
| 17 May 2014 01:50 PM |
| lol never seen anyone talk like that on Roblox except for u... I feel like such a Scripting Noob right now cos of this lol... |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 17 May 2014 01:54 PM |
| khanacademy DOT org/science/physics/one-dimensional-motion/displacement-velocity-time/v/introduction-to-vectors-and-scalars |
|
|
| Report Abuse |
|
|
|
| 17 May 2014 02:09 PM |
| lol I think am done Researching right now... I have failed the Test, and I admit it... thnx for trying to get me to understand, but nothing's working... u can now feel free to stop posting... |
|
|
| Report Abuse |
|
|