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: Question

Previous Thread :: Next Thread 
seanb117 is not online. seanb117
Joined: 03 Feb 2010
Total Posts: 1020
29 Dec 2013 03:13 AM
I made a post about this earlier, but got no reply.
Is it possible to use a weld to make a brick face the direction of the mouse?
Report Abuse
ninjasamuraiux is not online. ninjasamuraiux
Joined: 23 Aug 2011
Total Posts: 5405
29 Dec 2013 03:24 AM
yeah maybe
Report Abuse
ninetailfox73 is not online. ninetailfox73
Joined: 11 Mar 2008
Total Posts: 1954
29 Dec 2013 03:27 AM
If you're trying to make a CFrame look at the mouse just do this

player = game.Players.LocalPlayer
mouse=player:GetMouse()
brick=game.Workspace.Brick --the brick with the weld in it
brick.Weld.C0 = CFrame.new(brick.Position, Vector3.new(mouse.Hit.p.x,mouse.Hit.p.y,mouse.Hit.p.z)
Report Abuse
Goulstem is not online. Goulstem
Joined: 04 Jul 2012
Total Posts: 7177
29 Dec 2013 03:31 AM
He said weld, not CFrame.
Report Abuse
ninetailfox73 is not online. ninetailfox73
Joined: 11 Mar 2008
Total Posts: 1954
29 Dec 2013 03:36 AM
Weld C0 is a CFrame...
Report Abuse
seanb117 is not online. seanb117
Joined: 03 Feb 2010
Total Posts: 1020
29 Dec 2013 03:37 AM
Tried that. All it did was move my tank's MainGun to a different area. If I moved my mouse, the entire tank gun would move to a different location too.
Report Abuse
seanb117 is not online. seanb117
Joined: 03 Feb 2010
Total Posts: 1020
29 Dec 2013 03:37 AM
And yes..Weld.C0 is a CFrame..
Report Abuse
ninetailfox73 is not online. ninetailfox73
Joined: 11 Mar 2008
Total Posts: 1954
29 Dec 2013 03:44 AM
Try this weld.C0 = = mouse.Hit*CFrame.fromEulerAnglesXYZ(0.1,0,0)
Report Abuse
ninetailfox73 is not online. ninetailfox73
Joined: 11 Mar 2008
Total Posts: 1954
29 Dec 2013 03:44 AM
Oops only 1 equal sign

weld.C0 = mouse.Hit*CFrame.fromEulerAnglesXYZ(0.1,0,0)
Report Abuse
ninetailfox73 is not online. ninetailfox73
Joined: 11 Mar 2008
Total Posts: 1954
29 Dec 2013 03:45 AM
weld.C0 = mouse.Hit*CFrame.fromEulerAnglesXYZ(0.1,0,0)
^This worked for a BodyGyro. I'm not sure about a weld though.
Report Abuse
seanb117 is not online. seanb117
Joined: 03 Feb 2010
Total Posts: 1020
29 Dec 2013 03:50 AM
Doesn't work, same thing as before.
I have been trying a lot of things like this for like the past 6 hours.
Report Abuse
seanb117 is not online. seanb117
Joined: 03 Feb 2010
Total Posts: 1020
29 Dec 2013 03:51 AM
I know it works for BodyGyro, but I', trying to avoid using that because it tends to cause lag and is unstable.
Report Abuse
seanb117 is not online. seanb117
Joined: 03 Feb 2010
Total Posts: 1020
29 Dec 2013 04:00 AM
This was the closest I ever got to my goal.


function move(m)
while true do

weld.C0 = (weld.C0 * CFrame.Angles(0,m.Hit.y,0))
wait()

end
end

It made it spin. _._ I just need to figure out how to make it stop moving once it's looking where the mouse is
(this is just to move the gun left or right, not up or down)
Report Abuse
seanb117 is not online. seanb117
Joined: 03 Feb 2010
Total Posts: 1020
29 Dec 2013 04:21 AM
Bump.
Btw thanks to those who tried to help.
Report Abuse
seanb117 is not online. seanb117
Joined: 03 Feb 2010
Total Posts: 1020
29 Dec 2013 05:11 AM
Yet another bump.
Report Abuse
seanb117 is not online. seanb117
Joined: 03 Feb 2010
Total Posts: 1020
29 Dec 2013 05:55 AM
Bump
Report Abuse
seanb117 is not online. seanb117
Joined: 03 Feb 2010
Total Posts: 1020
29 Dec 2013 10:43 AM
Bump...
Report Abuse
seanb117 is not online. seanb117
Joined: 03 Feb 2010
Total Posts: 1020
29 Dec 2013 03:22 PM
Still can't seem to figure out how too.
If you can help, please do. lol
Report Abuse
ninetailfox73 is not online. ninetailfox73
Joined: 11 Mar 2008
Total Posts: 1954
29 Dec 2013 06:58 PM
I would just use BodyGyro at this point xD
Report Abuse
seanb117 is not online. seanb117
Joined: 03 Feb 2010
Total Posts: 1020
29 Dec 2013 07:32 PM
It's too glitchy. And causes lag. I'm hoping to remove this lag..i'm gonna study Galleons, see how wingman8 did it and see if i can apply it to my model.
Report Abuse
Bebee2 is not online. Bebee2
Joined: 17 May 2009
Total Posts: 3985
29 Dec 2013 07:37 PM
Keep aware of the equation for C0:

C0 = Part0.CFrame:inverse()*Part1.CFrame*C1


You can ignore C1.

C0 = Part0.CFrame:inverse()*Part1.CFrame


All you have to do is edit the Part1.CFrame to the CFrame you want the Part1 to be.


That would prolly be the hardest part of the CFraming, though.

Report Abuse
seanb117 is not online. seanb117
Joined: 03 Feb 2010
Total Posts: 1020
30 Dec 2013 02:26 AM
I know that. I'm familiar with using welds to move/rotate bricks. But this is the first time I've ever tried to move a brick in the direction of the mouse.Hit.p
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
30 Dec 2013 02:38 AM
I'm assuming mouse is the playerMouse and part is the whatever

local offset = (part.Position - mouse.Hit.p)
local direction = offset.Unit
local angle = math.atan2(direction.X, direction.Z) + math.pi
local angle2 = math.atan(direction.Y)

weld.C0 = CFrame.new(weld.C0.p) * CFrame.Angles(0, angle, 0) * CFrame.Angles(angle2, 0, 0)

Not tested.
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
30 Dec 2013 02:38 AM
"local angle2 = math.atan(direction.Y)"
Should be
"local angle2 = math.asin(direction.Y)"
Report Abuse
seanb117 is not online. seanb117
Joined: 03 Feb 2010
Total Posts: 1020
30 Dec 2013 05:20 AM
Holy crap. It works.
Well..almost. It's the inverse.
Which one would I change to make it normal?
Anyways...THANK YOU.
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