6 registered members (AndrewAMD, Ayumi, degenerate_762, 7th_zorro, VoroneTZ, HoopyDerFrood),
1,268
guests, and 6
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: newton
[Re: ventilator]
#113144
01/31/08 19:12
01/31/08 19:12
|
Joined: Oct 2002
Posts: 8,939 planet.earth
ello
Senior Expert
|
Senior Expert
Joined: Oct 2002
Posts: 8,939
planet.earth
|
now my function looks like this: Code:
void erdbeere() { NewtonBody *body; c_updatehull(me,0); set(my,POLYGON|FLAG2); while(my.z>-50) { wait(1); } NewtonDestroyBody(nworld, body); // ent_remove(me); }
this however leads to an engine crash with no further explanation btw, how do i setup such a Callback? Never did this before
|
|
|
Re: newton
[Re: ello]
#113145
01/31/08 19:31
01/31/08 19:31
|
Joined: May 2002
Posts: 7,441
ventilator
OP
Senior Expert
|
OP
Senior Expert
Joined: May 2002
Posts: 7,441
|
hm... in your function you don't create the body? newtondestroybody() will crash if you don't pass a valid body. you know how callbacks work from ent_create() for example. function mycallback() { } ent_create("model.mdl", nullvector, mycallback); it's just a normal function. the pointer of this function gets passed to ent_create() and ent_create() will call that function then. many newton features also work with callbacks.
|
|
|
Re: newton
[Re: ventilator]
#113146
01/31/08 19:39
01/31/08 19:39
|
Joined: Oct 2002
Posts: 8,939 planet.earth
ello
Senior Expert
|
Senior Expert
Joined: Oct 2002
Posts: 8,939
planet.earth
|
oh, thanks.. i now use this function and it works: Code:
void erdbeere() { NewtonBody *body = newton_addentity(me, 10, NEWTON_CONVEXHULL, onforceandtorque); NewtonBodySetVelocity(body, vectorf(0,0,-5)); c_updatehull(me,0); set(my,POLYGON|FLAG2); while(my.z>20) { wait(1); } NewtonDestroyBody(nworld, body); ent_remove(me); }
thanks again for your help
|
|
|
Re: newton
[Re: ello]
#113147
01/31/08 20:06
01/31/08 20:06
|
Joined: Oct 2002
Posts: 8,939 planet.earth
ello
Senior Expert
|
Senior Expert
Joined: Oct 2002
Posts: 8,939
planet.earth
|
me again... now i want to add a random force or torque to the entity and was using this: NewtonBodyAddForce(body, vectorf(random(100)-50,random(100)-50,random(100)-50)); or NewtonBodyAddTorque(body, vectorf(random(100)-50,random(100)-50,random(100)-50)); but nothing changes. also i dont get the idea about how to have the entity with a certain start rotation ok, now i used NewtonBodySetOmega and that works. Guess i'll search for a general newton manual now
Last edited by ello; 01/31/08 20:49.
|
|
|
Re: newton
[Re: VeT]
#113149
02/02/08 21:00
02/02/08 21:00
|
Joined: Aug 2004
Posts: 1,345 Kyiv, Ukraine
VeT
Serious User
|
Serious User
Joined: Aug 2004
Posts: 1,345
Kyiv, Ukraine
|
that works just great!!! Code:
if (c_trace(camera.x, temp_vec.x,IGNORE_ME|IGNORE_PASSABLE|IGNORE_PASSENTS) > 0) { if (you.skill99!=0) { vec_for_vertex(temp_vec.x,you,hitvertex); body_temp=you.skill99; NewtonAddBodyImpulse(body_temp, vectorf(-normal.x,-normal.y,-normal.z) , vectorf(temp_vec.x * QUANTTOMETER, temp_vec.y * QUANTTOMETER, temp_vec.z * QUANTTOMETER) ); } but box is rotating only in right side... i dont think that its famous error, but maybe you get this before?
|
|
|
|