|
Re: newton
[Re: VeT]
#113131
11/18/07 13:04
11/18/07 13:04
|
Joined: Aug 2004
Posts: 1,345 Kyiv, Ukraine
VeT
Serious User
|
Serious User
Joined: Aug 2004
Posts: 1,345
Kyiv, Ukraine
|
i dont know, what it was, but now it's working
NewtonJoint* upVector; upVector = NewtonConstraintCreateUpVector (nworld, vectorf(0,0,QUANTTOMETER) , MH.NewtonChar);
what about rotating upvector in litec? how can i get and set point? NewtonUpVectorGetPin(FF.upVector,temp_vec2); always returns error any ideas?
Last edited by VeT; 11/18/07 19:18.
|
|
|
Re: newton
[Re: VeT]
#113132
11/20/07 18:35
11/20/07 18:35
|
Joined: Oct 2006
Posts: 36
BigM
Newbie
|
Newbie
Joined: Oct 2006
Posts: 36
|
|
|
|
Re: newton
[Re: VeT]
#113135
12/22/07 15:20
12/22/07 15:20
|
Joined: May 2005
Posts: 2,713 Lübeck
Slin
Expert
|
Expert
Joined: May 2005
Posts: 2,713
Lübeck
|
Thank you very much for the efforts to get Newton working with Lite-C, ventilator . It is just awsome. I have some problems with the collision and you wrote that it should help to turn the continious collision on. But I can´t find something like that? So, how to do that? Thanks a lot! Edit: I found out how to do it but it doesn´t help with my problems... I have a problem with an Object pushing an other through a wall. Any Ideas on how to solve that?
Last edited by Slin; 12/22/07 16:06.
|
|
|
Re: newton
[Re: ventilator]
#113137
12/29/07 15:29
12/29/07 15:29
|
Joined: May 2005
Posts: 2,713 Lübeck
Slin
Expert
|
Expert
Joined: May 2005
Posts: 2,713
Lübeck
|
Quote:
how does the object get pushed through the wall? maybe you wrongly build up extreme forces (for example by setting the velocity each frame)?
If I throw an object on the book or on the plate, they get pushed through the table. This is the function for throwing: Code:
void DebugThrow(char* FileName) { NewtonBody *body; ENTITY* Temp_ent = 0; while(1) { while(!mouse_left){wait(1);} if(Temp_ent) { NewtonDestroyBody(nworld, body); ent_remove(Temp_ent); Temp_ent = NULL; } Temp_ent = ent_create(FileName,camera.x,NULL); vec_scale(Temp_ent.scale_x,0.3); body = newton_addentity(Temp_ent, 3, NEWTON_BOX, onforceandtorque); VECTOR v; vec_set(v, vector(20, 0, 0)); vec_rotate(v,camera.pan); NewtonBodySetVelocity(body, vectorf(v.x,v.y,v.z)); while(mouse_left){wait(1);} wait(1); } }
onforceandtorque is the same function you used in your example.
This is he scene where I use newton:
Quote:
btw. i think the new newton version isn't that far away anymore. it will be great. it will be much faster (stacking hundreds of bodies won't be a problem anymore) and there will be new stuff like an easier to use vehicle joint and character controller.
That sounds awsome! That should be a good reason to visit their webpage a bit more often The clips I remember were great
Thanks for your time and help
Last edited by Slin; 12/29/07 15:30.
|
|
|
Re: newton
[Re: VeT]
#113139
01/30/08 21:05
01/30/08 21:05
|
Joined: Oct 2002
Posts: 8,939 planet.earth
ello
Senior Expert
|
Senior Expert
Joined: Oct 2002
Posts: 8,939
planet.earth
|
hi here.. i just tried to get newton involved, but of course i failed. i tried to adapth the code from the litecnewton demo but the engine crashes as soon as i try to create a physics entity this is how i start the code Code:
#include <acknex.h> #include <default.c> #include <d3d9.h>
// newton works with meters! // 1 meter = 32 quants float QUANTTOMETER = 0.03125; float METERTOQUANT = 32;
#include "newton.h" #include "matrix.c" #include "newton_main.c" #include "newton_debug.c"
void onforceandtorque(NewtonBody* body) { float mass, ixx, iyy, izz; NewtonBodyGetMassMatrix(body, &mass, &ixx, &iyy, &izz); NewtonBodySetForce(body, vectorf(0, 0, -9.8 * mass)); }
this is the code for the entity to be created: Code:
void erdbeere() { my.pan = random(360); my.tilt = random(60)-30; my.roll = random(60)-30; c_updatehull(me,0); set(my,POLYGON|FLAG2); while(my.z>-50) { wait(1); } ent_remove(me); }
this is how i create the entity: Code:
you = ent_create("erdbeere.mdl",vector(my.x,my.y,900),kugel); NewtonBody *body = newton_addentity(you, 10, "convex hull", onforceandtorque); // register entity as physics entity NewtonBodySetVelocity(body, vectorf(0,0,-100));
and in the main function i have this, which creates a grid of floorparts and starts newton. Code:
var i,j; for (i=0;i<10;i++) { for(j=0;j<10;j++) { you = ent_create("ground_box.mdl",vector(128*(i-5)+64,128*(j-5)+64,0),checkField); you->flags |= FLAG8; } } newton_start(); on_close = quit;
as soon as i call the entity creating function the engine crashes. any ideas whats my fault here?
|
|
|
Re: newton
[Re: ello]
#113140
01/30/08 21:13
01/30/08 21:13
|
Joined: May 2002
Posts: 7,441
ventilator
OP
Senior Expert
|
OP
Senior Expert
Joined: May 2002
Posts: 7,441
|
i think it happens because you pass a string as collision type. the function needs an integer (use the NEWTON_CONVEXHULL define). it's a bit annoying that lite-c doesn't give more useful error messages in such cases. Quote:
no, i still dont get Impulse to work
could you give me exapmle?
Code:
void create_sphere() { you = ent_create("ball.mdl", vector(100, 100, 200), NULL); NewtonBody *body = newton_addentity(you, 10, NEWTON_SPHERE, 0); NewtonAddBodyImpulse(body, vectorf(0, 0, 10), vectorf(you.x * QUANTTOMETER, you.y * QUANTTOMETER, you.z * QUANTTOMETER)); }
void create_sphere_startup() { on_p = create_sphere; } this works for me. maybe you forgot to add the QUANTTOMETER conversion (i first forgot this when i wrote this example)?
the first vector is the wanted change in velocity, the second vector is the point in global space where the impulse should be applied.
|
|
|
|