Open Source Platform
for interconnected virtual worlds

Content Scripting Python 3D Model Animation

From RexWiki

The following sample demonstrates how to launch mesh animations from server Python script:

import rxactor
import rxavatar
import sys
import clr

asm = clr.LoadAssemblyByName('OpenSim.Region.ScriptEngine.Common')
Vector3 = asm.OpenSim.Region.ScriptEngine.Common.LSL_Types.Vector3

import random
import math


class AnimTest(rxactor.Actor):
    def GetScriptClassName():
        return "samplemeshanim.AnimTest"

    def EventCreated(self):
        super(self.__class__,self).EventCreated()
        print "samplemeshanim.AnimTest EventCreated"

    def EventTouch(self,vAvatar):
        vAvatar.rexPlayMeshAnimation(self.Id,"Wave",0.2,False,False)
        self.llShout(0,"Custom animation!")

def rexPlayMeshAnimation(self,primId,vAnimName,vRate,vbLooped, vbStopAnim):

Where:

  • primId Is the id of the primitive.
  • vAnimName Name of the animation to launch.
  • vRate Speed of the animation, where 1.0 is default speed.
  • vbLooped True to make the animation looped, false to play it only once.
  • vbStopAnim True to stop the animation, false to launch the animation.