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 » Scripters
Home Search
 

Tool follow cursor

Previous Thread :: Next Thread 
warspyking is not online. warspyking
Joined: 15 Nov 2011
Total Posts: 13947
11 Apr 2015 01:09 PM
@MrNicNac ty, now I only got one problem left. My mesh goes on the tool backwards LOL.
Report Abuse
Kapitanovas is not online. Kapitanovas
Joined: 09 Sep 2012
Total Posts: 4216
11 Apr 2015 01:10 PM
lol
all u gotta do is just give me an example XDDD

"My Life is going Good... but..."
Report Abuse
warspyking is not online. warspyking
Joined: 15 Nov 2011
Total Posts: 13947
11 Apr 2015 01:14 PM
@MrNicNac I wouldn't have to reverse the mesh if I instead made the back of the tool face it (instead of the front)... #NovelIdea Is modifying your code to achieve this easy?
Report Abuse
MrNicNac is not online. MrNicNac
Joined: 29 Aug 2008
Total Posts: 26567
11 Apr 2015 02:28 PM
@warspyking

Well, it is if you understand how the rotation matrix works:

if w1 then
local DesiredCFrame = {(CFrame.new((rarm.CFrame).p, mouse.Hit.p) + (w1.Part1.CFrame:vectorToWorldSpace(Vector3.new(0,0,-w1.Part1.Size.Z/2)))):components()};
w1.C0 = CFrame.new(0, -2, 0)
w1.C1 = CFrame.new(DesiredCFrame[1], DesiredCFrame[2], DesiredCFrame[3], -DesiredCFrame[4],DesiredCFrame[5],-DesiredCFrame[6],-DesiredCFrame[7],DesiredCFrame[8],-DesiredCFrame[9],-DesiredCFrame[10],DesiredCFrame[11],-DesiredCFrame[12]):toObjectSpace(rarm.CFrame);
end
Report Abuse
warspyking is not online. warspyking
Joined: 15 Nov 2011
Total Posts: 13947
11 Apr 2015 03:10 PM
@MrNicNac it's no longer held by the end, it's being held in the middle again lol.
Report Abuse
MrNicNac is not online. MrNicNac
Joined: 29 Aug 2008
Total Posts: 26567
11 Apr 2015 03:40 PM
@warspyking

Please don't say things incorrectly in meticulous cases like this. It does not go from the middle, it's just offset inversely.

Just change

local DesiredCFrame = {(CFrame.new((rarm.CFrame).p, mouse.Hit.p) + (w1.Part1.CFrame:vectorToWorldSpace(Vector3.new(0,0,-w1.Part1.Size.Z/2)))):components()};

To

local DesiredCFrame = {(CFrame.new((rarm.CFrame).p, mouse.Hit.p) + (w1.Part1.CFrame:vectorToWorldSpace(Vector3.new(0,0,w1.Part1.Size.Z/2)))):components()};
Report Abuse
warspyking is not online. warspyking
Joined: 15 Nov 2011
Total Posts: 13947
11 Apr 2015 03:41 PM
My bad, it's being held by the WRONG end.
Report Abuse
warspyking is not online. warspyking
Joined: 15 Nov 2011
Total Posts: 13947
11 Apr 2015 03:52 PM
Lol you ninja'd me, I realized my mistake before you posted a response. Sorry about that.
Report Abuse
warspyking is not online. warspyking
Joined: 15 Nov 2011
Total Posts: 13947
11 Apr 2015 04:14 PM
Sorry for being so annoying, but 1 last question, since the cursor is usually on the ground, I'd like to tilt the sword slightly upward, how can I do this?
Report Abuse
Kapitanovas is not online. Kapitanovas
Joined: 09 Sep 2012
Total Posts: 4216
11 Apr 2015 04:26 PM
lol just change the Angle a lil XD
CFrame.Angles()

"My Life is going Good... but..."
Report Abuse
warspyking is not online. warspyking
Joined: 15 Nov 2011
Total Posts: 13947
11 Apr 2015 05:10 PM
* CFrame.Angles(0, -3, 0)

You mean?
Report Abuse
Kapitanovas is not online. Kapitanovas
Joined: 09 Sep 2012
Total Posts: 4216
11 Apr 2015 06:06 PM
yup, if that's the Correct Axis...

"My Life is going Good... but..."
Report Abuse
warspyking is not online. warspyking
Joined: 15 Nov 2011
Total Posts: 13947
11 Apr 2015 06:41 PM
It didn't work.
Report Abuse
MrNicNac is not online. MrNicNac
Joined: 29 Aug 2008
Total Posts: 26567
12 Apr 2015 12:12 AM
@Kapitanovas

Once again, no.

@warspyking

It's really simple, just adjust where it's looking at by a few units.

local DesiredCFrame = {(CFrame.new((rarm.CFrame).p, (mouse.Hit.p + Vector3.new(0,3,0))) + (w1.Part1.CFrame:vectorToWorldSpace(Vector3.new(0,0,w1.Part1.Size.Z/2)))):components()};
Report Abuse
warspyking is not online. warspyking
Joined: 15 Nov 2011
Total Posts: 13947
12 Apr 2015 05:53 AM
@MrNicNac Thanks for all the help so far, but this sword is slightly infront of the player? It's not in his hand, it's stuck out infront of his hand. Anyway to fix that?
Report Abuse
udayk8139 is not online. udayk8139
Joined: 25 Aug 2013
Total Posts: 622
12 Apr 2015 05:59 AM
Don't eat me! I am bad at CFramez
Report Abuse
Kapitanovas is not online. Kapitanovas
Joined: 09 Sep 2012
Total Posts: 4216
12 Apr 2015 06:05 AM
MrNic, I meant that if was overwriting :P
CFrame = SetTheCFrame
CFrame = CurrentCFrame * CFrame.Angles

and don't tell me! this does Work!

"My Life is going Good... but..."
Report Abuse
MrNicNac is not online. MrNicNac
Joined: 29 Aug 2008
Total Posts: 26567
12 Apr 2015 09:47 AM
@warspyking

You just need to adjust this area of the code a bit. Either subtract or add a little to "w1.Part1.Size.Z/2" because that is the portion which adjusts its distance from your hand.

vectorToWorldSpace(Vector3.new(0,0,w1.Part1.Size.Z/2))

@Kapitanovas

Then why haven't your other things worked like you said? We should always look for different solutions rather than blaming our code on ROBLOX.
Report Abuse
Kapitanovas is not online. Kapitanovas
Joined: 09 Sep 2012
Total Posts: 4216
12 Apr 2015 10:02 AM
o.O
ya know, that same Code Worked for me for other things... but except for 1 Axis at a Time...
I decided to give it a try... but for various Reasons it didn't Work...
but srsly though, give me 1 Reason y,
CFrame = SetTheCFrame
CFrame = CFrame * CFrame.Angles()
wont work...
it should Work... cos it takes the CURRENT CFrame and Multiplies it by the Angle...

"My Life is going Good... but..."
Report Abuse
MrNicNac is not online. MrNicNac
Joined: 29 Aug 2008
Total Posts: 26567
12 Apr 2015 10:05 AM
Nope, I guess, in theory, that would work fine.
Report Abuse
Kapitanovas is not online. Kapitanovas
Joined: 09 Sep 2012
Total Posts: 4216
12 Apr 2015 10:08 AM
what u mean? 'Nope', 'I guess', 'that would work fine'?

"My Life is going Good... but..."
Report Abuse
warspyking is not online. warspyking
Joined: 15 Nov 2011
Total Posts: 13947
12 Apr 2015 12:21 PM
MrNicNac, how much change would happen to the code if I wanted the end to stay attached to the hand, because currently when it looks at the cursor, it moves the handle also, causing it to levitate.
Report Abuse
Previous Thread :: Next Thread 
Page 2 of 2Go to page: 1, [2] Prev
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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