Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

[SOLVED] How to would I find 2 locations using 1 location and the part Size?

Asked by 7 years ago
Edited 7 years ago

Let me get to the point. I am know it has to be possiable to get 2 Locations from 1 Location but using the Part Size to define them 2 locations. I know this is easy but I am not good at math I just need a boost. http://imgur.com/a54dmbj I like for it to start from 1 Corner then other on the far side so p1 = Pos1 p2 = Pos2

p1---------

----------p2

local pos1 = game.Workspace.Properties.Property.OriginSquare.Position
local pos2 = game.Workspace.Properties.Property.OriginSquare.Position
local highBounds = Vector3.new(pos2.X, pos2.Y + 0.2, pos2.Z)
local lowBounds = Vector3.new(pos1.X, pos1.Y, pos1.Z)

local function snapToGrid(p, gH, gW,gD) -- NEW
    return p.x - (p.x % gW), round(p.y / gH)*gH, p.z - (p.z % gD)
end

Here what I come up with I figure that all I had to do is Add 1 size x and other one subtract size z from pos x and z then do that again but opsit to get the other location it works but its way off the part location I want it to be on the conors of the location.

local pos = Vector3.new(-1280.3, 14.3, 183.9)
local size = Vector3.new(50, 0.2, 50)
local pos1 = Vector3.new(pos.x + size.X, 14.5, pos.z - size.Z)
local pos2 = Vector3.new(pos.x - size.X, 14.5, pos.z + size.Z)

New Pos1 = -1230.30005, 14.5, 133.899994 New Pos2 = -1330.30005, 14.5, 233.899994

0
Forgot to Dived the Size by 2 cause I was telling it to just add on to the location to give me the locations around it. I figure this out. xxmobkiller 5 — 7y

Answer this question