This URL has Read-Only access.

Statistics
| Branch: | Tag: | Revision:

root / examples / 04.ObjectMotion.pd @ 61820aa5

History | View | Annotate | Download (5 kB)

1
#N canvas 1567 -518 893 902 10;
2
#X obj 18 76 cnv 15 24 24 empty empty 1 4 12 1 24 -99865 -262144 0
3
;
4
#X obj 18 310 cnv 15 24 24 empty empty 3 4 12 1 24 -99865 -262144 0
5
;
6
#X obj 126 507 cnv 15 24 24 empty empty 4 4 12 1 24 -99865 -262144
7
0;
8
#X obj 71 670 s \$0-to-SPIN;
9
#X obj 18 188 cnv 15 24 24 empty empty 2 4 12 1 24 -99865 -262144 0
10
;
11
#X obj 18 18 widget-spinConnect \$0;
12
#X obj 51 77 bng 20 250 50 0 empty empty empty 17 7 0 10 -262144 -1
13
-1;
14
#X obj 51 220 subwidget-PAT \$0;
15
#X msg 51 162 cube;
16
#X obj 51 142 loadbang;
17
#X msg 71 340 /cube translate 0 1 0;
18
#X msg 85 376 /cube move 0 1 0;
19
#X text 122 356 vs.;
20
#X text 238 340 <- this will translate the model along the Y-axis \,
21
independent of current orientation;
22
#X text 213 380 <- this will translate the model along in the direction
23
of +Y-axis \, according to the current orientation;
24
#X text 59 186 Play with the following widget \, which sends setTranslation
25
\, setOrientation \, and setScale messages:;
26
#X msg 98 426 /cube rotate 25 0 0;
27
#X obj 177 529 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
28
1;
29
#X obj 178 589 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
30
1;
31
#X obj 178 608 * 90;
32
#X msg 178 628 /cube setSpin 0 0 \$1;
33
#X text 201 526 <- translational velocity (units/seconds);
34
#X obj 18 720 cnv 15 24 24 empty empty 6 4 12 1 24 -99865 -262144 0
35
;
36
#X text 157 507 Setting velocities:;
37
#X obj 551 41 cnv 15 24 24 empty empty 5 4 12 1 24 -99865 -262144 0
38
;
39
#X text 93 76 <- Create a cube model;
40
#X text 146 103 This is a convinient model \, because it has labels
41
that show which direction (axis) each face is looking;
42
#X text 52 314 Relative motion commands:;
43
#X obj 51 107 makeCube \$0;
44
#X msg 177 550 /cube setVelocity \$1 0 0;
45
#X obj 416 785 vradio 15 1 0 2 empty empty empty 0 -8 0 10 -262144
46
-1 -1 1;
47
#X msg 416 820 /cube setComputationMode \$1;
48
#X text 435 783 SERVER_SIDE;
49
#X text 435 799 CLIENT_SIDE;
50
#X msg 106 463 /cube addRotation 0 0 -10;
51
#X text 227 426 <- applies a local rotation;
52
#X obj 528 680 expr random(-5 \, 5) \; random(10 \, 50) \; random(-5
53
\, 5);
54
#X obj 593 731 pack 0 0 0 s;
55
#X obj 635 655 t b s;
56
#X obj 635 635 symbol;
57
#X msg 593 751 /cube translateTo \$1 \$2 \$3 3 \$4;
58
#X msg 701 91 OutQuadMotion;
59
#X msg 701 111 InQuadMotion;
60
#X msg 701 131 InOutQuadMotion;
61
#X msg 701 151 OutCubicMotion;
62
#X msg 701 171 InCubicMotion;
63
#X msg 701 191 InOutCubicMotion;
64
#X msg 701 211 OutQuartMotion;
65
#X msg 701 231 InQuartMotion;
66
#X msg 701 251 InOutQuartMotion;
67
#X msg 701 271 OutBounceMotion;
68
#X msg 701 291 InBounceMotion;
69
#X msg 701 311 InOutBounceMotion;
70
#X msg 701 331 OutElasticMotion;
71
#X msg 701 351 InElasticMotion;
72
#X msg 701 371 InOutElasticMotion;
73
#X msg 701 391 OutSineMotion;
74
#X msg 701 411 InSineMotion;
75
#X msg 701 431 InOutSineMotion;
76
#X msg 701 451 OutBackMotion;
77
#X msg 701 471 InBackMotion;
78
#X msg 701 491 InOutBackMotion;
79
#X msg 701 511 OutCircMotion;
80
#X msg 701 531 InCircMotion;
81
#X msg 701 551 InOutCircMotion;
82
#X msg 701 571 OutExpoMotion;
83
#X msg 701 591 InExpoMotion;
84
#X msg 701 611 InOutExpoMotion;
85
#X text 145 443 vs.;
86
#X text 272 464 <- adds a relative rotation to current orientation
87
;
88
#X text 581 44 Try different types of predefined motions:;
89
#X obj 416 840 s \$0-to-SPIN;
90
#X obj 593 772 s \$0-to-SPIN;
91
#X text 47 725 Understanding CLIENT_SIDE motion:;
92
#X text 17 750 By default \, SPIN computes velocities and motions on
93
the server-side and multicasts each update. This puts a lot of strain
94
on the network for big scenes \, so use setComputationMode to force
95
updates to the client-side. The drawback of this \, is that GUIs and
96
other non-SPIN clients will not have the most up-to-date transform
97
information.;
98
#X text 17 840 Hint: try turning on the msg-print switch in the connection
99
widget above \, and see how the message stream changes when you enable
100
client-side computation and apply velocities or predefined motions.
101
;
102
#X msg 701 71 LinearMotion;
103
#X text 220 582 Angular velocity (in deg/sec). In this case \, the
104
model will yaw 90 degrees every second;
105
#X text 755 769 ^ duration of (3sec);
106
#X connect 6 0 28 0;
107
#X connect 8 0 7 0;
108
#X connect 9 0 8 0;
109
#X connect 10 0 3 0;
110
#X connect 11 0 3 0;
111
#X connect 16 0 3 0;
112
#X connect 17 0 29 0;
113
#X connect 18 0 19 0;
114
#X connect 19 0 20 0;
115
#X connect 20 0 3 0;
116
#X connect 29 0 3 0;
117
#X connect 30 0 31 0;
118
#X connect 31 0 71 0;
119
#X connect 34 0 3 0;
120
#X connect 36 0 37 0;
121
#X connect 36 1 37 1;
122
#X connect 36 2 37 2;
123
#X connect 37 0 40 0;
124
#X connect 38 0 36 0;
125
#X connect 38 1 37 3;
126
#X connect 39 0 38 0;
127
#X connect 40 0 72 0;
128
#X connect 41 0 39 0;
129
#X connect 42 0 39 0;
130
#X connect 43 0 39 0;
131
#X connect 44 0 39 0;
132
#X connect 45 0 39 0;
133
#X connect 46 0 39 0;
134
#X connect 47 0 39 0;
135
#X connect 48 0 39 0;
136
#X connect 49 0 39 0;
137
#X connect 50 0 39 0;
138
#X connect 51 0 39 0;
139
#X connect 52 0 39 0;
140
#X connect 53 0 39 0;
141
#X connect 54 0 39 0;
142
#X connect 55 0 39 0;
143
#X connect 56 0 39 0;
144
#X connect 57 0 39 0;
145
#X connect 58 0 39 0;
146
#X connect 59 0 39 0;
147
#X connect 60 0 39 0;
148
#X connect 61 0 39 0;
149
#X connect 62 0 39 0;
150
#X connect 63 0 39 0;
151
#X connect 64 0 39 0;
152
#X connect 65 0 39 0;
153
#X connect 66 0 39 0;
154
#X connect 67 0 39 0;
155
#X connect 76 0 39 0;