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
 

help me understand lookvector

Previous Thread :: Next Thread 
WishNite is not online. WishNite
Joined: 11 Feb 2009
Total Posts: 15828
05 Aug 2013 07:16 PM
lookVectors = {
--Facing South
[Vector3.new(0,0,-1)] =Vector3.new(0,0,-4),
--Facing North
[Vector3.new(0,0,1)] = Vector3.new(0,0,4),
--Facing east
[Vector3.new(1,0,0)] = Vector3.new(4,0,0),
--Facing west
[Vector3.new(-1,0,0)] = Vector3.new(-4,0,0)

}

I have a table like this

and I use this

local pos = model.Head.Position + lookVectors[model.Head.CFrame.lookVector]

However, this doesn't work, but this does

local pos = model.Head.Position + Vector3.new(lookVectors[model.Head.CFrame.lookVector])

but this always returns Vector3.new(0,0,0), so the pos is always just model.Head.Position
Report Abuse
gijsbel11 is not online. gijsbel11
Joined: 07 Feb 2009
Total Posts: 4223
05 Aug 2013 07:27 PM
You're over-doing!

local CFrame = model.Head.CFrame * model.Head.CFrame.lookVector
Report Abuse
gijsbel11 is not online. gijsbel11
Joined: 07 Feb 2009
Total Posts: 4223
05 Aug 2013 07:27 PM
Woops!

local CFrame = model.Head.CFrame + model.Head.CFrame.lookVector
Report Abuse
gijsbel11 is not online. gijsbel11
Joined: 07 Feb 2009
Total Posts: 4223
05 Aug 2013 07:28 PM
oh and if you want the change the distance between the old and new position just multiply the 'model.Head.CFrame.lookVector' by the distance you desire.
Report Abuse
WishNite is not online. WishNite
Joined: 11 Feb 2009
Total Posts: 15828
05 Aug 2013 07:28 PM
That moves the Pos inside the head, where I want it to be in front of the head (hence the table)
Report Abuse
WishNite is not online. WishNite
Joined: 11 Feb 2009
Total Posts: 15828
05 Aug 2013 07:29 PM
Okay, I see, thanks -- but I still need to use the table and it still always returns Vector3.new(0,0,0)
Report Abuse
gijsbel11 is not online. gijsbel11
Joined: 07 Feb 2009
Total Posts: 4223
05 Aug 2013 07:32 PM
Well that's weird, CFrame.lookVector should never return Vector3.new(0,0,0) since a block ALWAYS has a direction it's facing..

and you don't need the use that table, trust me.
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