InWorldz

Where your Dreams are our Vision!

It is currently Mon May 28, 2018 1:59 am | All times are UTC - 6 hours
 Page 2 of 2 [ 16 posts ]  Go to page Previous  1, 2
Author Message
 Post subject: Re: Physical interaction between moving/static objects
PostPosted: Fri Oct 21, 2016 3:24 pm 
User avatar

Joined: Mon Jul 16, 2012 5:56 am
Posts: 277
Location: On chair in front of PC
IIRC there was some code added to move physical objects if intrapenitration was detected, which had the side effect of causing such objects to be thrown across the sim instead of being gently moved away from each other.



_________________
Sometimes I look back at the indenting on my scripts and wonder if it was actually intended to be an E E Cummings poem.
Offline
 Profile  
 
 Post subject: Re: Physical interaction between moving/static objects
PostPosted: Sat Oct 22, 2016 12:40 am 
User avatar

Joined: Tue Jun 14, 2011 7:47 am
Posts: 395
Location: UK
Lots of good ideas here - thank you everyone! Let's see what we have...
Jim Tarber wrote:
...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....

This helps. Effectively it appears that the sampling time for the collision detect needs to be extended so that it gets at least 2 frames worth of sampling as the balls hit the inside of the cylinder. I increased the diameter of the balls and this seems to be effective.
LoganStargazer wrote:
...have you tried a very thick invisible hollow cylinder around it to prevent escapes?

Yichard's answer highlights the problem here:
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. You must think that the repelling force is exerted by the surface, not by the volume...

This is why I made the balls larger rather than going for the cylinder thickness. It did seem to me that I needed the initial collision with the inside wall for my effect. I'm not sure what would happen if a collision was missed there and then was detected at the outside surface.
LaryaBlackheart wrote:
...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...

I'm using a hollowed cylinder, capped at both ends with disks which are just flattened cylinders. The resulting surfaces are just that fortunately, simple surfaces, so all normal expectations apply.
Quit Button wrote:
IIRC there was some code added to move physical objects if intrapenitration was detected, which had the side effect of causing such objects to be thrown across the sim instead of being gently moved away from each other.

That's not a very comfortable thought. Doesn't apply in this case though since I've kept the container non-physical so that I can use touch events on it to control stop/start. One possible glitch I may yet need to deal with is that apparently collisions can cause touch_starts to become a bit uncertain in their response. I'll experiment and see if that does in fact become an issue.

Many thanks for the other suggestions on how to handle potential escapees. The lotto illustration was to help with picturing what I'm doing but I'm actually dealing with less balls and they aren't individually numbered as lotto balls would be. The balls already carry a position sensing script which causes them to die if they do escape their container.



_________________

~ Christine ~

Offline
 Profile  
 
 Post subject: Re: Physical interaction between moving/static objects
PostPosted: Sat Oct 22, 2016 2:29 am 
User avatar

Joined: Fri Jul 29, 2011 2:10 pm
Posts: 3989
Location: France
Christine Nyn wrote:
I'm not sure what would happen if a collision was missed there and then was detected at the outside surface.


quite simple: the physics engine would apply an outward impulse to them.


Christine Nyn wrote:
One possible glitch I may yet need to deal with is that apparently collisions can cause touch_starts to become a bit uncertain in their response. I'll experiment and see if that does in fact become an issue.


touch detection most probably uses the same code than physics collision, so that if the second is uncertain the first is too. But for tests physics collisions are more visible.



_________________
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: Sat Oct 22, 2016 3:35 am 
User avatar

Joined: Mon Jun 07, 2010 7:07 pm
Posts: 7936
Location: Nova Scotia, Canada
Again, there is no "inside the wall" in cases of collision detection because a case of inside is a collision, and will result in the bounce back. The problem case is where one physics frame is inside the container, and the next is out (2 stages). It's not a case of inside, within the wall, then out (3 stages). Inside the container wall is a collision. If it's escaping, it's not a collision with the container wall.


Offline
 Profile  
 
 Post subject: Re: Physical interaction between moving/static objects
PostPosted: Sat Oct 22, 2016 10:56 am 
User avatar

Joined: Tue Jun 14, 2011 7:47 am
Posts: 395
Location: UK
Jim Tarber wrote:
Again, there is no "inside the wall" in cases of collision detection because a case of inside is a collision, and will result in the bounce back. The problem case is where one physics frame is inside the container, and the next is out (2 stages). It's not a case of inside, within the wall, then out (3 stages). Inside the container wall is a collision. If it's escaping, it's not a collision with the container wall.

Good. Then my thought that I needed the internal collision to take place was correct.

I did experiment with the supposed interference of collisions with the touch_start event. There is something not right in that set-up which really needs more investigation. I may get around to that. Basically I found that using a single script in the jar itself to detect collisions and apply an impulse to the balls could be made to work but that then touch events seemed to get queued up behind collision events. They would respond, but after a rather variable delay. So I've scripted the balls instead to apply their own force, left the physics engine to get on with doing its own detection and collisions and just scripted the jar itself to look for the touch event. This works fine, although at the cost of more running scripts, so I'm happy for now.



_________________

~ Christine ~

Offline
 Profile  
 
 Post subject: Re: Physical interaction between moving/static objects
PostPosted: Sat Oct 22, 2016 12:25 pm 
User avatar

Joined: Fri Jul 29, 2011 2:10 pm
Posts: 3989
Location: France
If there are many collision events, the queue may take some noticeable time. I don't know if they are sorted by type, but if you throw an event when there is a long queue, you will have to wait some time to see it processed.

This is why using physics seems better, it is much faster than the events system. But it has limits too.



_________________
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  
 
Display posts from previous:  Sort by  
 Page 2 of 2 [ 16 posts ]  Go to page Previous  1, 2


Who is online

Users browsing this forum: No registered users and 3 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