Drop object with centre of gravity?
-
Is there a plugin that will allow you to drop geometry (group or component) and have it "land" as if it was a real object placed on the ground?
I don't want to use SketchPhysics - as it's a big packages that does more than what I want and it's know to cause conflicts with other plugin.
I'm not looking for simulating bounce or anything - just want to rest on ground more naturally.
If there is no plugin for it - anyone familiar with the math?
And I so assume the geometry would be solid. -
I think the mathematical steps would be:
- calculate center of gravity
- drop until a first point hit the ground
- rotate object in the vertical plane with both points in it
- rotate around line which connects the first two ground points until a third point of the object hits the ground
-
Could you do a two part process? The smart drop component plugin combined with something that calculates the component origin to lowest point on the object?
Is there a plugin already that recalculates origin based on geometry? It can be time consuming to fix the origins on components individually if there are a lot of messed up ones. In any case, I'd love to see what comes of this.
-
@andybot said:
Could you do a two part process? The smart drop component plugin combined with something that calculates the component origin to lowest point on the object?
No - it's not that simple. Smart Drop doesn't work for this.
@andybot said:
Is there a plugin already that recalculates origin based on geometry?
What do you mean by "origin" in this context? The point in the geometry that hits the surface ground first?
If you mean component origin then it would be of no significance - it's the actual geometry I'm interested in here. -
oh man, that is complicated! If anyone can figure it out...
-
Ane - I have no idea what so ever how that is calculated.
-
If the vertical projection of the center of gravity is not over the standing face, the object have to be rotated in the vertical plane with the center of gravity in it. I tried manually with the attached model, but couldn't even guess the desired endposition. What would you think should be the position in this case?
-
Not only that, SP uses center of bounding box, not the actual center of gravity!
Maybe try exporting ur model to blender, and simulation test ur simulation there?
-
Another way is to collect some of these NASA Aerodynamics
formulas together and calculate it all up.Or write ur own "SketchyPhysics", using some physics engine; Bullet, might be a good one
-
I wrote a tool that using 'slices' to find an object's [approx] center-of-gravity...
You could project every vertex.position in the object down to the surface below as a raytest using Z_AXIS.reverse.
The one with the shortest distance to raytest[1] gives the vector to move it down vertically, so it touches the surface as if it were dropped vertically.You really ought to make points along all edges in the object at minuscule centers and test these as a surface might well have a 'bump' that avoids vertices but which would affect the object.
BUY another alternative might be to do the nearest vertex drop and do a temp grouped intersect between the two objects, if there's a result then there's a 'bump' that the object should have caught on and you can shunt the object up to suit that,,,Now you have an 'anchor' point of sorts.
You know the vector from that 'first point of contact' and the CoG.
If it's parallel with the Z_AXIS it's balancing on a pinpoint - but chances are it's not !
So... Rotate the object around the cross of Z-AXIS and that vector by small incrementing angles.
Each time do a temp intersect with the surface.
If there's a result back up in 1/10 increments until there's virtually none.
The object is now on the surface and tilted downwards towards it CoG until it rests on the surface.
If the CoG is not vertically on the vector from the 'first point of contact' to this 'second point of contact' then the object needs to rotate yet again - around this vector - again testing for intersections until a 'third point of contact is found'.Now the object is resting on the surface with three points of contact and the CoG is somewhere within that triangle of points - it is stable.
If in any of the two points of contact steps the CoG of a vertically aligned with the vector you can choose for a 'dangerous stability' - balanced on a 'knife-edge' - or choose to tilt randomly in either direction until a 'hit' with an intersect give another point that is stable...
It's actually very complex as the initial anchor might no longer be on the surface after the second or third tilt !
Advertisement