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: Strange Weld Pointing Problems

Previous Thread :: Next Thread 
rayoma is not online. rayoma
Joined: 13 Nov 2009
Total Posts: 1911
15 Jun 2012 10:10 PM
I am currently trying to make it so that your arms will move with the mouse while holding a gun. The left hand works perfectly and the dot that I put out there to display where I want the gun is in the proper place however, the right shoulder gets stuck sideways inside of the left arm and appears to be moving in a random fashion. Can anyone spot my mistake?

    local handle_pos=torso.CFrame*(CFrame.new(0,CFrame.new(torso.CFrame.p,mouse.Hit.p).lookVector.y,0))*CFrame.new(0,0,-2);
    pcall(function() obj:Destroy(); end);
    obj=dot(handle_pos);
    --left arm
        local left_shoulder=torso.CFrame*CFrame.new(-1,1,0);
        local desired_p1L=CFrame.new((left_shoulder.p+handle_pos.p)/2,handle_pos.p)*CFrame.Angles(math.pi/2,0,0);
        weldL.C0=CFrame.new();
        weldL.C1=desired_p1L:inverse()*weldL.Part0.CFrame;
    --right arm
        local right_shoulder=torso.CFrame*CFrame.new(1,1,0);
        local desired_p1R=CFrame.new((right_shoulder.p+handle_pos.p)/2,handle_pos.p)*CFrame.Angles(math.pi/2,0,0);
        weldR.C0=CFrame.new();
        weldR.C1=desired_p1R:inverse()*weldR.Part0.CFrame;
Report Abuse
crazyman32 is not online. crazyman32
Joined: 13 Apr 2008
Total Posts: 18027
15 Jun 2012 10:55 PM
First of all, Lua doesn't need those semi-colons. It recognizes white-space
Report Abuse
FlappydavidINC is not online. FlappydavidINC
Joined: 20 May 2011
Total Posts: 694
15 Jun 2012 11:13 PM
Second of all? :P.
Report Abuse
oxcool1 is not online. oxcool1
Joined: 05 Nov 2009
Total Posts: 15444
15 Jun 2012 11:27 PM
[ Content Deleted ]
Report Abuse
crazyman32 is not online. crazyman32
Joined: 13 Apr 2008
Total Posts: 18027
15 Jun 2012 11:29 PM
Yes, in very very few scenarios does it need it.
Report Abuse
rayoma is not online. rayoma
Joined: 13 Nov 2009
Total Posts: 1911
16 Jun 2012 12:07 AM
And I use them. It's a style choice, who cares?

Anyone see the problem with my right arm?
Report Abuse
Spectrumw is not online. Spectrumw
Joined: 04 Aug 2009
Total Posts: 13510
16 Jun 2012 12:32 AM
I tested your script (Using the Right and Left Shoulders Motor6D's stored in the torso, and I didn't get the error you described, both arms seem to be working perfectly on the Y axis which I guess is pretty much what you want.
Report Abuse
Spectrumw is not online. Spectrumw
Joined: 04 Aug 2009
Total Posts: 13510
16 Jun 2012 01:55 AM
Nevermind, you get the error because of the Animate script inside the character, which sets the DesiredAngle of the arm to 1.5 thus messing the script, you can easely fix this by editing and replacing the Animate script with a 'passive' animation, that lets the DesiredAngle in 0. At least that's how I managed to fix it.
Report Abuse
rayoma is not online. rayoma
Joined: 13 Nov 2009
Total Posts: 1911
16 Jun 2012 08:23 AM
@spec
Thanks, I didn't think it had to do with my math but wasn't sure.
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