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: BodyPosition Using LookVector?

Previous Thread :: Next Thread 
MegaBlocksLegoRoblox is not online. MegaBlocksLegoRoblox
Joined: 20 Jul 2010
Total Posts: 75
31 Dec 2013 12:21 PM
I *kinda* understand LookVector, so how would I make it so that when my player presses a certain key ("t") that it "flies" a few studs in front of where it is looking?

Basically all I want is to put the lookVector in the "position" property of the BodyPosition (or however it's done), since that property doesn't support CFrame. How is that possible, though?
Report Abuse
MegaBlocksLegoRoblox is not online. MegaBlocksLegoRoblox
Joined: 20 Jul 2010
Total Posts: 75
31 Dec 2013 12:29 PM
Help?
Report Abuse
RoflBread is not online. RoflBread
Joined: 18 Jun 2009
Total Posts: 3803
31 Dec 2013 12:33 PM
bp = script.parent.BodyPosition
dist = 2


--when t is pressed :
bp.position = script.Parent.Position + script.Parent.CFrame.lookVector * 2
Report Abuse
Absurdism is not online. Absurdism
Joined: 18 Jul 2013
Total Posts: 2568
31 Dec 2013 12:35 PM
lookVector is a unit vector, thus, it will hardly have any effect on the magnitude of a product. What we have to do is specify an orthogonal point using a vector, redirect it by lookVector so it points in the right direction, and multiply that vector by a scalar to get it the right length.

Instance.new('BodyPosition', character.Torso).position = character.Torso.CFrame.lookVector * 4

Just mess around with it in the command line. I recommend that wholeheartedly.
Report Abuse
MegaBlocksLegoRoblox is not online. MegaBlocksLegoRoblox
Joined: 20 Jul 2010
Total Posts: 75
31 Dec 2013 01:33 PM
Thanks, it works great!
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