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
We use cookies to offer you a better experience. By using Roblox.com, you are agreeing to our Privacy and Cookie Policy.
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Rotating to DesiredAngle

Previous Thread :: Next Thread 
NikB is not online. NikB
Joined: 13 May 2009
Total Posts: 2478
27 Apr 2013 09:32 PM
Halp. I'm trying to rotate the torso. I know DesiredAngle is only for Motors but how would I do something similar for the Torso? I'm trying to rotate the whole character but I want to use the same kind of input as DesiredAngle, like an integer instead of a Vector3.

How can this be done?

TL;DR - How do I rotate my character using integer instead of a Vector3 (CFrame)?
Report Abuse
MrChubbs is not online. MrChubbs
Joined: 14 Oct 2010
Total Posts: 4969
27 Apr 2013 09:58 PM
As you would be working in three dimensions rather than moving on one dimension as a motor would, you can't. Just CFrame it based on the lookVector.

Report Abuse
NikB is not online. NikB
Joined: 13 May 2009
Total Posts: 2478
27 Apr 2013 10:10 PM
I'm trying to make the character point at where the mouse is. I can't just do CFrameAngles or any of that. Well, I wouldn't know how.
Report Abuse
NikB is not online. NikB
Joined: 13 May 2009
Total Posts: 2478
27 Apr 2013 11:00 PM
Help
Report Abuse
killjoy37 is not online. killjoy37
Joined: 27 Aug 2008
Total Posts: 2821
27 Apr 2013 11:04 PM
Take the mouse's unitray, and then set the Torso's CFrame.
direction = mouse.UnitRay
Torso.CFrame = CFrame.new(Torso.CFrame,direction)
however, if you are pointing up or down, so will the torso
Report Abuse
NikB is not online. NikB
Joined: 13 May 2009
Total Posts: 2478
27 Apr 2013 11:09 PM
wat

CFrame.new expects a Vector3?
Report Abuse
killjoy37 is not online. killjoy37
Joined: 27 Aug 2008
Total Posts: 2821
27 Apr 2013 11:15 PM
Always for the first argument, the second argument was optional though, it returns a CFrame pointing towards the second argument at position of first argument.
Now that I think about it, that one line might have to be changed to
direction = mouse.Hit
instead.
Report Abuse
NikB is not online. NikB
Joined: 13 May 2009
Total Posts: 2478
27 Apr 2013 11:34 PM
Dude.


LocalScript:272: bad argument #1 to 'new' (Vector3 expected, got userdata)
Report Abuse
killjoy37 is not online. killjoy37
Joined: 27 Aug 2008
Total Posts: 2821
27 Apr 2013 11:38 PM
oops
I contradicted myself
direction = mouse.UnitRay
Torso.CFrame = CFrame.new(Torso.Position,direction)
Report Abuse
NikB is not online. NikB
Joined: 13 May 2009
Total Posts: 2478
27 Apr 2013 11:40 PM
Exact same error.
Report Abuse
NikB is not online. NikB
Joined: 13 May 2009
Total Posts: 2478
27 Apr 2013 11:41 PM
It's the same code..
Report Abuse
killjoy37 is not online. killjoy37
Joined: 27 Aug 2008
Total Posts: 2821
27 Apr 2013 11:57 PM
It wasn't the same. Try this instead
direction = mouse.Hit
Torso.CFrame = CFrame.new(Torso.Position,direction)

Be patient, I'm trying to help
Report Abuse
BJJScrambler is not online. BJJScrambler
Joined: 13 Jan 2013
Total Posts: 898
27 Apr 2013 11:59 PM
mouse.UnitRay returns a Ray, not a vector3. You are thinking of mouse.Hit.lookVector.

@original question
DesiredAngle would just mean you are rotating it around one axis. That is all. Just CFrame.Angles and only change one axis.
Report Abuse
NikB is not online. NikB
Joined: 13 May 2009
Total Posts: 2478
28 Apr 2013 12:12 AM
Yeah but I don't know how to change ONE axis of CFrame.Angles to get it to point at the mouse.
Report Abuse
BJJScrambler is not online. BJJScrambler
Joined: 13 Jan 2013
Total Posts: 898
28 Apr 2013 12:18 AM
CFrame.Angles(x,0,0)--X axis
CFrame.Angles(0,y,0)--Y axis
CFrame.Angles(0,0,z)--Z axis
Report Abuse
NikB is not online. NikB
Joined: 13 May 2009
Total Posts: 2478
28 Apr 2013 12:22 AM
Oh so I'm just supposed to use

CFrame.Angles(theXWhereTheMouseIsPointing,0,0)?

Thanks bro! It works great!
Report Abuse
killjoy37 is not online. killjoy37
Joined: 27 Aug 2008
Total Posts: 2821
28 Apr 2013 12:22 AM
mouse.Hit.lookVector would point in the direction that the brick you are pointing to is facing.

Did the last code I gave you work?
Report Abuse
NikB is not online. NikB
Joined: 13 May 2009
Total Posts: 2478
28 Apr 2013 12:24 AM
Nope, same error.
Report Abuse
killjoy37 is not online. killjoy37
Joined: 27 Aug 2008
Total Posts: 2821
28 Apr 2013 12:26 AM
Shoot. A valiant effort, though.
Report Abuse
BJJScrambler is not online. BJJScrambler
Joined: 13 Jan 2013
Total Posts: 898
28 Apr 2013 12:26 AM
mouse.Hit.p* mb, thinking of something else.

CFrame.new(torso.Position,mouse.Hit.p)


However that is not what he is asking for.
Report Abuse
killjoy37 is not online. killjoy37
Joined: 27 Aug 2008
Total Posts: 2821
28 Apr 2013 12:27 AM
.p!!!!!
Yes! That's what it was!
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