-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBendy.ms
55 lines (52 loc) · 1.5 KB
/
Bendy.ms
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
plugin simpleMod MyBend
name:"MyBend"
classID:#(0x33635bb3, 0x5db238c1)
version:1
(
parameters main rollout:params
(
amount type:#float ui:spn_amount default:0
direction type:#float ui:spn_direction default:0
axis type:#integer ui:rad_axis default:3
)
rollout params "MyBend Parameters"
(
spinner spn_amount "Amount: " range:[-100000,100000,0] scale:1
spinner spn_direction "Direction: " range:[-100000,100000,0] scale:1
radiobuttons rad_axis "Axis:" labels:#("X","Y","Z")
)
on map i p do
(
if amount != 0 then
(
case axis of
(
1: (
theDirMatrix = rotateXMatrix -direction
theRadius = 180/amount*extent.x/Pi
theRadiusOffset = [0,0,-theRadius] * theDirMatrix
TM = rotateYMatrix (amount*p.x/extent.x) * theDirMatrix
TM.row4 = theRadiusOffset
(([0,p.y,p.z]-theRadiusOffset)*inverse theDirMatrix) * TM
)
2: (
theDirMatrix = rotateYMatrix -direction
theRadius = 180/amount*extent.y/Pi
theRadiusOffset = [theRadius,0,0] * theDirMatrix
TM = rotateZMatrix (-amount*p.y/extent.y) * theDirMatrix
TM.row4 = theRadiusOffset
(([p.x,0,p.z]-theRadiusOffset)*inverse theDirMatrix) * TM
)
default: (
theDirMatrix = rotateZMatrix -direction
theRadius = 180/amount*extent.z/Pi
theRadiusOffset = [theRadius,0,0] * theDirMatrix
TM = rotateYMatrix (amount*p.z/extent.z) * theDirMatrix
TM.row4 = theRadiusOffset
(([p.x,p.y,0]-theRadiusOffset)*inverse theDirMatrix) * TM
)
)
)
else p
)
)