|
| 30 Jul 2012 12:01 PM |
Hi, guys. So, in the standard paintball script that Roblox uses, a weapon's fired through function(fire)which describes, uh... firing the weapon. However, the part of the script that describes AIMING the weapon is as follows;
local targetPos = humanoid.TargetPoint local lookAt = (targetPos - character.Head.Position).unit
At which point there's a part of the script which makes it so when you click the mouse you fire at lookAt. All very good.
My question to you guys is this; is there an alternative method other than using humanoid.TargetPoint to get the coordinates to where your character is pointing his cursor? I don't care if they're obscure or really random; I'd like to see as many alternatives as possible. |
|
|
| Report Abuse |
|
|
|
| 30 Jul 2012 12:26 PM |
| Oh, come on. Someone has to know. |
|
|
| Report Abuse |
|
|
| |
|
Dr01d3k4
|
  |
| Joined: 11 Oct 2007 |
| Total Posts: 17916 |
|
|
| 30 Jul 2012 01:37 PM |
| Location of mouse in 3d space = mouse.Hit. That returns a CFrame value so for position, use mouse.Hit.p. |
|
|
| Report Abuse |
|
|
|
| 30 Jul 2012 02:07 PM |
| Hrm. And how would I access mouse.Hit if I were trying to get to it from outside the tool? |
|
|
| Report Abuse |
|
|
Dr01d3k4
|
  |
| Joined: 11 Oct 2007 |
| Total Posts: 17916 |
|
|
| 30 Jul 2012 02:08 PM |
| I don't know if that's possible... D: |
|
|
| Report Abuse |
|
|
|
| 30 Jul 2012 02:10 PM |
...Darn. So, then, are there any OTHER alternatives to using mouse.Hit or Targetpoint?
This is a lot harder than I expected. |
|
|
| Report Abuse |
|
|
|
| 30 Jul 2012 02:12 PM |
| It is, just really difficult. Add a GUI that takes up the entire screen. Use the MouseEnter event to get the mouse's coordinates. Use some complicated math to find out where thet is in the game. Find what's at that position. And there you have it. I remember seeing a forum about this that was trying to have a GUI follow a person in the game. Might wanna look that up and find it. |
|
|
| Report Abuse |
|
|
|
| 30 Jul 2012 02:16 PM |
One way is to make them equip a HopperBin to teleport to a spawn point and then change the parent of the HopperBin to nil. You'll get mouse.Hit access for eternity!
Or until they die I think.
--BrandonFireflower, LuaLearners Writer and president of the Exodus Task Force. |
|
|
| Report Abuse |
|
|
|
| 30 Jul 2012 02:17 PM |
...Well, that wouldn't work for my purposes either.
This is rapidly descending into insanity. Are there any other alternatives beyond THAT? If not, I'm gonna have to use mouse.Hit to change a Vector3 value that's then going to be referenced by another script, resulting in what is colloquially known as "wailing and gnashing of teeth." -_- |
|
|
| Report Abuse |
|
|