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
|
  |
| 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
|
  |
| 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
|
  |
| Joined: 13 May 2009 |
| Total Posts: 2478 |
|
| |
|
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
|
  |
| Joined: 13 May 2009 |
| Total Posts: 2478 |
|
|
| 27 Apr 2013 11:09 PM |
wat
CFrame.new expects a Vector3? |
|
|
| Report Abuse |
|
|
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
|
  |
| 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
|
  |
| 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
|
  |
| Joined: 13 May 2009 |
| Total Posts: 2478 |
|
| |
|
NikB
|
  |
| Joined: 13 May 2009 |
| Total Posts: 2478 |
|
| |
|
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 |
|
|
|
| 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
|
  |
| 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 |
|
|
|
| 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
|
  |
| 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
|
  |
| 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
|
  |
| Joined: 13 May 2009 |
| Total Posts: 2478 |
|
| |
|
killjoy37
|
  |
| Joined: 27 Aug 2008 |
| Total Posts: 2821 |
|
|
| 28 Apr 2013 12:26 AM |
| Shoot. A valiant effort, though. |
|
|
| Report Abuse |
|
|
|
| 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
|
  |
| Joined: 27 Aug 2008 |
| Total Posts: 2821 |
|
|
| 28 Apr 2013 12:27 AM |
.p!!!!! Yes! That's what it was! |
|
|
| Report Abuse |
|
|