Rotating linked bodies

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Rotating linked bodies

Postby misho » Sat May 06, 2017 11:42 am

Is it possible to set position and rotation on a collection of linked bodies? I have a structure linked by "hard" joints, and I need to set its position and rotation. How is that done? Can I "wrap" them into a skeleton and then move/rotate the skeleton?

Thanks!
Misho Katulic
CTO, FSX SpacePort
TerraBuilder
www.terrabuilder.com
misho
 
Posts: 673
Joined: Tue May 04, 2010 10:13 am

Re: Rotating linked bodies

Postby Julio Jerez » Sat May 06, 2017 12:21 pm

NewtonBodySetMatrixRecursive
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Rotating linked bodies

Postby misho » Sat May 06, 2017 7:32 pm

Thanks! If I'm reading this right:

"This function applies the transformation matrix to the body and also applies the appropriate transformation matrix to set of articulated bodies."

All the attached bodies will be appropriately rotated - correct? However - the body I apply this to will be used as a pivot, correct? If so, that's not what I need to do. I need to rotate the assembly of bodies around their joint centre of geometry. Even if I try to figure out which body looks like a "centre" of assembly, chances are the actual centre of geometry will not be precisely where that body is.
Misho Katulic
CTO, FSX SpacePort
TerraBuilder
www.terrabuilder.com
misho
 
Posts: 673
Joined: Tue May 04, 2010 10:13 am

Re: Rotating linked bodies

Postby Julio Jerez » Sat May 06, 2017 8:17 pm

you the root body of the articulation of any body, the you calculate the matrix for that body and
you call that function.
It will transform that body along with all bodies attach to that one via a joint.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Rotating linked bodies

Postby misho » Sat May 06, 2017 9:14 pm

Again, my root body might not be where I want my pivot to be. Also, My assembly doesn't necessarily have a "root body" from which all the other bodies branch out. I am using CustomHinge to rigidly link a bunch of objects into an assembly, which in my case forms a space station (space structure) that can be of various shapes and designs.

Consider a case of ring (wheel) space station in orbit, consisting of 8 bodies linked into a circle:

Image

The centre around which I'd like to rotate is the blue dot... not any of the red centres of the individual bodies. How do I go about doing this?
Misho Katulic
CTO, FSX SpacePort
TerraBuilder
www.terrabuilder.com
misho
 
Posts: 673
Joined: Tue May 04, 2010 10:13 am

Re: Rotating linked bodies

Postby Julio Jerez » Sun May 07, 2017 8:19 am

say you take the object with the red dot as representative of the entire array.

say that at creation time the origin is at the blue dot location repented by matrix r0
also the location the red bot representative is m0.
then offset l0 between the origin is a constant matrix that can me calculated as

r0 = l0 * m0

the is there is a local matrix l0 the when multiplied by the representative matrix m0, produce the matrix location r0 of the entire configuration ;
for here you can deduce the value of lo

lo = r0 * mo^1;

and is the offset matrix, that can simply be used to place the entire at any location r by doing this.

Code: Select all
m = ro^1 * r
NewtonBodySetMatrixRecursive (representativebody, m)
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Rotating linked bodies

Postby misho » Sun May 07, 2017 2:57 pm

Thanks Julio! Excellent - so basically - an offset matrix. I didn't know I can specify the offset in that call :)

So, I basically need to find a geometric bounding box of the entire assembly and determine the geometric centre of this box, set that as my r0 matrix and calculate the offset matrix l0.

Just as an aside question - is it possible to make circular linkage using hard joints, as in my diagram? Or would that produce an instability of some kind?
Misho Katulic
CTO, FSX SpacePort
TerraBuilder
www.terrabuilder.com
misho
 
Posts: 673
Joined: Tue May 04, 2010 10:13 am

Re: Rotating linked bodies

Postby Julio Jerez » Sun May 07, 2017 4:13 pm

to the matrix question yes that's the general idea. just to clarify you do not pass an offset to the function, you need to concatenate the matrices into one by multiplying the inverse of the offset calculated by the aabb preduce.

to the circular ring of bodies connect by joint, yes absolutely you just connect the pieces the with the joints you want, it will work, in fact all joint are rigid now, look at this video it links 32 bodies with rigid joint which I think is something to what you want.
https://www.youtube.com/watch?v=OVN3jB-MrT0

in fact you can make something like the space station and should work. :wink:
Make sure you have latest newton.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Rotating linked bodies

Postby misho » Sun May 07, 2017 5:31 pm

Wow that is awesome! Those joints in video are obviously rubbery, and what I have (for now) are rigid joints. That is amazing, how that reacts real time! :shock:

Yup I understand how to create resultant matrix (which includes offset). :mrgreen:

Another somewhat unrelated question:

From what I understand, all of the Newton collision primitives are convex. Have you considered using some kind of a boolean scheme, so that you can assign negative collision volume to a primitive?

For example, defining a cylinder primitive, and then defining another coaxial cylinder with a smaller radius, and assigning it a -ve collision volume would render the first cylinder basically a ring, with the "inside" volume "cut" by the second primitive "cylinder" and rendered a "free space"...

Or, a box, with a smaller box inside it with -ve collision volume, would make it a completely closed "room".

Any thought on this?
Misho Katulic
CTO, FSX SpacePort
TerraBuilder
www.terrabuilder.com
misho
 
Posts: 673
Joined: Tue May 04, 2010 10:13 am

Re: Rotating linked bodies

Postby Julio Jerez » Sun May 07, 2017 5:53 pm

Boolean collision sound like a good idea, bot they are very difficult to tread geometrically.
There are some images precision algorithm that use can be used to calculate contact with Boolean, but they are too expensive to use in CPU, and even for GPU they do no scale to nicely.

if you use the latest NVidia Flex collisions, it loo very impressive for demos that show may 100 or200 20 thousand postiches, but those are very contrive scenario that do not scale up wen you realize that you nee you use from 100 to thousand particle to model one object. The you end of a endless phase of parameter setting modeling boxes with punking size particles.

Not I do not see a way to do actually geometrical collision calculation using Boolean operation anytime soon.
There is a game using newton call Future pinball that uses that method for carving holes on the pinball table using the collision callback and rejection collision, and it works very well because it runs a 300 frame per seconds. but this is not something that can generalize as a feature of the engine.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Rotating linked bodies

Postby misho » Fri May 26, 2017 3:28 pm

Ok, thanks Julio for that explanation.

So, I have a situation where I am simulating a spacecraft docking hatch mating with a docking ring (left objects in the image). I'd like for this to be a fairly precise simulation, so I need a concavity of the ring, so that the hatch can fit into it or, collide into its rim. I'm guessing my collision objects would look something like the objects on the right in the image, correct?

Image

Any other ideas how to simulate this?

[edit] I think 4 blocks, or even 3, would do, instead of 8... :mrgreen:
Misho Katulic
CTO, FSX SpacePort
TerraBuilder
www.terrabuilder.com
misho
 
Posts: 673
Joined: Tue May 04, 2010 10:13 am

Re: Rotating linked bodies

Postby Julio Jerez » Fri May 26, 2017 10:05 pm

oh year you will better doing with a series of bodies.
I am no sure but a system like that made have some problems if the collision fix is too tight, but you can try an see.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 29 guests