查看“LlGetEnergy”的源代码
←
LlGetEnergy
跳转至:
导航
、
搜索
因为以下原因,您没有权限编辑本页:
您所请求的操作仅限于该用户组的用户使用:
用户
您可以查看与复制此页面的源代码。
{{LSL Header|ml=*}}{{LSLC|Keywords}}{{LSLC|Flow Control}}{{LSLC|}} {{函数详情 |函数名 = Function: float llGetEnergy( ) |参数= 参数: |返回值= 返回值:返回一个浮点数,该浮点数是对象中能量占最大值的百分比。 |注意事项= 注意事项 |示例= <pre> // This script tests the energy use of most of the physics functions // Last version: 07 October 2009 by Gianni Lupindo vector homePos; integer timerCount = 0; integer testCount = 0; string space = " "; // move more than 10m 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() { llSetTimerEvent(0); llSetStatus(STATUS_PHYSICS, FALSE); llSleep(0.2); moveTo(llGetPos(),homePos); llSetRot(ZERO_ROTATION); } default { state_entry() { homePos = llGetPos(); llOwnerSay("Mass is "+(string)llGetMass()); } on_rez(integer _n) { llResetScript(); } touch_start(integer n) { space = " "; do { llSleep(0.5); } while (llGetEnergy() < 0.998); llSetPos( llGetPos()+<0,0,5>); llSetStatus(STATUS_PHYSICS,TRUE); llSetTimerEvent(1.0); vector impulse = <0,0,5>*llGetMass(); if (testCount == 0) { llOwnerSay("ApplyImpulse (test 0)"); llApplyImpulse( impulse, TRUE ); } else if (testCount == 1) { llOwnerSay("ApplyRotImpulse (test 1)"); llApplyRotationalImpulse( impulse, TRUE); } else if (testCount == 2) { llOwnerSay("PushObject (test 2)"); llPushObject(llGetKey(), impulse, ZERO_VECTOR, TRUE); } else if (testCount == 3) { llSetForceAndTorque( ZERO_VECTOR, ZERO_VECTOR, TRUE ); llOwnerSay("Force (test 3)"); llSetForce( impulse, TRUE ); } else if (testCount == 4) { llSetForceAndTorque( ZERO_VECTOR, ZERO_VECTOR, TRUE ); llOwnerSay("Torque (test 4)"); llSetTorque( impulse, TRUE ); } else if (testCount == 5) { llSetForceAndTorque( ZERO_VECTOR, ZERO_VECTOR, TRUE ); llOwnerSay("Force and Torque (test 5)"); llSetForceAndTorque( impulse, impulse, TRUE ); } else if (testCount == 6) { llSetForceAndTorque( ZERO_VECTOR, ZERO_VECTOR, TRUE ); llOwnerSay("MoveToTarget (test 6)"); llMoveToTarget( impulse, 0.4 ); } else if (testCount == 7) { llStopMoveToTarget ( ); llOwnerSay("RotLookAt (test 7)"); llRotLookAt( llEuler2Rot(impulse*DEG_TO_RAD), 0.4, 0.4 ); } else if (testCount == 8) { llStopLookAt ( ); llOwnerSay("LookAt (test 8)"); llLookAt( impulse, 0.4, 0.4 ); } else if (testCount == 9) { llStopLookAt ( ); llOwnerSay("Hover Height (test 9)"); llSetHoverHeight( 5.0, TRUE, 0.5); } else if (testCount == 10) { llSetHoverHeight( 0, TRUE, 0.5); llOwnerSay("Ground Repel (test 10)"); llGroundRepel( 5, TRUE, 0.5); } else if (testCount == 11) { llGroundRepel( 0, TRUE, 0.5); llOwnerSay("Buoyancy (test 11)"); llSetBuoyancy( 0.997 ); } else { llSetBuoyancy( 0.0 ); llOwnerSay("Done"); } timerCount = 0; if (testCount != 12) { llOwnerSay((string)timerCount+". Energy: "+space+(string)llGetEnergy()); testCount++; } else { testCount = 0; returnHome(); } } timer() { timerCount++; if (timerCount >= 10) space = ""; llOwnerSay((string)timerCount+". Energy: "+space+(string)llGetEnergy()); if (timerCount>=10) { returnHome(); } } collision(integer n) { llOwnerSay("*. Energy: "+space+(string)llGetEnergy()+" (collision)"); } } </pre> |相关函数= |相关事件= }}
该页面使用的模板:
模板:LSL Header
(
查看源代码
)
模板:LSLC
(
查看源代码
)
模板:LSLGC
(
查看源代码
)
模板:Multi-lang
(
查看源代码
)
模板:函数详情
(
查看源代码
)
返回至
LlGetEnergy
。
导航菜单
个人工具
登录
名字空间
页面
讨论
变种
视图
阅读
查看源代码
查看历史
更多
搜索
导航
网站首页
知识百科
编辑帮助
最近更改
工具
链入页面
相关更改
特殊页面
页面信息