Difference between revisions of "PRIM MATERIAL/ja"
Jump to navigation
Jump to search
素材についてのビデオチュートリアル
Asuka Neely (talk | contribs) (New page: <onlyinclude>{{#if: {{#vardefine:material_const|{{LSL Const/ja|PRIM_MATERIAL|integer|2|c=プリムの素材を{{GetSet|{{{1|}}}|取得|設定|/}}するのに用いられます}}}} {{#var...) |
|||
(2 intermediate revisions by 2 users not shown) | |||
Line 14: | Line 14: | ||
<center style="font-size:125%;">[http://youtube.com/watch?v=6OXYO61kQCA 素材についてのビデオチュートリアル]</center> | <center style="font-size:125%;">[http://youtube.com/watch?v=6OXYO61kQCA 素材についてのビデオチュートリアル]</center> | ||
<videoflash>6OXYO61kQCA</videoflash> | <videoflash>6OXYO61kQCA</videoflash> | ||
|desc= | |desc=プリムの素材を設定します。素材は質量には影響しませんが、抵抗、弾み(弾力)、衝突音に影響します。傾斜 33° の木材の上で後述のサンプルスクリプトを動作させると、このようになります: | ||
{{{!}} class="sortable" {{Prettytable}} | {{{!}} class="sortable" {{Prettytable}} | ||
{{!}}+ <font style="font-size:80%;"> | {{!}}+ <font style="font-size:80%;">坂を下りる最大速度と距離を示した表</font> | ||
{{!}}- {{Hl2}} | {{!}}- {{Hl2}} | ||
! | !タイプ | ||
!速度 <font style="font-size:80%;">({{HoverText|m/s|メートル毎秒}})</font> | !速度 <font style="font-size:80%;">({{HoverText|m/s|メートル毎秒}})</font> | ||
!距離 <font style="font-size:80%;">({{HoverText|m|メートル}})</font> | !距離 <font style="font-size:80%;">({{HoverText|m|メートル}})</font> | ||
{{!}}- | {{!}}- | ||
{{!}} | {{!}}{{LSLG/ja|PRIM_MATERIAL_STONE|石材}} | ||
{{!}}0.453181 | {{!}}0.453181 | ||
{{!}}0.361655 | {{!}}0.361655 | ||
{{!}}- | {{!}}- | ||
{{!}} | {{!}}{{LSLG/ja|PRIM_MATERIAL_METAL|金属}} | ||
{{!}}5.475444 | {{!}}5.475444 | ||
{{!}}10.211180 | {{!}}10.211180 | ||
{{!}}- | {{!}}- | ||
{{!}} | {{!}}{{LSLG/ja|PRIM_MATERIAL_GLASS|ガラス}} | ||
{{!}}6.483150 | {{!}}6.483150 | ||
{{!}}11.678304 | {{!}}11.678304 | ||
{{!}}- | {{!}}- | ||
{{!}} | {{!}}{{LSLG/ja|PRIM_MATERIAL_WOOD|木材}} | ||
{{!}}2.154549 | {{!}}2.154549 | ||
{{!}}9.433724 | {{!}}9.433724 | ||
{{!}}- | {{!}}- | ||
{{!}} | {{!}}{{LSLG/ja|PRIM_MATERIAL_FLESH|肌}} | ||
{{!}}0.351543 | {{!}}0.351543 | ||
{{!}}0.188043 | {{!}}0.188043 | ||
{{!}}- | {{!}}- | ||
{{!}} | {{!}}{{LSLG/ja|PRIM_MATERIAL_PLASTIC|プラスチック}} | ||
{{!}}4.502428 | {{!}}4.502428 | ||
{{!}}9.590952 | {{!}}9.590952 | ||
{{!}}- | {{!}}- | ||
{{!}} | {{!}}{{LSLG/ja|PRIM_MATERIAL_RUBBER|ゴム}} | ||
{{!}}0.374964 | {{!}}0.374964 | ||
{{!}}0.187106 | {{!}}0.187106 | ||
Line 53: | Line 53: | ||
{{!}}} | {{!}}} | ||
|pa={{LSL Constant/List/ja|i_front=[ {{#var:material_const}}, |i_end= ] | |pa={{LSL Constant/List/ja|i_front=[ {{#var:material_const}}, |i_end= ] | ||
|text= | |text={{LSLG/ja|llSetPrimitiveParams}} や {{LSLG/ja|llSetLinkPrimitiveParams}} と一緒に使用されたとき | ||
|i1_type=integer|i1_name=material | |i1_type=integer|i1_name=material | ||
|toc=llSetPrimitiveParams | |toc=llSetPrimitiveParams | ||
}} | }} | ||
|pb={{LSL Constant/List/ja|i_front= | |pb={{LSL Constant/List/ja|i_front={{LSLG/ja|llGetPrimitiveParams}}([ {{#var:material_const}}|i_end= ]);| | ||
|r_front= | |r_front=[ |r_end= ] のリストを返します | ||
|text | |text | ||
|r1_type=integer|r1_name=material | |r1_type=integer|r1_name=material | ||
Line 64: | Line 64: | ||
}} | }} | ||
|examples= | |examples= | ||
< | <source lang="lsl2">// © 2008 by Karzita Zabaleta | ||
// Author of Scripting Your World, Wiley, October 2008. | // Author of Scripting Your World, Wiley, October 2008. | ||
Line 140: | Line 140: | ||
} | } | ||
} | } | ||
}</ | }</source> | ||
|constants= | |constants= | ||
{{!}} | {{!}} | ||
{{LSL Constants/PrimitiveParams/materials/ja|table=*|sortable=*}} | {{LSL Constants/PrimitiveParams/materials/ja|table=*|sortable=*}} | ||
|functions= | |functions= | ||
{{LSL DefineRow|| | {{LSL DefineRow||{{LSLG/ja|llSetPrimitiveParams}}|}} | ||
{{LSL DefineRow|| | {{LSL DefineRow||{{LSLG/ja|llSetLinkPrimitiveParams}}|}} | ||
{{LSL DefineRow|| | {{LSL DefineRow||{{LSLG/ja|llGetPrimitiveParams}}|}} | ||
|events= | |events= | ||
{{LSL DefineRow|| | {{LSL DefineRow||{{LSLG/ja|changed}}|}} | ||
|location | |location | ||
|cat1=Prim | |cat1=Prim | ||
|cat2=Collision | |cat2=Collision | ||
|cat3 | |cat3=Prim/Materials | ||
|cat4 | |cat4 | ||
|{{#vardefine:comment}} | |{{#vardefine:comment}} | ||
}} | }} |
Latest revision as of 05:22, 25 February 2016
LSL ポータル | 関数 | イベント | 型 | 演算子 | 定数 | 実行制御 | スクリプトライブラリ | カテゴリ別スクリプトライブラリ | チュートリアル |
解説
定数: integer PRIM_MATERIAL = 2;<videoflash>6OXYO61kQCA</videoflash>
integer 定数 PRIM_MATERIAL の値は 2 です。
プリムの素材を設定します。素材は質量には影響しませんが、抵抗、弾み(弾力)、衝突音に影響します。傾斜 33° の木材の上で後述のサンプルスクリプトを動作させると、このようになります:
タイプ | 速度 (m/s) | 距離 (m) |
---|---|---|
石材 | 0.453181 | 0.361655 |
金属 | 5.475444 | 10.211180 |
ガラス | 6.483150 | 11.678304 |
木材 | 2.154549 | 9.433724 |
肌 | 0.351543 | 0.188043 |
プラスチック | 4.502428 | 9.590952 |
ゴム | 0.374964 | 0.187106 |
llSetPrimitiveParams
[ PRIM_MATERIAL, integer material ]• integer | material | – | PRIM_MATERIAL_* フラグ |
llSetPrimitiveParams や llSetLinkPrimitiveParams と一緒に使用されたとき
llGetPrimitiveParams
llGetPrimitiveParams([ PRIM_MATERIAL ]);[ integer material ] のリストを返します
• integer | material | – | PRIM_MATERIAL_* フラグ |
関連記事
定数
|
関数
• | llSetPrimitiveParams | |||
• | llSetLinkPrimitiveParams | |||
• | llGetPrimitiveParams |
イベント
• | changed |
サンプル
// © 2008 by Karzita Zabaleta
// Author of Scripting Your World, Wiley, October 2008.
list gMaterialTypes = [
"STONE",
"METAL",
"GLASS",
"WOOD",
"FLESH",
"PLASTIC",
"RUBBER"
];
vector gHomePosition;
rotation gHomeRotation;
integer gWaitCount = 0;
float gMaxVelMag;
integer gPrimMaterial;
moveTo(vector origin, vector destination) {
float dist = llVecDist(origin, destination);
integer passes = llCeil( llLog(dist/10.0) / llLog(2.0) );
integer i;
list params = [PRIM_POSITION, destination];
for (i=0; i<passes; i++) {
params = (params=[]) + params + params;
}
// actually move the prim, now
llSetPrimitiveParams(params);
}
returnHome()
{
llSetStatus(STATUS_PHYSICS, FALSE);
moveTo(llGetPos(),gHomePosition);
llSetTimerEvent(0);
llSetRot(gHomeRotation);
}
calculate_velocity()
{
float velMag = llVecMag(llGetVel());
if (velMag > gMaxVelMag) {
gMaxVelMag = velMag;
}
}
default
{
state_entry() {
gHomePosition = llGetPos();
gHomeRotation = llGetRot();
}
on_rez(integer _n) {
llResetScript();
}
touch_start(integer n) {
gMaxVelMag = 0;
llSetPrimitiveParams([PRIM_MATERIAL, gPrimMaterial]);
llSetStatus(STATUS_PHYSICS,TRUE);
llSetTimerEvent(0.1);
llResetTime();
gWaitCount=0;
gPrimMaterial++;
if (gPrimMaterial == 7 ) gPrimMaterial = 0;
}
timer() {
calculate_velocity();
gWaitCount++;
if (gWaitCount > 100) { // 10 seconds
string type = llList2String( gMaterialTypes, gPrimMaterial-1 );
llOwnerSay(type+" reached maximum velocity of "+(string)gMaxVelMag+
" and traveled "+(string)llVecDist(llGetPos(), gHomePosition)+" meters.");
returnHome();
}
}
}