Adam Frisby

MRM Micropost: “Type” via ‘is’

without comments

Determining the type of object returned via a sensor or other detection event (eg collision, etc) in LSL is done via llDetectedType() – this returns a bitflags containing whether the object is an avatar, prim, etc.

Under MRM, the same is achieved by using the C# keyword “is”. In C# this returns true if the object is a specific type, or implements the interface ‘type’; because of this it means that we can determine what an IEntity is by looking for the inherited classes.

For example:

In this example, e.Sender is defined to be an IEntity – which can mean an Object or an Avatar presently (there may be other types of entity potentially later on). You can determine exactly what type of entity using “is IObject” or “is IAvatar”, and if it returns true, you can typecast to those interfaces safely.

4 Vote

Feedback

If you found this post useful and want me to write more on this topic, please use the vote button to the left or leave me a comment below.

Written by Adam Frisby

April 10th, 2009 at 6:48 am

Posted in OpenSim

Tagged with , ,

Leave a Reply

 

You need to log in to vote

The blog owner requires users to be logged in to be able to vote for this post.

Alternatively, if you do not have an account yet you can create one here.

Powered by Vote It Up