Phantom prim --> llGetMass() return zero

Creating scripts
beuving Beeswing
Posts: 12
Joined: Sun Nov 17, 2013 9:09 pm
Has thanked: 3 times
Been thanked: 5 times

Phantom prim --> llGetMass() return zero

Post by beuving Beeswing »

Why does llGetMass() return zero in a phantom prim.
I use the following function to hover a prim: llSetForce(llGetMass() * <0,0, 9.81> , FALSE);

But in a phantom prim, this doesn't work because llGetMass() returns 0.

Does anyone know how i can let a phantom prim work with some kind of llGetMass function?
User avatar
Ilan Tochner
Posts: 6518
Joined: Sun Dec 23, 2012 8:44 am
Has thanked: 4974 times
Been thanked: 4469 times
Contact:

Re: Phantom prim --> llGetMass() return zero

Post by Ilan Tochner »

Phantom prims are ignored by the physics engine so they don't have any mass. As far as the sim is concerned, phantom prims are just there to be sent to people's viewers for rendering.
beuving Beeswing
Posts: 12
Joined: Sun Nov 17, 2013 9:09 pm
Has thanked: 3 times
Been thanked: 5 times

Re: Phantom prim --> llGetMass() return zero

Post by beuving Beeswing »

I use phantom prims to act like firework. They have status: Physical and Phantom.
They fly and emit particles but the prims are phantom because you don't want to have '(invisible) colliding fireworks'..

Is there away to achieve what i have in SL?

I can make them invisible but the point is that they don't need to collide with each other.
User avatar
Ilan Tochner
Posts: 6518
Joined: Sun Dec 23, 2012 8:44 am
Has thanked: 4974 times
Been thanked: 4469 times
Contact:

Re: Phantom prim --> llGetMass() return zero

Post by Ilan Tochner »

AFAIK a prim can't be both Phantom (i.e. completely ignored by the physics engine) and Physical (i.e. used for physics calculations) in OpenSim. I know this is different in Second Life. You can see this issue mentioned here: http://opensimulator.org/mantis/view.php?id=5487

As an aside, having many moving prims would be very bad for sim performance, forcing the simulator to constantly broadcast the position changes of many objects to all the avatars in the region and adjacent regions. Having these objects be non-phantom would be much worse as it would increase load on the physics engine as well. I'm sure you're aware of this and don't have many moving particle emitters in your fireworks displays.
beuving Beeswing
Posts: 12
Joined: Sun Nov 17, 2013 9:09 pm
Has thanked: 3 times
Been thanked: 5 times

Re: Phantom prim --> llGetMass() return zero

Post by beuving Beeswing »

Thank you for the clear answer.
It depends on what is called many? At MAX 50 - 80 prims? Not all emmiting particles at once, but they are in the sky and they are physical.
I understand physical objects affects the performance of the server.

Can you tell me something about the relation (in power) between SL (physical) servers and Kitely? Kitely runs in the cloud, SL doesn't. But are the kitely servers as powerful as SL? I can run my firework show in SL, it does eat FPS from the client and script time and physical time @ server side.

sl sim performance goes from roughly 20.6 ms spare time to 17 - 19ms spare time.. (Total Frame Time)
User avatar
Keith Selmes
Posts: 175
Joined: Fri Jan 04, 2013 1:13 pm
Location: Devon, UK
Has thanked: 174 times
Been thanked: 153 times
Contact:

Re: Phantom prim --> llGetMass() return zero

Post by Keith Selmes »

I wonder if KeyFramed motion would be useful ? Objects are phantom by default.

http://www.kitely.com/forums/viewtopic.php?f=26&t=1155

http://wiki.secondlife.com/wiki/LlSetKeyframedMotion
These users thanked the author Keith Selmes for the post:
beuving Beeswing
User avatar
Ilan Tochner
Posts: 6518
Joined: Sun Dec 23, 2012 8:44 am
Has thanked: 4974 times
Been thanked: 4469 times
Contact:

Re: Phantom prim --> llGetMass() return zero

Post by Ilan Tochner »

Your sim gets significantly more RAM and CPU resources in Kitely but we're running OpenSim + ODE or BulletSim physics whereas SL uses their own simulators + Havok physics.

I don't know which codebase is more efficient for the simulator (I suspect OpenSim may be better in some areas and SL's simulators may be better in others) but I'm sure their physics engine is much more optimized than either ODE or BulletSim when it comes to resource usage for Physical objects.

In any case, 50-80 moving prims create not only load on the physics engine but also network load as all those moving prim's movements need to be transfered to all the avatars that have them in their view distance. On the other hand, if the prims are mostly static then the network load will be much reduced. Your best bet, performance wise, would be to use Phantom prims that don't move and rely on the particles themselves for the movement effects you want. If that isn't possible, then at the very least keep the prims phantom and try to minimize the number of them you have moving at any point in time.
beuving Beeswing
Posts: 12
Joined: Sun Nov 17, 2013 9:09 pm
Has thanked: 3 times
Been thanked: 5 times

Re: Phantom prim --> llGetMass() return zero

Post by beuving Beeswing »

I understand your concerns about sim performance. Is there some way I can test the resource usage for physical objects? The only way I know is Ctrl-Alt-1 to see the sim load in milliseconds.

I think it's not a problem to use some resources, because if you don't want resources to be used, the scripting ability in opensim had to be turned off ;-)
I believe it's the trick to use not TO much resources.. I think.
I am trying to simulating chinese fireworks, so that's quite big firework..

The fireworks I have made started in 2011... in SL they're almost ready to sell... so I don't consider to move to KeyFramedmotion, I think. If you know what I mean. (several years work is already committed).
It's not a new product. I'm trying to import them from SL but I struggle with the physical differences between opensim and sl physics engine..
beuving Beeswing
Posts: 12
Joined: Sun Nov 17, 2013 9:09 pm
Has thanked: 3 times
Been thanked: 5 times

Re: Phantom prim --> llGetMass() return zero

Post by beuving Beeswing »

I rezz multiple prims from a firework battery. The prims are 2M x 2M x 2M big, because the particle emitter is then visible from a larger distance then when i use regular small prims.
The tubes in the battery shoot multiple firework 'blocks' at once, while they can't be phantom anymore they will collide with each other.

So i think i can't create my firework here in opensim, unless I change something... Maybe i need to size my battery bigger so the blocks with size 2M3 will not collide on start...
User avatar
Ilan Tochner
Posts: 6518
Joined: Sun Dec 23, 2012 8:44 am
Has thanked: 4974 times
Been thanked: 4469 times
Contact:

Re: Phantom prim --> llGetMass() return zero

Post by Ilan Tochner »

If you sell fireworks that rezz 50 flying physical objects you'll get complaints from almost all of your OpenSim buyers when their sims come crawling to a halt (most people run simulators on less than ideal servers).

I highly recommend you don't use the physics engine and instead simulate things with scripts , especially as what you want is some simple parabolic trajectory for objects that can pass through each other. Using KeyFramed motion on Phantom non-Physical prims is the way to go in Second Life and (even more so) in OpenSim.
Post Reply