|
| 23 May 2009 03:18 PM |
| ... make a 90 degree turn to the right or left? |
|
|
| Report Abuse |
|
|
|
| 23 May 2009 03:18 PM |
| and without using bodygyro. |
|
|
| Report Abuse |
|
|
| |
|
|
| 23 May 2009 04:07 PM |
script.Parent.Humanoid:WalkTo(script.Parent.Torso.Position+WHATEVERYOU WANT,script.Parent.Torso) -----
You can use CFrame.lookVector and change that to make the Humanoid turn however you want. I think this works. |
|
|
| Report Abuse |
|
|
|
| 23 May 2009 04:08 PM |
| ::WalkTo is not a member function of Humanoid. Get out. |
|
|
| Report Abuse |
|
|
| |
|
| |
|
|
| 23 May 2009 04:46 PM |
| I already knew all of that. The problem is when I add lookVector to the mix, it doesn't work right. |
|
|
| Report Abuse |
|
|
|
| 23 May 2009 05:08 PM |
You could rotate its torso's lookvector, then make it moveTo in that direction relative to its Torso.
I don't know rotation however. |
|
|
| Report Abuse |
|
|
Clone512
|
  |
| Joined: 02 Mar 2008 |
| Total Posts: 7810 |
|
|
| 23 May 2009 08:19 PM |
"... make a 90 degree turn to the right or left?":
Humanoid:MoveTo(script.Parent.Position + Vector3.new(-1, 0, 0)) --Turn left
Right is obviously positive in the x vector.
|
|
|
| Report Abuse |
|
|
Clone512
|
  |
| Joined: 02 Mar 2008 |
| Total Posts: 7810 |
|
|
| 23 May 2009 08:20 PM |
Oops, I forgot something:
"Humanoid:MoveTo(script.Parent.Position + Vector3.new(-1, 0, 0)) --Turn left ", should be:
Humanoid:MoveTo(script.Parent.Position + Vector3.new(-1, 0, 0), workspace.PrimaryPart)
Lol, sorry.
You'll have to set workspace's primary part in order for this to work. |
|
|
| Report Abuse |
|
|
Frozzie
|
  |
| Joined: 10 Jan 2008 |
| Total Posts: 1083 |
|
|
| 24 May 2009 03:47 AM |
dir = torso.CFrame.lookVector humanoid:MoveTo(script.Parent.Position + dir * 6 * CFrame.fromEulerAnglesXYZ(0,math.pi/2,0), torso)
Something like that I guess. |
|
|
| Report Abuse |
|
|
|
| 24 May 2009 01:59 PM |
I kind of forget how to get the left and right lookVectors, but it's something like this:
front=humanoid.Parent.Torso.CFrame.lookVector left=Vector3.new(-1*front.z,front.y,front.x) right=Vector3.new(front.z,front.y,-1*front.x)
--But I may have the -1* things mixed up. Well, anyway, from there, you could do a:
humanoid:MoveTo(humanoid.Parent.Torso.Position+right*30,Instance.new("Part")) |
|
|
| Report Abuse |
|
|
|
| 24 May 2009 05:50 PM |
| why don't you change the CFrame? |
|
|
| Report Abuse |
|
|
|
| 24 May 2009 08:41 PM |
| It won't look very good if you just turn it using CFrame and it might get stuck in a wall or something. |
|
|
| Report Abuse |
|
|
Gavin12
|
  |
| Joined: 01 Apr 2008 |
| Total Posts: 1910 |
|
|
| 25 May 2009 11:52 AM |
| Please Follow This URL for Humanoid Functions: http://wiki.roblox.com/index.php/RBX.lua.Humanoid_%28Object%29 |
|
|
| Report Abuse |
|
|
Meelo
|
  |
| Joined: 04 Jul 2008 |
| Total Posts: 14763 |
|
|
| 25 May 2009 11:52 AM |
| I think he knows that much. |
|
|
| Report Abuse |
|
|
| |
|
Davidii
|
  |
| Joined: 17 Jul 2008 |
| Total Posts: 1282 |
|
|
| 25 May 2009 06:00 PM |
This requires a little bit of triggonometry... Here goes:
function getAngle(z) return math.asin(z) end
function getUnit(angle) local z = math.sin(angle) local x = math.cos(angle) return Vector3.new(x, 0, z)
local angle = getAngle(my_human.Torso.CFrame.lookVector.z)
angle = angle + math.pi / 2
local unit = getUnit(angle)
my_human:MoveTo(my_human.Torso.Position + unit)
There. Phew. |
|
|
| Report Abuse |
|
|
|
| 25 May 2009 06:44 PM |
Davidii, that was unnecessary:
humanoid=script.Parent.Humanoid
front=humanoid.Parent.Torso.CFrame.lookVector right=Vector3.new(-1*front.z,front.y,front.x) left=Vector3.new(front.z,front.y,-1*front.x)
humanoid:MoveTo(humanoid.Parent.Torso.Position+right*30,workspace.Part)
This works, I tested it. Before, I had a couple mistakes. |
|
|
| Report Abuse |
|
|
nate2800
|
  |
| Joined: 16 Aug 2007 |
| Total Posts: 828 |
|
|
| 26 May 2009 02:27 AM |
Or you could do it a way that actually makes sense.
--Directly Left Character.Torso.CFrame = Character.Torso.CFrame * CFrame.fromEulerAnglesXYZ(0,math.rad(90),0)
--Directly Right Character.Torso.CFrame = Character.Torso.CFrame * CFrame.fromEulerAnglesXYZ(0,math.rad(-90),0)
--Backwards Character.Torso.CFrame = Character.Torso.CFrame * CFrame.fromEulerAnglesXYZ(0,math.rad(180),0)
Notice that I convert the rotation amount in degrees to that of radians. I will leave you to decide how you actually rotate though. |
|
|
| Report Abuse |
|
|
| |
|
| |
|
|
| 05 May 2016 07:14 PM |
Read my previous response.
Profit pls. |
|
|
| Report Abuse |
|
|