|
| 03 Mar 2016 11:06 AM |
I'm working on some AI, and I want to be able to move blocks around and have them be regions.
I want to be able to resize the blocks, and when the game starts, it turns that block into a region.
|
|
|
| Report Abuse |
|
|
|
| 03 Mar 2016 11:19 AM |
part = game.Workspace.Part local part_size = part.Size local part_position = part.Position local start_point = part_position + Vector3.new(-part_size.X/2, -part_size.Y/2, -part_size.Z/2) local end_point = part_position + Vector3.new(part_size.X/2, part_size.Y/2, part_size.Z/2) local region = Region3.new( Vector3.new( math.min(start_point.X, end_point.X), math.min(start_point.Y, end_point.Y), math.min(start_point.Z, end_point.Z) ), Vector3.new( math.max(start_point.X, end_point.X), math.max(start_point.Y, end_point.Y), math.max(start_point.Z, end_point.Z) ) )
|
|
|
| Report Abuse |
|
|
| |
|
| |
|
|
| 03 Mar 2016 01:53 PM |
| The parts position is the center of the part. And the parts size is the entire length of the part. So if we are only trying to go to the edge of a part, since we are starting from the center, we only need to go to half of its size, rather than the whole size |
|
|
| Report Abuse |
|
|
| |
|