# Patrick Loughman

Patrick Loughman

Gamedev

LOCATION
United States

Not Specified

## Recent Forum Posts

space-G
it wont auto-frame after it imports

#### Mapbox RnD2019年5月3日2:01

imag4media
Hi.

Finally had a chance to try out updated mapbox.
Offset is very handy for placing the tiles in x and z.

Two questions:
-Is there a known offset for the latLong for the surrounding tiles?
-Is it possible to have offset in Y? Or do I need to do w vex?

I'm guessing the distance would involve some elegant math based on something like this:
https://www.thoughtco.com/degree-of-latitude-and-longitude-distance-4070616 [www.thoughtco.com]

I just want to do procedurally so no matter the latLong, the surrounding tiles will line up correctly.

Thx again for the fun tools.

A
I'm guessing you've realized this already but, the offset values are 1 offset = 1 tile at whatever zoom you've specified. So you don't have to calculate. An offset of 0,1 will give you the adjacent tile to the north.
The annoying bit is trying to automate because the initialization/downloading bit doesn't seem automatable at the moment.

If I were to automate the offsets in a grid I'd do something like this in a for loop:
Offset 0
```floor(detail("../repeat_begin1_metadata1", "iteration", 0)/3)
```
Offset 1
```detail("../repeat_begin1_metadata1", "iteration", 0)-(ch("offsetsx")*3)
```

#### Approach to visibility samples per primitive.... dumb?2017年5月10日22:17

Approach: I am running a foreach loop on a bunch of prims.
For each prim I scatter a number of points. Still within the foreach loop, I run a point wrangle on those scatter points. In the wrangle I run intersect on each of the scatter points and if one hits I set an attribute on the prim (foreach loop piece) that the points were scattered on. In the end I don't need the scattered points, I just need the prims output with the attribute @keepage updated.
What I cant figure out is how to set up the forloop so that this works.

Obviously this loop will output points. The VEX for the wrangle “secondaryIntersect” seems valid, but I have no way of applying changes to the attribute keepage on the Forloop's iteration pieces (primitives).

VEX for “secondaryIntersect” running over primitives.
```vector p;
vector hitprimuvw;
vector srcpt;

i@ptrefprim = prim(2, "refprim", 0);
srcpt = v@P + (normalize(v@rdir)*2);
i@hitprim  = intersect(1, srcpt, v@rdir, p, hitprimuvw);

if(@hitprim<5){
setprimattrib(2, "keepage", 0, 1, "set");
}
```

This makes me think my approach is not possible.
https://www.sidefx.com/forum/topic/42999/ [sidefx.com]