Message 1 of 3
Simplemod - world coordinates

Not applicable
03-06-2009
04:01 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I`m writing a scripted modifier that snaps vertices to a grid position in world space.
The only problem I`m having is finding out the world position of each vertex.
I only need to get this position as I can then alter the local position accordingly.
Does anyone know a way of getting the world position of 'p'?
I`ve included the WIP plug-in below;
--------------------------------------------------
plugin simpleMod SnapToGrid
name:"Snap to Grid"
classID:#(0x3891aa38, 0x51b5e565)
version:1
(
parameters main rollout:params
(
amount type:#integer ui:amtSpin default:2
)
rollout params "Snap Parameters"
(
spinner amtSpin "Grid Val: " type:#integer range:
)
on map i p do
(
p.x = P.x-(Mod (p.x+min.x) (amount*39.3701))
p.y = P.y-(Mod (p.y+min.y) (amount*39.3701))
p.z = P.z-(Mod (p.z+min.z) (amount*39.3701))
p
)
)
The only problem I`m having is finding out the world position of each vertex.
I only need to get this position as I can then alter the local position accordingly.
Does anyone know a way of getting the world position of 'p'?
I`ve included the WIP plug-in below;
--------------------------------------------------
plugin simpleMod SnapToGrid
name:"Snap to Grid"
classID:#(0x3891aa38, 0x51b5e565)
version:1
(
parameters main rollout:params
(
amount type:#integer ui:amtSpin default:2
)
rollout params "Snap Parameters"
(
spinner amtSpin "Grid Val: " type:#integer range:
)
on map i p do
(
p.x = P.x-(Mod (p.x+min.x) (amount*39.3701))
p.y = P.y-(Mod (p.y+min.y) (amount*39.3701))
p.z = P.z-(Mod (p.z+min.z) (amount*39.3701))
p
)
)