A place to discuss everything related to Newton Dynamics.
Moderators: Sascha Willems, walaber
by telmopereira » Fri Jun 04, 2010 10:41 am
Hi everybody,
I am trying to simulate the behavior of a spring in my application. My idea was: when i make force on the object that is a spring, i scale the object...graphically that part is easy. But i don't know how to do that physically with Newton...there is some way to scale in one axis the physic object ?
Thanks,
Telmo
-
telmopereira
-
- Posts: 29
- Joined: Thu Apr 15, 2010 12:52 pm
by JernejL » Fri Jun 04, 2010 2:11 pm
well, you can scale a newton object with a convex hull modifier.
-

JernejL
-
- Posts: 1587
- Joined: Mon Dec 06, 2004 2:00 pm
- Location: Slovenia
-
by telmopereira » Fri Jun 04, 2010 2:21 pm
How exactly ?
By doing NewtonConvexHullModifierSetMatrix ?
-
telmopereira
-
- Posts: 29
- Joined: Thu Apr 15, 2010 12:52 pm
by JernejL » Fri Jun 04, 2010 5:04 pm
yes, that function exactly, you can set scaling there.
-

JernejL
-
- Posts: 1587
- Joined: Mon Dec 06, 2004 2:00 pm
- Location: Slovenia
-
by telmopereira » Fri Jun 11, 2010 9:33 am
Hi,
I try to use the NewtonConvexHullModifier, but something is wrong.
When i am creating an hull collision, i did something like this:
- Code: Select all
collision = NewtonCreateConvexHull(p_world, totalVertices, cloud, sizeof(dFloat)*3, 20, shapeId, NULL);
collModifier = NewtonCreateConvexHullModifier(p_world,collision,shapeId);
body = NewtonCreateBody(p_world, collModifier);
NewtonReleaseCollision(p_world, collModifier);
Then, when i do something like setPosition of the object, i do something like this:
- Code: Select all
matrix4 mat;
NewtonBodyGetMatrix(p_body, mat.pointer());
mat.setTranslation(pos);
if(strcmp(getExpType().c_str(), "spring") ==0)
NewtonConvexHullModifierSetMatrix(ApplicationManager::sprExp->collMod,mat.pointer());
else
NewtonBodySetMatrix(p_body, mat.pointer());
The problem is if i use the NewtonConvexHullModifierSetMatrix instead of NewtonBodySetMatrix, the object is just represented graphically, there are no collisions...it's like object is not there.
I think that is because with the NewtonBodySetMatrix it's told to Newton which body will have that matrix, and in HullModifier, is not told which body will be affected... is that the problem ? Someone knows how to solve this?
Thanks,
Telmo
-
telmopereira
-
- Posts: 29
- Joined: Thu Apr 15, 2010 12:52 pm
by JernejL » Fri Jun 11, 2010 2:59 pm
ofcourse there will be no collisions from just that, if you are going to move objects manually that's not the way newton is intended to be used. use newtonupdate and look at some tutorials.
-

JernejL
-
- Posts: 1587
- Joined: Mon Dec 06, 2004 2:00 pm
- Location: Slovenia
-
Return to General Discussion
Who is online
Users browsing this forum: No registered users and 1 guest