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 » Scripting Helpers
Home Search
 

Re: Getting an object to point where the mouse is?

Previous Thread :: Next Thread 
digpoe is not online. digpoe
Joined: 02 Nov 2008
Total Posts: 9092
27 Mar 2013 11:28 AM
I want to know how to make my 'Left Arm' point where my mouse is going, but whe code I use seems to not point in the right area. I mean, on some axis it does point where the mouse is pointing, but I want the lower part (Using RBX2.0 body, the hand) to point toward my mouse.

I'm currently using this code:

if not char:FindFirstChild("BTDFW") then Instance.new("Weld", char).Name = "BTDFW" char.BTDFW.Part0 = char.Torso char.BTDFW.Part1 = char["Left Arm"] end --Create weld
wait()
local mousehit = mouse.Hit --index mouse.Hit
char.BTDFW.C1 = CFrame.new(Vector3.new(0, 0, 0), mousehit:inverse().lookVector)
char.BTDFW.C0 = CFrame.new(Vector3.new(-1, 0, 0)) * CFrame.Angles(0, 0, 0)
Report Abuse
digpoe is not online. digpoe
Joined: 02 Nov 2008
Total Posts: 9092
27 Mar 2013 01:40 PM
le bump...

...
Report Abuse
digpoe is not online. digpoe
Joined: 02 Nov 2008
Total Posts: 9092
27 Mar 2013 02:32 PM
Introducing, the 'é' letter!

Lé bump.
Report Abuse
seanb117 is not online. seanb117
Joined: 03 Feb 2010
Total Posts: 1020
31 Dec 2013 05:11 PM
Hate to resurrect this from the dead but did you ever find the answer? I'm trying to do this too except with a tank turret.
Report Abuse
evolvedpikachu is not online. evolvedpikachu
Joined: 18 Aug 2010
Total Posts: 10696
31 Dec 2013 05:18 PM
Oh, I tried doing this also, lol. Try this and tell me if it works.

char.BTDFW.C0 = CFrame.new(char["Left Arm"].CFrame.p,char["Left Arm"].CFrame:pointToObjectSpace(mousehit))
Report Abuse
seanb117 is not online. seanb117
Joined: 03 Feb 2010
Total Posts: 1020
31 Dec 2013 05:23 PM
It isn't with the character arms. It's with a tank gun, which has two different welds. One for the left/right rotation towards the mouse and the other for the up/down.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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