irrlicht-newton geometry

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Guest

irrlicht-newton geometry

Post by Guest »

hi,
i'm using irrlicht with newton. i couldn't scale down the model using node->setScale because the newton still preserves the original geometry.
how'd i do this with newton?

thanks
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Post by Acki »

You have to create a new Newton body for the node...
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
DarkScythe
Posts: 11
Joined: Mon Feb 20, 2006 3:50 am
Contact:

Post by DarkScythe »

not really you need a new body search about :

Code: Select all

NewtonCreateConvexHullModifier
sudi
Posts: 1686
Joined: Fri Aug 26, 2005 8:38 pm

Post by sudi »

Just change the transformation matrix of the newton body...that will fix it!
We're programmers. Programmers are, in their hearts, architects, and the first thing they want to do when they get to a site is to bulldoze the place flat and build something grand. We're not excited by renovation:tinkering,improving,planting flower beds.
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Post by Acki »

AFAIK the tranformation matrix just changes the position of the body, not the scale...
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
sudi
Posts: 1686
Joined: Fri Aug 26, 2005 8:38 pm

Post by sudi »

I don't think so but when know it....ok
We're programmers. Programmers are, in their hearts, architects, and the first thing they want to do when they get to a site is to bulldoze the place flat and build something grand. We're not excited by renovation:tinkering,improving,planting flower beds.
Baal Cadar
Posts: 377
Joined: Fri Oct 28, 2005 10:28 am
Contact:

Post by Baal Cadar »

Indeed, transformation matrix/offset matrix is solely for rotation and translation, not for scale. For scale use the convex hull modifier.
Guest

Post by Guest »

from api:

Code: Select all

NewtonCollision* NewtonCreateConvexHullModifier(
const NewtonWorld* newtonWorld,
const NewtonCollision* convexHullCollision) 
sorry, how'd i scale it using createconvexhullmodifier?
DarkScythe
Posts: 11
Joined: Mon Feb 20, 2006 3:50 am
Contact:

Post by DarkScythe »

create sth. like this:

Code: Select all

   NewtonCollision* sphere = NewtonCreateSphere(nWorld, 30, 30, 30, NULL);
	collision = NewtonCreateConvexHullModifier(nWorld,sphere);
	NewtonReleaseCollision(nWorld,sphere);
	body = NewtonCreateBody(nWorld,collision);
and modify like this:

Code: Select all

   dMatrix pmatrix;
	NewtonConvexHullModifierGetMatrix(collision,&pmatrix[0][0]);
	pmatrix.m_up.m_x *= 0.4;
	pmatrix.m_up.m_y *= 2;
	pmatrix.m_up.m_z *= 0.4;
	NewtonConvexHullModifierSetMatrix(collision,&pmatrix[0][0]);
Baal Cadar
Posts: 377
Joined: Fri Oct 28, 2005 10:28 am
Contact:

Post by Baal Cadar »

Note, that the hull modifier is scaled in world space, not in the modified collisions local space.
Guest

Post by Guest »

DarkScythe wrote:create sth. like this:

Code: Select all

   NewtonCollision* sphere = NewtonCreateSphere(nWorld, 30, 30, 30, NULL);
	collision = NewtonCreateConvexHullModifier(nWorld,sphere);
	NewtonReleaseCollision(nWorld,sphere);
	body = NewtonCreateBody(nWorld,collision);
and modify like this:

Code: Select all

   dMatrix pmatrix;
	NewtonConvexHullModifierGetMatrix(collision,&pmatrix[0][0]);
	pmatrix.m_up.m_x *= 0.4;
	pmatrix.m_up.m_y *= 2;
	pmatrix.m_up.m_z *= 0.4;
	NewtonConvexHullModifierSetMatrix(collision,&pmatrix[0][0]);
what member is dMatrix?
sdi2000
Posts: 131
Joined: Thu Aug 25, 2005 12:19 pm
Location: Berlin, DE
Contact:

Post by sdi2000 »

dMatrix is from the Newton sdk.
Guest

Post by Guest »

hum. weird i already linked the sdk, but it says "undeclared identifier" :cry:
sdi2000
Posts: 131
Joined: Thu Aug 25, 2005 12:19 pm
Location: Berlin, DE
Contact:

Post by sdi2000 »

look at ... NewtonSDK\samples\toolBox
include the dMatrix.h
Guest

Post by Guest »

okay yea i got it all compiled now.
but it's still not scaling it.

this is what i have:

Code: Select all

NewtonCollision* myShape = NewtonCreateBox(nWorld, size2.X, size2.Y, size2.Z, NULL);
	NewtonCollision* collision;
	collision = NewtonCreateConvexHullModifier(nWorld,myShape);
	dMatrix pMatrix;
	NewtonConvexHullModifierGetMatrix(collision, &pMatrix[0][0]);
	pMatrix.m_up.m_x *= 0.4;
	pMatrix.m_up.m_y *= 2;
	pMatrix.m_up.m_z *= 0.4;

	NewtonConvexHullModifierSetMatrix(collision, &pMatrix[0][0]);
am i doing it right?
changing the numbers didn't seem to have any effects...
Post Reply