Compound Collisions and Convex Hull Modifiers

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Compound Collisions and Convex Hull Modifiers

Postby agi_shi » Wed Dec 24, 2008 1:28 pm

1) when I create a compound collision (which works freaking awesome for concave objects, by the way), should I do NewtonReleaseCollision() on the separate NewtonCollision's that made it up? That is, I have this:
Code: Select all
std::vector<NewtonCollsion*> parts;
for (...)
{
    ...
    parts.push_back(NewtonCreateConvexHull(w, partVerts.size(), &partVerts[0].x, 12, 0.01, NULL));
}

NewtonCollision *col = NewtonCreateCompoundCollision(w, parts.size(), &parts[0]);
//! should the convex collisions in 'parts' be NewtonReleaseCollision()'d ?!?


2) can a convex hull modifier be used on a compound collision? [edit] I just tested this, and it NewtonCreateConvexHullModifier() returns NULL for this - how can I dynamically scale compound collisions?

3) my convex hull modifier for some convex hulls likes to fall through the floor on some occasions, or is about to fall through and bounces up, then through and up again, and so on. This does not occur if the collision is not a convex hull modifier.

Sorry for all the questions, but Portalized crucially needs stable real-time scaling of all the physics objects :D

On another note, would it be possible to distribute the betas as a plain .zip without an installer? It's very cumbersome to have to actually install something like this, and then whenever I want to upgrade to another beta, I have to uninstall the old one. This removes the old one completely, and any projects which still compile against an older beta need to all be upgraded, which is not that great. If the betas were all plain .zips, life would be so much easier :D
agi_shi
 
Posts: 263
Joined: Fri Aug 17, 2007 6:54 pm

Re: Compound Collisions and Convex Hull Modifiers

Postby Julio Jerez » Wed Dec 24, 2008 2:51 pm

when you add the collision shaped to the compound collision for each entry teh compoun add a refence.
say you make a compund collision of two box

collison* box = CraeteBox(); // box ref = 2 (one for the word one for create
colllsion array[2];
array[0] = box;
array[1] = box;
collison* compund = CreateBox(array); // box ref = 4, compund ref = 1
//now you need to realse the box collision so that you get
relaseColiison ( Box) // box ref = 3, 1 for the word, and one for each entry that is using the box as collision shape.

collision modifier cannot take a compound collision, but thecmpund collision can take collision modifores as child shapes

Collision *Box
Collision modifier (Box)
array[0] = modifier;
array[0] = modifier or oteh shape;
collison* compund = CreateBox(array);

to apply scale you will have to apply it to each of the child shapes that are controlled by a modifier.


agi_shi wrote:3) my convex hull modifier for some convex hulls likes to fall through the floor on some occasions, or is about to fall through and bounces up, then through and up again, and so on. This does not occur if the collision is not a convex hull modifier.

Thsi si do not undernatd

agi_shi wrote:On another note, would it be possible to distribute the betas as a plain .zip without an installer? It's very cumbersome to have to actually install something like this, and then whenever I want to upgrade to another beta, I have to uninstall the old one.

Yes I already did that,
The reason why is was liek that is because peopel who diod no have VS installed codul no run the demos, bu now I made the SDK no dependent on system libaries and it do no need to intasll redistribution.
The next build will be in .zip format.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Compound Collisions and Convex Hull Modifiers

Postby JernejL » Wed Dec 24, 2008 4:01 pm

Julio: what about when a compound is unserialized, does that properly handle sub-object references?
Help improving the Newton Game Dynamics WIKI
User avatar
JernejL
 
Posts: 1578
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia

Re: Compound Collisions and Convex Hull Modifiers

Postby agi_shi » Wed Dec 24, 2008 4:40 pm

Thanks for the reply, Julio. Much appreciated :mrgreen:
agi_shi
 
Posts: 263
Joined: Fri Aug 17, 2007 6:54 pm

Re: Compound Collisions and Convex Hull Modifiers

Postby Julio Jerez » Wed Dec 24, 2008 4:52 pm

Delfi wrote:Julio: what about when a compound is unserialized, does that properly handle sub-object references?

I think though yes.
It is eassy to check by reading the ref count before seralizning an ddeserializing.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Compound Collisions and Convex Hull Modifiers

Postby agi_shi » Thu Dec 25, 2008 1:30 pm

Well, I implemented what I needed and I updated to beta 18, and everything Just Works excellent :D

I love how capable Newton is at dynamic scaling. Primitives, convex hulls, concave hulls, they all Just Work :D :mrgreen: I also love how you can give tree collisions a velocity and then manually move them, and all the other objects react perfectly :D
agi_shi
 
Posts: 263
Joined: Fri Aug 17, 2007 6:54 pm

Re: Compound Collisions and Convex Hull Modifiers

Postby JernejL » Thu Dec 25, 2008 2:17 pm

agi_shi wrote:I also love how you can give tree collisions a velocity and then manually move them, and all the other objects react perfectly :D


How exactly did you do that? you mean you set mass and velocity and manually move the tree collision and dynamic bodies react to it properly?
Help improving the Newton Game Dynamics WIKI
User avatar
JernejL
 
Posts: 1578
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia

Re: Compound Collisions and Convex Hull Modifiers

Postby agi_shi » Thu Dec 25, 2008 2:43 pm

All I do is this:
Code: Select all
theTreebody->setVelocity(vec3(10, 10, 10)); // upwards diagonal, for example

body::onGameUpdate(deltaTime)
{
    // if we're a static body but we have a velocity, manually move
    if getMass() < 0.01 and getVelocity().length() > 0.01
        setPosition(getPosition() + getVelocity() * deltaTime)
}

The velocity keeps other objects interacting correctly, and the manual positioning keeps the body at the correct spot.

(I used pseduo-code there, those calls obviously correspond to NewtonBodySetVelocity, NewtonBodySetMatrix, etc.)
agi_shi
 
Posts: 263
Joined: Fri Aug 17, 2007 6:54 pm

Re: Compound Collisions and Convex Hull Modifiers

Postby JernejL » Thu Dec 25, 2008 3:34 pm

but does that work with sleeping / frozen bodies that were resting on the trimesh?
Help improving the Newton Game Dynamics WIKI
User avatar
JernejL
 
Posts: 1578
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia

Re: Compound Collisions and Convex Hull Modifiers

Postby agi_shi » Thu Dec 25, 2008 6:33 pm

Oh, and besides that it also use's Newton's bodies-in-AABB callback to wake up anything 'within' the object :D. Otherwise sleeping objects will not wake up, no. Once you manually wake them up, though, it works.
agi_shi
 
Posts: 263
Joined: Fri Aug 17, 2007 6:54 pm


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 21 guests

cron