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: Define a position 5 studs in front of a part

Previous Thread :: Next Thread 
Evetor is not online. Evetor
Joined: 04 Mar 2013
Total Posts: 4217
25 Jun 2014 04:10 PM
Let's say I have a part at (10,1,0)

This part is facing towards an unusual direction

How do I define a Vector3 position 5 studs in front of the part?
Report Abuse
LordMatthewII is not online. LordMatthewII
Joined: 20 Aug 2011
Total Posts: 10873
25 Jun 2014 04:12 PM
newCFrame=part.CFrame.lookVector*5
Report Abuse
Evetor is not online. Evetor
Joined: 04 Mar 2013
Total Posts: 4217
25 Jun 2014 04:15 PM
So the position would be CFrame.p?
Report Abuse
LordMatthewII is not online. LordMatthewII
Joined: 20 Aug 2011
Total Posts: 10873
25 Jun 2014 04:15 PM
newCFrame=part.CFrame.lookVector*5

print(newCFrame)
print(Vector3.new(newCFrame))

Idk how to explain to you that newCFrame is a position.
Report Abuse
RoflBread is not online. RoflBread
Joined: 18 Jun 2009
Total Posts: 3803
25 Jun 2014 04:26 PM
newCFrame=part.CFrame.lookVector*5

That would move the part to 5 studs away from the origin (0,0,0)

Use:

newCFrame= part.CFrame * CFrame.new(0,0,-5)

or if you must use lookVector:

newCFrame = part.CFrame.lookVector *5 + the_bricks_current_position
Report Abuse
LordMatthewII is not online. LordMatthewII
Joined: 20 Aug 2011
Total Posts: 10873
25 Jun 2014 04:28 PM
What do you mean? It would move it 5 studs in front of the part in the direction of the lookVector.
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