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
|
  |
| 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
|
  |
| 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
|
  |
| 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
|
  |
| 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
|
  |
| 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
|
  |
| 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 |
|
|