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
 

Re: What is a good way to make a humanoid...

Previous Thread :: Next Thread 
cupcakescankill is not online. cupcakescankill
Joined: 24 Oct 2008
Total Posts: 13261
23 May 2009 03:18 PM
... make a 90 degree turn to the right or left?
Report Abuse
cupcakescankill is not online. cupcakescankill
Joined: 24 Oct 2008
Total Posts: 13261
23 May 2009 03:18 PM
and without using bodygyro.
Report Abuse
DingDong272 is not online. DingDong272
Top 100 Poster
Joined: 08 Dec 2007
Total Posts: 9860
23 May 2009 04:07 PM
WalkToPoint?
Report Abuse
PurpleKiwi is not online. PurpleKiwi
Joined: 26 Jul 2008
Total Posts: 4022
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
DingDong272 is not online. DingDong272
Top 100 Poster
Joined: 08 Dec 2007
Total Posts: 9860
23 May 2009 04:08 PM
::WalkTo is not a member function of Humanoid. Get out.
Report Abuse
PurpleKiwi is not online. PurpleKiwi
Joined: 26 Jul 2008
Total Posts: 4022
23 May 2009 04:11 PM
Sorry, I meant "MoveTo()"
Report Abuse
DingDong272 is not online. DingDong272
Top 100 Poster
Joined: 08 Dec 2007
Total Posts: 9860
23 May 2009 04:40 PM
MoveTo does not rotate.
Report Abuse
cupcakescankill is not online. cupcakescankill
Joined: 24 Oct 2008
Total Posts: 13261
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
BlueTaslem is not online. BlueTaslem
Joined: 11 May 2008
Total Posts: 11060
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 is not online. 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 is not online. 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 is not online. 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
blobbyblob is not online. blobbyblob
Joined: 29 Oct 2008
Total Posts: 12165
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
Weaselman50 is not online. Weaselman50
Joined: 23 Nov 2007
Total Posts: 1599
24 May 2009 05:50 PM
why don't you change the CFrame?
Report Abuse
PurpleKiwi is not online. PurpleKiwi
Joined: 26 Jul 2008
Total Posts: 4022
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 is not online. 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 is not online. Meelo
Joined: 04 Jul 2008
Total Posts: 14763
25 May 2009 11:52 AM
I think he knows that much.
Report Abuse
TornGoosePwnz0r is not online. TornGoosePwnz0r
Joined: 07 Apr 2009
Total Posts: 4978
25 May 2009 02:04 PM
ya
Report Abuse
Davidii is not online. 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
blobbyblob is not online. blobbyblob
Joined: 29 Oct 2008
Total Posts: 12165
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 is not online. 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
arshiaslaya is not online. arshiaslaya
Joined: 04 Nov 2012
Total Posts: 2670
05 May 2016 07:01 PM
Nah


Profit pls.
Report Abuse
IlluminatiCat is not online. IlluminatiCat
Joined: 21 Feb 2009
Total Posts: 1216
05 May 2016 07:04 PM
arish kys
Report Abuse
arshiaslaya is not online. arshiaslaya
Joined: 04 Nov 2012
Total Posts: 2670
05 May 2016 07:14 PM
Read my previous response.


Profit pls.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
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