Jump to content

physics mesh won't line up with model


Nala Farspire
 Share

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

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

Recommended Posts

Hi maybe someone can help me with a little problem that is driving me crazy.

I have created a series of models in blender, and I created a second model on layer 2 with basic geometric shapes to define the physics shape.  most of my models import fine but several of them do something rather odd and nothing I have tried seems to correct the problem.

a visual is really the only way to show what is happening.

here is my model on layer 1

blender1.jpg

here is my physics model on layer 2

blender2.jpg

and here is what I get in the uploader window (in the official LL viewer)

upload.jpg

I have tried creating and re-creating both models, giving the physics model a UV map, playing around with the collada export options, the end result is always the same.  why is it doing this and how do I correct it?

Link to comment
Share on other sites

It looks like the physics model has a different object scale then  the pipes.

What you could try is to set both (physics model and the model itself) in 'object' mode to a scale of 1,1,1 meters (if its blender units then use 2,2,2) and bring them also both also in object mode to location 0,0,0 and also rotation to 0,0.0.

Then switch into Editmode and scale them there into the size you want, and make the physics shape match the size of the pipes again.

This should ensure that their conform scale is the same.

In addition you could try to make sure the origins (pivot points) of both objects are in the same location. (try center which is 0,0,0) - it helps fixing problems based on offset positioning / interpretation of physics shapes and their corresponsing mesh.

PS: the physics model does not need to have a UV map. It is invisible to the renderer and thus this additional info is unneeded and being ignored. So this can not really fix the offset / scale issue - it's not being related.

With CTRL+A you can also apply rotation/location. In case they have different orientations.

Also - which is not visible in the screenshots, so i don't know if that's maybe the case: make sure the physic shape is not just "linked" (grouped objects) and same for the main object -  it has to be joined in 'one mesh'. I've seen a lot fancy ofsetting happening when people did just 'select' all the parts and then exporting instead of joining them.

Link to comment
Share on other sites

The second mesh (for the physics) was made by duplicating the original model and moving a copy of it to the second layer then building my cubes around it.  Blender reports the scale of both models being 1 1 1 and they both have the same exact origin.

I created 17 models using the method and I am only getting the physics model being misaligned on 3 of them.

 

Link to comment
Share on other sites

Oh yes and both models are a single joined object, not linked parts.

And that's not saying the model and the physics model are joined because they are not.  But each one is a single joined object.

I go to layer 1 select export collada, choose the selection only checkbox... Then do the same for the physics model on layer 2.

 

Link to comment
Share on other sites

The physics mesh, like the lower LOD meshes, gets stretched or squashed to fit the bounding box of your high LOD mesh. So you have got a bigger bounding box than you think. HGere is how that can happen. A is the original cylinder, and is its bounding box (switch 3D display mode in Blender). Now I go back to normal vew, into edit mode, and rotate the cylinder, as in C. Now the boundin box is bigger (D). The physics mesh will stretch to fit it, If I rotate the cylinder back in object mode, the large bounding box doesn't shrink, it just rotates (E). So even though the cylinder looks straight (F), it still has the larger rotated bounding box. When it's uploaded, it does exactly what you describe with the physics mesh (G). Look at the bounding box in Blender. If this is what happened, then you need to apply rotation and scale, not to the physics mesh, but to the high LOD mesh. That will shring the bounding box back to where it started.

bigbox.png

bigbox2.png

Link to comment
Share on other sites

Drongle has it perfectly explained (once more ^^)

And i suggested before as well  - and i think it's the last thing you didnt try yet: Hit CTRL+A with the object selected and choose apply rotation/ location and scale. And you should be good to go.

And allways try to do that step at the very end. It can prevent a lot of similar issues : )

Link to comment
Share on other sites

Just trying to get clear on this as it strangely happened to me today. I had a fairly complex object (joined) that had some part that had been modified with the BEND modifier (just putting that in if it is important). When I had uploaded previously (linkset and not joined) and use the basic cube as a physics model it was fine. When I joined the mes, the basic cube did a very ODD thing much like your diagram and I had a the bounding box from hell.

So I will try the 'fix' tomorrow and see if that helps. I didn't roate or scale the object while working but I did use that bend modifier (a new to me thing).

I guess I am still confused how these things happen. Even normals (lately they have happily been fine) seem to switch completely on their own when they are simple things like CUBES!  I mean I can understand if you are slicing and making your own faces, using ngons and such  --- but really!!!!  

OK. Been a tough day with a few thing accomplished. Just trying to learn something along the way :D. Thanks.

Link to comment
Share on other sites

If you mean Simple deform->Bend, then yes. I never used it, but if you look at the bounding box while tweaking its parameters, you can see that it has all sorts of effects that could have the same sort of results. When I tried, after applying the modifier, apply rotation and scale did make the bounding box normal, but I have no idea whether that will always work. I guess there may be similar problems with many modifiers. So looking at the bounding box is always a good idea.

  • Like 1
Link to comment
Share on other sites

Heya Chic,

one of the problems you can run into when using the basic cube as physics model and also with own physic shapes, is next to rotation/location/scale not being applied - the origin / pivot point.

The pivot point delivers for the physics engine 'where the center of mass' is for an object. Thus influences its whole physical behaviour as well as for scripted transitions / rotations etc. And Also the middle to calculate the physics shape to stretch out from.

The basic SL Cube has its origin right in the middle of it self.(in its center of mass)

When I had uploaded previously (linkset and not joined) and use the basic cube as a physics model it was fine.

When doing this all objects still remain with their own bounding boxes:
(and SL calculates a middle based on the single objects in the linkset  and  linkset root)

BoundingBox_Origin_01.png

above: non-joined - thus all bounding boxes remain in relation to their objects.

I added a bend modifier to the cube on top (to simulate your situation) that's why it looks so rotated. But as you can see even it's bounding box remains in the right orientation and in a cube shape. 

When I joined the mesh, the basic cube did a very ODD thing much like your diagram and I had a the bounding box from hell.

When we join all this now - we get now of course 'one bounding box' and 'one single origin':
BoundingBox_Origin_02.png
But watch to where the origin has wandered off to (Left image - orange dot) its now at the back left area of the whole object.

PS: where the origin snaps to is dependend on which object you selected at last before joining.

The modifier for bend doesn't really matter any more in this case, because it all is joined into one object and thus a new boundinx box based on everything within is calculated.

When we apply only rotation and scale nothing happens. Origin still stays in the same position.

But if we also apply 'location' -  it snaps to the former calculated middle of all individual origins (right image).
But this is still not in the complete 'center of mass' of the object's geometry it will prevent rotation based issues but still could imply stretching / covering issues from the physics shape. Because this will also stretch out from the origin of your model, and this can bring unwated results in certain cases. ( as well as wrong physical behaviour due to the center of mass being in the wrong spot)

If we now apply also Object - Transform - Origin to Geometry:
BoundingBox_Origin_03.png

The Origin snaps to the perfect middle of the whole joined object.

When now a basic cube as physic shape is applied it has a perfect center to stretch out from and cover the object.

It doesn't allways need to lead to odd results when the origin isn't right in the middle. But just as applying rotation and scale as well as location to prevent from calculation based offsets or orienting problems this helps to straighten things out and have them perfectly aligned.

That's why i allways do these steps at the end ->
Preventing offset / rotation issues:
CTRL+A..
..Apply rotation, scale
..Apply Location
Preventing Origin related Issues:
Bring Origin to the needed point (either center of geometry or to another spot when i need it to be somewhere else)
Do the same steps also for a self created physics shape.

These steps have of course to be repeated when a new object is joined (with a different position/location and origin, that is)

PS: in cases where you actually need the origin to be somewhere else (like on the side of a door etc) and you make your own physics shape. Make also sure to have the origin of the physic prim on the same spot. So they align perfectly and don't behave differently or go through offsets / displacements.

  • Like 1
Link to comment
Share on other sites

Hi there oh great one.

Good news is that I knew about Location to Geometry and do that ALL the time. Amazed that I haven't had this problem before though. I am going to blame it on the bend modifier as I know I went in there (using tutorial) and did the location, rotation and scale thing.

Anyway, it took a couple of tries but now looks perfect. TY!   I can't upload as aditi appears to be broken but I can SEE in the uploader that it is fine. Will remember this now and most likely stay away from some of those modifiers :D. Expeirmentation leads to learning but sometimes painfully *wink*.

Thanks again for your help. Sure others will learn from this too.

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 4119 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...