Craftero
|
  |
| Joined: 24 Jun 2011 |
| Total Posts: 1451 |
|
|
| 29 Dec 2015 01:49 PM |
Does anybody know how to offset a Part from it's current position? I know you can do this with a Model using :TranslateBy(), but is there a way of doing it with a Part?
Any help or advise would be greatly appreciated. Thanks in advance. |
|
|
| Report Abuse |
|
|
rvox
|
  |
| Joined: 18 Feb 2011 |
| Total Posts: 5380 |
|
|
| 29 Dec 2015 01:50 PM |
| part.CFrame = part.CFrame * CFrame.new(0,1,0) |
|
|
| Report Abuse |
|
|
Craftero
|
  |
| Joined: 24 Jun 2011 |
| Total Posts: 1451 |
|
|
| 29 Dec 2015 02:02 PM |
@rvox
Thanks for that.
It mostly works, however, when I use that technique, the Part appears above other Parts, when it should appear within them.
Perhaps its due to a mistake I've made later in my code. Any suggestions as to why this happens? |
|
|
| Report Abuse |
|
|
Craftero
|
  |
| Joined: 24 Jun 2011 |
| Total Posts: 1451 |
|
|
| 29 Dec 2015 02:05 PM |
I've looked into it further. This is the line that causes the Part to appear above other Parts: HalfPart.Size = Vector3.new(1, HalfPart.Size.Y, HalfPart.Size.Z)
But why? Can anybody offer any help or advise? |
|
|
| Report Abuse |
|
|
Casualist
|
  |
| Joined: 26 Jun 2014 |
| Total Posts: 4443 |
|
|
| 29 Dec 2015 02:07 PM |
local part = Instance.new("Part", workspace) part.Anchored = true local cf = part.CFrame part.Size = Vector3.new(10,10,10) part.CFrame = cf
You have to cframe the part after you resize it |
|
|
| Report Abuse |
|
|
|
| 29 Dec 2015 02:08 PM |
do local cf=HalfPart.CFrame HalfPart.Size = Vector3.new(1, HalfPart.Size.Y, HalfPart.Size.Z) HalfPart.CFrame=cf end |
|
|
| Report Abuse |
|
|
mudkip99
|
  |
| Joined: 17 Jun 2008 |
| Total Posts: 3362 |
|
|
| 29 Dec 2015 02:09 PM |
| set the CFrame after you set the size. Setting the size will automatically move the part out of blocks it's within, where CFrame can move parts inside other blocks. |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 29 Dec 2015 02:56 PM |
| If you're creating the part, all you have to do is parent it to workspace AFTER changing the size. When it's not parented to workspace, collisions are not checked. |
|
|
| Report Abuse |
|
|