Jump to content

Mesh Physics


Kavorka
 Share

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

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

Recommended Posts

I am creating trees and all I want the physics to do is stop the avatar from walking into the trunk.  When I upload my physics shape, it scales it out to match my object.  Is there any way to stop it from doing this?  What if I want parts of my mesh to be able to be walked through?

I make my shape right over my mesh, so it is the size and position that I want.

Anyone have any work arounds?

Link to comment
Share on other sites

The "bounding box" of all LOD models and physics model are set to the same size of the highest LOD, so make sure all models are the same size before exporting.

You could make a single triangle plane for the bottom. If your leaves are higher than your trunk, make a plane for this aswell. You could also put both planes on top, so people can rezz the tree on a sloped hill or something.

Link to comment
Share on other sites

Try uploading a simple mesh cube. Scale it to the size of your tree trunk and link it as the root. Last, set all but the root prim to physics shape "None" (from the features tab of edit).

This should result in the same LI and let people bump into the tree.

 

One way to build this into your model would be to make the trunk a seperate mesh with the same cube for its physics shape. Then use the same linking and physics setting tricks once inworld. Leaving the other branches set to "None".

 

HTH

Link to comment
Share on other sites


Alisha Matova wrote:

 

This should result in the same LI and let people bump into the tree.

 


That depends really, adding another object doubles the server weight.

In this particular case it will probably work, I'd use something simpler than a box though, a bottomless threesided pyramid should do the trick, or even two crossing triangles. No need to use 12 triangles for something as basic as a physical post.

Anyway, if using two objects instead of one is no issue, I think your way is preferred over the one I proposed...

Link to comment
Share on other sites

Here is a way of doing this which avoids the linked object problem (might get unlinked unless no mod) and any problem with the placement of the extra physics. It is not quite as simple as the other methods, and the details are important. It depends on the properties of the solid decomposition (Analyse button) in the physics tab of the uploader. With this decomposition method, flat planes that do not naturally make a solid are recognised in setting the physics shape bounding box, but disappear from the physics shape generated. Thus they can be used to neutralise the effect of the bounding box expansion without affecting the intended physics shape. This is best illustrated by an example.

At the top of the picture is a simple tree in Blender, visual mesh on the left and physics shape on the right. The left pair shows the bounding boxes in pink. The important thing is that they are the same. Now if we look carefully at the physics mesh in the pair on the right, we can see that it has a copy of the tree trunk (8 sided tapered cylinder), which would have a much smaller bounding box and would get stretched to produce the problem we are trying to solve. Added to that are two triangles (yellow highglights) that extend to enough corners to make the bounding box the same as that of the visual mesh. The most important detail is the direction of the normals, shown by the blue lines protruding from the surfaces. The normals of the added triangles point in towards the trunk and towards each other. That makes it impossible for a convex solid shape to be made with the faces pointing that way.

atree.jpg

From left to right at the bottom: [first] The preview with the physics shape before clicking the analyse button, where the two triangles can be seen. [second] After selecting solid decomposition method and then clicking the Analyse button, you can see that the triangles have disappeared, leaving a single 9 vertex hull. [third] This is the uploaded tree rezzed and textured inworld. To use the provided physics shape the Physics Shape Type must be set tp "Prim". [fourth] using the Develop->Show Metadata->Physics Shapes display, we can see that the physics shape is just the trunk cone, and that it is not stretched to the tree's bounding box.

The physics weight of the particular tree is 0.8 (independent of size because it is decomposed). The tree has a land impact of 1 up to 12m height. Of course nobody would want to use such a simple mesh tree, but the principle will work with more complex meshes, both visual and physical.

  • Like 3
Link to comment
Share on other sites

Strange. If you uploaded with the physics shape, it should offer the "Prim" option. That should only go away if you don't specify a physics shape. Then the uploader only makes the default convex hull for the whole mesh, which is what is shown when you choose the Convex Hull physics shape type. It sounds a if your physics shape did not get uploaded.

Did you go through all the steps on the physics tab? Choose Load from file; Browse to find the file; See the shape; Select "Solid" from the method (the default is "Surface"); Click "Analyse"; See the vertex/hull counts; See the triangles disappear; Click the Calculate button; See the calculated weights and fee; Click upload button.

If all that went as expected, try disabling the slm mechanism by Advanced->Show Debug Settings; type "MeshImportUseSLM"; Set the value to false.

PS - what viewer are you using?

Link to comment
Share on other sites

Okay, I was able to make the prim option show up by first selecting "lowest" for the physics, then "from file" and loading up my file.  But when I I check the physics meta data, it is using the lowest setting for physics and not my file even though I selected "prim".

Link to comment
Share on other sites

Is that Official viewer version 3.4 or 3.5 ? You can see in Help->About Second Life.

The situation you describe after selecting lowest then load from file is very strange. You say you see the triangles in the preview before clicking Analyse. Ao the uploader must have accepted your physics mesh file. But then it's reverting to the previous choice when you upload ??!!  Do you see the number of vertices and hulls? What are the numbers? The limits are 256 hulls and 256 vertices per hull. If you have anything near those numbers, your physics mesh is too complex. If you have more, it should not upload, although I would expect it to give you an error message rather than using the previously specified shape!

Here is what the numbers are for my test tree...

ba.png

Link to comment
Share on other sites

Okay, got it working.  What happened is that I exported it without joining the trunk and leaves meshes so I could apply 2 textures.  this made it set a physics shape for each object.  Now, I joined the meshes, keeping the material data and was still able to add both my alpha leaves texture and my tiled bark texture to the parts and only load one physics shape.

And btw, my shap is 5 triangles and 1 hull.

So, everything works out good.  Thank you guys for all your help :)

Link to comment
Share on other sites

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

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

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...