Jump to content

Making physics HELP!


Jacki Silverfall
 Share

You are about to reply to a thread that has been inactive for 3103 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

What you need to do is select your wall with your Build/Edit tool.  Then go to the Features tab and fiddle with the dropdown menu for Physics Shape Type.  It defaults to Convex Hull.  Change it to Prim.  That should make it so you can walk through the door.

  • Like 1
Link to comment
Share on other sites

Although there are options in the mesh uploader which can attempt to create a workable physics hull/shape from your original mesh, the best result is usually obtained by modeling a specific physics shape to match.

In essence, you create a SEPARATE basic mesh object to act as your physics "hull" in SL. This mesh is NOT visible, it is purely used for AV interaction with your main mesh object. During the uploading process for your original mesh object, you just point the uploader to the specific physics mesh file, which is then combined in SL to give your original mesh its physical properties.

Ideally, you just create a very simple mesh object which best describes the way you expect your main mesh object to be interacted with. Going by your description, probably a few basic box shapes to act as the walls themselves, leaving a gap between them for the doorway itself, and if required a box above and below the doorway (if AVs need to step up into the doorway itself etc).
To keep the actual LI cost of the physics low, you should stick to large triangles in your physics mesh - the larger and simpler the better (removing any redundant faces (those that will not be interacted with, such as UNDERNEATH the walls etc) will help trim the LI). This is due to how the SL physics engine works - it handles large basic shapes for interaction far more efficiently than lots of small triangles - and hence you will be rewarded with a low LI cost for efficiency. Ideally, your physics cost should NOT exceed the other LI factors in your mesh object.
Also, ensure the BOUNDING BOX of your physics mesh object matches that of your original mesh object (the dimensions overall should match corner to corner. This is so that your physics mesh accurately aligns with your original mesh object.

When uploading your main mesh object, in the physics section, you simply direct the uploader to your specially created physics object. Easy. After rezzing your object, set its physics properties via the build menu and you are set.

Definitely NOT as complicated as my description might sound - once you've done this a couple of times, it's a piece of cake.

:matte-motes-smile:

  • Like 2
Link to comment
Share on other sites

I tried that and set it to lowest and I'm able to walk through half of the door opening. And yes the option  for prim was in the edit this time. But that's still not good enough. I need to be able to walk through the whole doorway.


Thank you I'm learning more and more. :)

ETA Unfortunately changing the feature to Prim doesn't do anything.

 

Link to comment
Share on other sites

Jacki: You could make a plane to match the wall's dimensions, but you would still need to model in the gap for the doorway itself. Also, I'm not sure if your wall mesh had THICKNESS to it... if so, you would need an equivalently thick physics mesh to accurately match. To attain "thickness", you could just extrude your mesh plane to suit (doorway included), and then "fill in" the opposite side to make it solid.
SIDENOTE: The normals per mesh face are used to describe the exterior surface of a physics hull in SL - so ensure all normals are facing outward (NOT into the "solid" parts of your mesh).

The physics object should be saved as a SEPARATE FILE on your disk. (ie: Your original wall mesh object is a totally separate file to your physics mesh object file - so you have two distinct files).
During the uploading process, after you have the original wall mesh in the window, you go to the physics section of the uploader, and point it to the separate physics mesh file you have saved. When you do this, the uploader will use the physics mesh file as its "data" for SL physics of your original wall mesh.
Then simply upload. The physics mesh file's data is combined with your original mesh file - so it's all just a single upload (the two files become one in SL).

:matte-motes-smile:

  • Like 1
Link to comment
Share on other sites

I remodeled the plane to match the wall with the opening for the door as you suggested. I extruded the palne for thickness. I also made sure all the Normals were fecing out. I made it a separate dae file. Then uploaded everybody into SL. when I the plane to the physics tab I slected solid in the #2 step. It didn't work. I still can't walk through the damn doorway LOL. Getting frustrated but understanding more about how this is done. I just can't get it to work :(

Oh wait! I did it again, leaving the #2 step Surface and not solid. Uploaded it and set the wall to Prim and I walked through it!!  Does the happy dance!!

I hope I have done it right :)

Thanks and hugs!!

Link to comment
Share on other sites

Congrats Jacki - Sounds like you have the essential physics concepts covered at least. :matte-motes-smile:

In a nutshell: SL uses the separate physics mesh you made as its "physical shape" for your original mesh object.
This theory can be applied to pretty much any mesh you wish to create - You can create a very detailed main mesh object, and for its physics you just create a very simple shape to emulate its interactive properties.
When modeled efficiently, the LI of the physics shape shouldn't adversely impact the LI of the overall mesh you upload to SL - it will probably be one of the other LI factors that have a higher value (and hence the Land Impact cost of your mesh).

Enjoy your physics! :matte-motes-wink:

EDITED TO ADD: Check out Drongle's post over the page for a more in-depth explanation of physics hulls (Drongle is a physics champion!)

:matte-motes-smile:

Link to comment
Share on other sites

I guess ypu got there while I was making this picture. Never mind, it might be useful to someone else. Maev's suggestion of making the triangle-based physics shape is best when it's part of a building mesh, but (a) to do this, do not extruse the wall to make it thick. That will leave thin triangles along the edges which will increase the physics weight. If you want the more accurate collisions from a thicker wall, then you can do the extrusion and delete the edge faces. (b) to get a triangle- based shape, you must NOT press "Analyse".

The picture is another way, when you want the doorway to be self-contained. It uses small boxes for the physics shape which is bad for a triangle-based shape. So it's a hull-based (Analysed" shape. At the bottom left is the Blender 3D window showing two separate objects, the visual mesh darker and the physics mesh lighter orange. Note that the boxes comprising the physics mesh are as simple as possible and not overlapping. Simplicity keeps the physics weight low and non-overlap avoids probelms with the "Analyse" function.

At the top is the upload dialog, with the physics tab selected (pink). The physics mesh is set to "From File" and the dsae of the physics mesh is selected (orange). Now you leave the method set to "Surface" (or solid - with non-overlappinf boxes, either will work) (blue). Then you click the "Analyse" button (green). When thec analysing is done, the dialog will tell you the number of hulls and vertices (red). In the preview, the explode slider has been used to show the components of the physics mesh (yellow) separately from the visual mesh (white).

The last three panels at the bottom show the imported mes - first in normal view, then in physics shape view (Develop->Render Metadata->Physics Shapes). First is the physics shape when the physics shape type is set to "Convex hull", which you can't walk through; second is the physics shape when its type is set tp "Prim", which you can walk through.

physi.png

  • Like 3
Link to comment
Share on other sites

hi :)

I started this before going ot work this morning anyways ............. i won't need to add any comments except to ask Drongle , is this what you mean by "triangle-based physics shape" ? If so you also said  

"(b) to get a triangle- based shape, you must NOT press "Analyse".

Using the method below (which i thought was "triangle based" ) if i don't hit the Analyse button i can't walk through the opening , but if I look at the wall with Physics Shapes enabled  it shows very clearly an opening ?

Wall Physics expl.png

 

analyze non analyzed.PNG

I just noticed in the not Analyzed Physics shape that it is showing triangles and the Analysed version is showing a single face. So when you say traingle based its not how it is modelled in Blender but how the Uploader is treating the physics mesh ?

  • Like 1
Link to comment
Share on other sites

"So when you say traingle based its not how it is modelled in Blender but how the Uploader is treating the physics mesh ?"

Yes, exactly. The Analyze button makes the uploader use the physics mesh (or the low-LOD mesh if you don't specify one) to make a series of convex hulls that approximate the mesh.How it does that depends on the mesh and the settings, and whether you then use the Simplify button. You can see that it has done this because the bottom below of step 3 tells you how many hulls there are. (In this case, it has made six flat planes, with four corners each, because you used the Surface method.)

When you don't "Analyze", the physics shape will be exactly those triangles that the physics mesh is made of, and they will show up with thier edges in the physics shape view. The uploader will show the triangle count, but no hull count. You certainly should be able to walk through the door in the triangle-based shape you show, as you can clearly see the hole. If you can't, something else must be wrong.

Either of these shapes needs the "Prim" shape type setting to use it. Otherwise, the shape will be the single default convex hull which will always fill in the door.

The physics engine treats these shapes very differently when it has to detect collisions. More efficient algorithms can be used for convex hulls, and they don't depend on the size. So the physics weight of the Analyzed shape doesn't vary with the size of the mesh. With a triangle-based shape, it has to test for collisions with each triangle. For some reason, this is more work for small triangle. So the physics weight is higher the smaller the mesh is (and therefore its triangles are).

Generally, physics weights are smaller for large objects with only large triangles. For smaller objects, the physics weight of the Analyzed shape will be smaller.

Link to comment
Share on other sites


Drongle McMahon wrote:

 

When you don't "Analyze", the physics shape will be exactly those triangles that the physics mesh is made of, and they will show up with thier edges in the physics shape view. The uploader will show the triangle count, but no hull count. You certainly should be able to walk through the door in the triangle-based shape you show, as you can clearly see the hole. If you can't, something else must be wrong.

That question mark in red in the second picture showing the NON Analyzed wall mesh wasn't asking if i would be able to walk through the opening but asking WHY I can't .

A few weeks ago i was trying to help someone in world asking the same question as the OP of this thread and explained the same method as i show in the first picture but not saying to hit the Analyze button because i was sure in the past (many months ago)   I hadn't needed to . I always make simple physics shapes for all my meshes just because it keeps the Physics count in the LI equation low and haven't need to actually use a physics shape as in this wall example for a very long time . But after trying to help this other person,  much pulling of hair etc and asking in group chat someone suggested i use the Analyze button and it worked , ie i could walk through the opening ........

So now i ask what could i be doing wrong that is preventng me and at least 2 other people (the one i was helping and the one who suggested using the Analze function ) from walking though a opening in a NON Analzed mesh ?

As you have said if i can see the opening why can't i use it ?

 Edited to add :

I did some experiments and it has something to do with size . The 2 walls on the right are Edit > Shift Drag copies of the original and then resized.

Wall Not Analyzed resized.png

 Edited a second time to add :

Ok I did some more experiments this morning with the NON Analyzed wall (2 simple plains used for Physics shape )and found out  that if the thickness in the X axis is too small for some reason it stops me walking through the opening .

Around about 0.5m seems to be the minimum .

wall x thickness.PNG

Link to comment
Share on other sites

OK. I did some experiments. I would definately call this a new bug. It's quite complicated, so I will try to explain the relevant background. First, there is a mechanism whereby the physics shape type used by the server switches from Prim to Convex hull without telling the viewer. This happens when one dimension of an object reaches a certain minimum. This minimum used to be 0.01m, but was made much bigger some time ago. This broke a lot of content, including thin walls like yours. It doesn't show up on the Physics Shapes display because the change is hidden from the viewer. So you can only detect it by trying to walk through (bug #1). This is what is stopping you from going through the door although the display says it's there.

However, you provoked me into some experiments that reveal another situation that certainly did not happen last time I tried anything like this. The effect doesn't need a doo, just two square planes opposite each other. Direction of normals doesn't matter. If you upload this as a thin wall (Aditi or main grid), and set it to shape type Prim, it looks fine while it's thin, because it's secretly using convex hull, as described above. However, if you stretch it so as to move the planes apart, when it reaches the point where it switches to actually use Prim type, there is a sudden and huge invreae in the physics weight, to several thousands! (bug#2). This is certainly new behaviour to me. With the example I started with, a wall with door holes, the physics weight went above 15000, and it disappeared amid some error messages saying the parcel was full. Did you look a\t the LI and physics weight of the wall you stretched to be thicker?

The effect can be mitigated by making just a single face linking the two planes. However, this causes a relatively small, but still large increase in the physics weight because it has to be narrow triangles. Consequenly, this has essentially broken the use of flat planes to make efficient physics shapes for buildings while maintaining wall thickness.

The effect depends on having two planes. A single plane can be stretched without problem. A door in it can be walked through even if it is squashed to minimum thickness. (I would love someone to explain that.)

Unfortunately, I am not going to submit a jira for this. Since I am not allowed to see what others have submitted, I can't tell if someone else has already submitted one. It takes a substantial amouint of work to prepare a jira with a good reproduction and test files. This is completely wated if someone else has already done it. LL obviously doesn't care if my time is wasted, but I do.Furthermore, there would be no opportunity there to clarify the problem by discussion with others.

I would be grateful if anyone else knows whether this affects contenty uploded before the problem appeared - in other words whether it's a physics engine change or an uploader change. I can't test that because all the suitable content I has was lost with the Aditi password change bug. Any other opinions as to whetherv this is a bug?

My guess would be that these problems were brought in with changes made for pathfinding. The timing is about right for that.

 

Link to comment
Share on other sites

Hmm. I just made another model. This time I started with the opposite faces of a cube, so they were already far apart. This does NOT have the problem with huge physics weight. Thoe prvious one still does. So you can make a wall with two planes and a door if you make it very thick and then squash it inworld, and that avoids the high weight issue. Since the end result is identical, I think that confirms that the high weights ar a bug. Unfortunately, you still can't have a door if the wall is thinner than 0.5m. because of the hidden shape type switch. I do think we shuld lobby for a decrease in that limit.

There is something strange going on. Another one made thin to start with doesn't have the physics weight problem. I will have to compare the collada file to see if I can spot the difference.

Link to comment
Share on other sites

No... see my last post. It doesn't always happen. Now I have been playing with the collada file, and it looks like that may be an unusual phenomenon. I can change it from having the high weight to not having it by just changing one of the geometry coordinates from 0.1188407 to 0.1188408. That's less than one part in a million! It's way below the accuracy of the 16-bit format used by the uploader to represent the coordinates, and it's not at a point that would be expected to give a rounding error with that format. So that is very puzzling. It does make one of the planes not quite flat, by that amount, but making it equally non-flat by setting it to 0.1188409 does not give the problem. Neither does it resolve the problem if the quad face is triangulated before export. I have no idea how often this effect is likely to turn up. I have to guess it is rare enough that it hasn't been noticed, because otherwise the effects could be catastrophic. I suppose I will have to do a jira after all :matte-motes-sour:

Here's the offending collada (no uv for brevity .. that doesn't affect it), in case anyone else wants to test it. Use the same mesh for all LODS. Select high LOD for physics and don't press "Analyze". Rez, switch to Prim shape type and watch the physics cost when you stretch it (and see it go red in physics shape view). Change the odd X coordinate and see the effect. 

<?xml version="1.0" encoding="utf-8"?>
<COLLADA xmlns="http://www.collada.org/2005/11/COLLADASchema" version="1.4.1">
  <asset>
    <contributor>
      <author>Blender User</author>
      <authoring_tool>Blender 2.63.22 r50948</authoring_tool>
    </contributor>
    <created>2012-12-01T12:09:02</created>
    <modified>2012-12-01T12:09:02</modified>
    <unit name="meter" meter="1"/>
    <up_axis>Z_UP</up_axis>
  </asset>
  <library_geometries>
    <geometry id="Cube-mesh" name="Cube">
      <mesh>
        <source id="Cube-mesh-positions">
          <float_array id="Cube-mesh-positions-array" count="24">
0.1188408 1 -1
0.1188408 -1 -1
-0.1188408 -1 -1
-0.1188408 1 -1
0.1188408 1 1
0.1188407 -1 1
-0.1188408 -1 1
-0.1188408 1 1
</float_array>
          <technique_common>
            <accessor source="#Cube-mesh-positions-array" count="8" stride="3">
              <param name="X" type="float"/>
              <param name="Y" type="float"/>
              <param name="Z" type="float"/>
            </accessor>
          </technique_common>
        </source>
        <source id="Cube-mesh-normals">
          <float_array id="Cube-mesh-normals-array" count="6">1 0 0 -1 0 0</float_array>
          <technique_common>
            <accessor source="#Cube-mesh-normals-array" count="2" stride="3">
              <param name="X" type="float"/>
              <param name="Y" type="float"/>
              <param name="Z" type="float"/>
            </accessor>
          </technique_common>
        </source>
        <vertices id="Cube-mesh-vertices">
          <input semantic="POSITION" source="#Cube-mesh-positions"/>
        </vertices>
        <polylist count="2">
          <input semantic="VERTEX" source="#Cube-mesh-vertices" offset="0"/>
          <input semantic="NORMAL" source="#Cube-mesh-normals" offset="1"/>
          <vcount>4 4 </vcount>
          <p>0 0 4 0 5 0 1 0 2 1 6 1 7 1 3 1</p>
        </polylist>
      </mesh>
      <extra><technique profile="MAYA"><double_sided>1</double_sided></technique></extra>
    </geometry>
  </library_geometries>
  <library_visual_scenes>
    <visual_scene id="Scene" name="Scene">
      <node id="Cube" name="Cube" type="NODE">
        <translate sid="location">-0.5001515 0 0</translate>
        <rotate sid="rotationZ">0 0 1 0</rotate>
        <rotate sid="rotationY">0 1 0 0</rotate>
        <rotate sid="rotationX">1 0 0 0</rotate>
        <scale sid="scale">1 1 1</scale>
        <instance_geometry url="#Cube-mesh">
        </instance_geometry>
      </node>
    </visual_scene>
  </library_visual_scenes>
  <scene>
    <instance_visual_scene url="#Scene"/>
  </scene>
</COLLADA>

 drs7cut2skew2.jpg

Link to comment
Share on other sites

Confirm.

X dimension (meters)                 Physics costs

0.1 to 0.49                                           0.4

0.5 to 0.8                                    Object returned to inventory because the parcel is full

0.9                                                      5974

1                                                         5377

2                                                         2688

4                                                         1344

8                                                          672

16                                                        336

32                                                        168

64                                                         84

 

at least the Physics cost changes proportinally to the X dimension :)

Link to comment
Share on other sites

And, using +/- 0.1 as the x coordinates and having the odd one with the following values, the weight decreaes very roughly in inverse proportion to the displacement. The increase stops at about the point where it's 1/65000 of the width. That's consistent with rounding to the 16 bit integers. For some reason, the effect remains for much smaller displacements, but eventuall disappears. It appears that the physics shape is getting a narrow triangle added to it and that is where the high weights are from. It would be exceptional to have the effect be as large as here, because that's a very small displacement, but spurious triangles could be having significant effects on phuysics weights with smaller displacements. Definately seems like a bug to me.

Here are the coordinates...

 0.1  1 -1
 0.1 -1 -1
-0.1 -1 -1
-0.1  1 -1
 0.1   1  1
 0.100004 -1 1   <- this has the odd x coordinate which is varied.
-0.1 -1  1
-0.1  1  1

These are physics weights for two 2x2 faces stretched from 0.2 apart to 0.5 apart, where the effect starts...

odd point = 0.110000000 : physics weight = 7
odd point = 0.101000000 : physics weight = 67
odd point = 0.100100000 : physics weight = 663
odd point = 0.100010000 : physics weight = 5057
odd point = 0.100001000 : physics weight = 10815
odd point = 0.100000100 : physics weight = 10804
odd point = 0.100000010 : physics weight = 10815
odd point = 0.100000001 : physics weight = 1
odd point = 0.100000000 : physics weight = 1

 


 

Link to comment
Share on other sites

  • 6 months later...

Hey Drongle, I just ran into the very same issue you discovered and described here. A simple 2-plane physics shape that gave me physics cost greater than 1000. I take it by editing the collada file in a way that there will only be nicely rounded values is a workaround, right?

Other than that, did you file a Jira on this one? If so, what's the status on it?

Thanks in advance!

Link to comment
Share on other sites

In this exact case, removing the small variations so that the planes were exactly flat did work. However, there is a series of possibly related problems with the triangle-based physics weight calculations that are less easily dealt with. If you are interested, you can look up my threads, physics weights episodes ... I did make a jira on this specific one and it was closed as "unactionable", apparently because it was considered that changing the calculation might affect existing objects. Obviously, it would be trivial to check both old and repaired calculations and keep the old one if it were lower - so I guess that just means they preferred to ignore the error. The other effects I found were reported in another jira, although documented in greatre detail in this forum. It was accepted ("released" into internal jira) but was classified as "trivial", despite the regular more than tenfold variation in physics weights for identical geometries of quite practical shapes. I have to assume that means that won't be fixed either.

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 3103 days.

Please take a moment to consider if this thread is worth bumping.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...