InWorldz

Where your Dreams are our Vision!

It is currently Mon May 28, 2018 1:56 am | All times are UTC - 6 hours
 Page 1 of 2 [ 16 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Physical interaction between moving/static objects
PostPosted: Thu Oct 20, 2016 5:44 pm 
User avatar

Joined: Tue Jun 14, 2011 7:47 am
Posts: 395
Location: UK
Picture a lotto machine where a number of balls are randomly tumbled within a transparent container. If the container is made static and nonphysical, say a vertical hollow cylinder capped at both ends, and the balls are moved by applying random forces then they should bounce off the interior walls and each other. With fairly low forces applied this holds good most of the time but occasionally some combination of force plus angle of bounce seems to allow a ball to escape the confines of the cylinder. Very large forces mean the balls penetrate the walls of the cylinder and escape immediately.

So, is there a calculation which determines an upper limit below which the balls will always be safely contained?



_________________

~ Christine ~

Offline
 Profile  
 
 Post subject: Re: Physical interaction between moving/static objects
PostPosted: Thu Oct 20, 2016 9:10 pm 
User avatar

Joined: Mon Mar 09, 2015 7:14 am
Posts: 938
I couldn't say but have you tried a very thick invisible hollow cylinder around it to prevent escapes?



_________________
Logan's Stuff And Junk http://tp2.me/LOGANSSTUFFANDJUNK
My Youtube Channel - https://www.youtube.com/channel/UC2I0Zb-io_DK1argPuo4RyA
Jesus loves you. Everybody else thinks you suck.
Offline
 Profile  
 
 Post subject: Re: Physical interaction between moving/static objects
PostPosted: Thu Oct 20, 2016 10:00 pm 
User avatar

Joined: Mon Jun 07, 2010 7:07 pm
Posts: 7936
Location: Nova Scotia, Canada
It sounds like CCD (continuous collision detection) in PhysX either has a bug or isn't enabled for one or both of the objects colliding. The version of PhysX that we are using (3.2.3.1 I think) is an older one that was one of the first to actually provide proper CCD in PhysX. I don't know enough detail about the implementation to know what it's been applied to the prims you're describing or not. I know that CCD was effectively redone in PhysX 3.3, and they made breaking interface changes, and that's one of the reasons we haven't updated PhysX yet; it's a big work item when we do because of the scope of the changes in 3.3. So the bottom line here is that I'm not sure what the state of CCD is in the version we're using, which is something needed in order to guarantee an object is trapped inside. Without CCD, the prim may escape depending on the time between physics frames (normally 64 frames per second in IW). If it's on the inside in one frame and outside in the next (based on velocity), it will break free.

For now you're going to either need to decrease the forces to try to avoid it, or as Logan suggests, place a thicker (possibly invisible) container prim around the object to try to ensure the ball is not able to reach the outside before the next frame. (When it does, that's when it has escaped.) There isn't really a way to know how thick it needs to be because it depends on the PhysicsFPS (normally around the 64 fps target) in the region, which can vary under load (CPU usage).

I've asked Tranq for more info on the state of CCD in our physics objects. I'll let you know if we reach any conclusions here.


Offline
 Profile  
 
 Post subject: Re: Physical interaction between moving/static objects
PostPosted: Thu Oct 20, 2016 10:07 pm 
User avatar

Joined: Fri Jul 29, 2011 2:10 pm
Posts: 3989
Location: France
(Jim posted his reply while I was writing, so my reply may arrive too late, lol)

That the cylinder is thick will probably not prevent the problem, since once the ball is entirely inside the "wall", it no longer "feels" it. You must think that the repelling force is exerted by the surface, not by the volume. Then the trick is probably to have several cylinders of increasing inner diametre, in such a way that, when the ball sucessfully enters one, it meets another, and thus continues to receive a repelling force. For this to work, all the outer diametres must be larger than the largest inner diametre. But if a ball reaches this outer diametre, there is no way to prevent its escape.

Another trick is to have two sensors of different diametre: as long as a ball is detected by both, it is ok. But once it is detected only by the outer sensor, it must be brought back in a correct position.

This is a case where the current simulator technology is brought to it limits, and there is not much things we can do, save some palliative.
You must think that the simulation is not continuous, like in real physics, but every 1/64th of a second, or so. In the meanwhile, a ball still has the possibility to come in a forbidden position. With the current speeds involved, this still works, but several balls will twart the physics engine, and we sometimes see impossible things, like balls bouncing much faster than they collided.



_________________
Elfs are in virtual worlds to share a vision of a wonderful life :-)
Elven bards and storytellers
"Elf Dream" for Elf living
"Shedrupling University" science
YichTrains Elven Works Lysaer Gortax Robots
Offline
 Profile  
 
 Post subject: Re: Physical interaction between moving/static objects
PostPosted: Thu Oct 20, 2016 11:12 pm 
User avatar

Joined: Mon Mar 09, 2015 7:14 am
Posts: 938
What about a shield prim (hollow cylinder) and the balls each having a collide script? If a ball escapes and hits the shield it gets sent to some "home position" like the top center of the tube so it drops again or llDies?

When the balls rez have them do an llGetPos() and save it. Then start a timer. Every x seconds the ball compares it's current llGetPos with the one it got when it was rezzed. If they are too far apart the ball has escaped and it llDies.



_________________
Logan's Stuff And Junk http://tp2.me/LOGANSSTUFFANDJUNK
My Youtube Channel - https://www.youtube.com/channel/UC2I0Zb-io_DK1argPuo4RyA
Jesus loves you. Everybody else thinks you suck.
Offline
 Profile  
 
 Post subject: Re: Physical interaction between moving/static objects
PostPosted: Thu Oct 20, 2016 11:49 pm 
User avatar

Joined: Fri Jul 29, 2011 2:10 pm
Posts: 3989
Location: France
You can't llDie a loto ball, because all of them must be present for the drawing. But the idea is interesting to have a balls catcher of sort (external container, or sensor, or inner script) which resets them in a correct position.



_________________
Elfs are in virtual worlds to share a vision of a wonderful life :-)
Elven bards and storytellers
"Elf Dream" for Elf living
"Shedrupling University" science
YichTrains Elven Works Lysaer Gortax Robots
Offline
 Profile  
 
 Post subject: Re: Physical interaction between moving/static objects
PostPosted: Fri Oct 21, 2016 1:28 am 
User avatar

Joined: Mon Mar 09, 2015 7:14 am
Posts: 938
Yichard wrote:
You can't llDie a loto ball, because all of them must be present for the drawing.


What if an escaped ball spoke it's name before dying and the main object rezzed another copy of that ball?



_________________
Logan's Stuff And Junk http://tp2.me/LOGANSSTUFFANDJUNK
My Youtube Channel - https://www.youtube.com/channel/UC2I0Zb-io_DK1argPuo4RyA
Jesus loves you. Everybody else thinks you suck.
Offline
 Profile  
 
 Post subject: Re: Physical interaction between moving/static objects
PostPosted: Fri Oct 21, 2016 1:58 am 
User avatar

Joined: Mon Jun 07, 2010 7:07 pm
Posts: 7936
Location: Nova Scotia, Canada
Yichard wrote:
That the cylinder is thick will probably not prevent the problem, since once the ball is entirely inside the "wall", it no longer "feels" it.
I don't think there's any "inside the wall" in this case or physics would have detected the collision, and it would have bounced back. The problem in this case is that the ball is escaping, meaning it's already on the other side of the prim. Thus the suggestions to make it a thicker wall. See the discussion of discrete vs continuous collision detection.

I don't think the idea of a "capture" prim that is notified of collisions will work either in this case, because I don't think there's enough of a difference between physics keeping the ball within a container, versus recognizing the collisions with the container. If the ball is escaping, it's because the continuous collision detector (CCD) is not working or used in this case, and instead the two samples (one on either side of the boundary) did not detect a collision. So a scripted that reacts to collisions won't have any collision to react to, either. If it did, the ball would have bounced back.

So I think the best advice in this case is to make the container walls thicker so as to have a better chance of physics automatically capturing and applying the collision (or slow the balls, or both).


Offline
 Profile  
 
 Post subject: Re: Physical interaction between moving/static objects
PostPosted: Fri Oct 21, 2016 5:49 am 
User avatar

Joined: Fri Aug 24, 2012 6:58 am
Posts: 2192
Just wondering (in that outside the box kind of way). Knowing Christine it's already been tried, but here goes...

Manipulating the balls and/or making the container "more complex" wouldn't be the way I'd try to go ... Is the container an actual (hollow) prim tube (or a torus), or a sculpt, or is the container mesh? (I don't need to know the answer, but the creator knowing might change the outcome of any changes to the objects or scripts involved).

I seriously don't know much about inside -v- outside collisions ... but it seems to me, from the description, that only "some" [external] physical properties (but not all) are applied to the inner surface of a hollow object, that cause it to act in the same way it would if the container was "lined" with outside walls (or did Jim already say that?).

Anyway ... I can envision varying ways (depending on the construction type of the cylinder and/or the balls) to make the inside of the container (in effect) more outside-surface-like (which, logically, should mean there's less chance of one of the balls escaping the container).

If the cylinder is a standard hollow column-prim: remaking it in flat prims (wrapping them around to form a cylinder-like shape in a link-set) might, more successfully, mimic an outer surface (for the purpose of bouncing the balls). I'd also try to prim to mesh the container at that point to lower the Li (but only if that wouldn't turn them back into an inside surface for the purpose of the physics).

If the cylinder is sculpt an "inversion" (turning the cylinder inside-out) might be helpful (if that's possible).

If the cylinder is mesh ... hm ... I got nuthin (I've only ever manipulated mesh in ways that can be done inside the viewer).



_________________
~aka~ Claret LaKhabary @ Imzadi Basin, Arborea, InWorldz

The Almighty tells me he can get me out of this mess, but he's pretty sure you're sporked.
Offline
 Profile  
 
 Post subject: Re: Physical interaction between moving/static objects
PostPosted: Fri Oct 21, 2016 10:05 am 
User avatar

Joined: Mon Mar 09, 2015 7:14 am
Posts: 938
the balls could also scan for the jar and if they go too far llSetPos themselves back into it



_________________
Logan's Stuff And Junk http://tp2.me/LOGANSSTUFFANDJUNK
My Youtube Channel - https://www.youtube.com/channel/UC2I0Zb-io_DK1argPuo4RyA
Jesus loves you. Everybody else thinks you suck.
Offline
 Profile  
 
Display posts from previous:  Sort by  
 Page 1 of 2 [ 16 posts ]  Go to page 1, 2  Next


Who is online

Users browsing this forum: No registered users and 6 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Site Navigation