3 registered members (AndrewAMD, VoroneTZ, dpn),
1,346
guests, and 10
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: newton
[Re: Sam_Be]
#113102
10/23/07 16:16
10/23/07 16:16
|
Joined: Aug 2004
Posts: 1,345 Kyiv, Ukraine
VeT
Serious User
|
Serious User
Joined: Aug 2004
Posts: 1,345
Kyiv, Ukraine
|
okay, looking like working... :-) now, question about upVector when i add Code:
NewtonJoint* m_upVector; m_upVector = NewtonConstraintCreateUpVector (nworld, vector(0,1,0), MH.NewtonChar);
, model falls down through floor...
|
|
|
Re: newton
[Re: VeT]
#113105
10/29/07 17:33
10/29/07 17:33
|
Joined: May 2002
Posts: 7,441
ventilator
OP
Senior Expert
|
OP
Senior Expert
Joined: May 2002
Posts: 7,441
|
sometimes the question comes up how to do phent_addforceglobal()/phent_addforcelocal() with newton. here is a short (untested) code snippet: Code:
newton_bodyaddforceglobal(NewtonBody *body, VECTOR *force, VECTOR *point) // add force at point in global coordinate system { ENTITY *entity = (ENTITY*)NewtonBodyGetUserData(body); VECTOR r, torque; vec_diff(r, point, entity->x); vec_cross(torque, r, force); NewtonBodyAddForce(body, force); NewtonBodyAddTorque(body, torque); }
newton_bodyaddforcelocal(NewtonBody *body, VECTOR *force, VECTOR *point) // add force at point in entity coordinate system { ENTITY *entity = (ENTITY*)NewtonBodyGetUserData(body); VECTOR globalforce, globalpoint; vec_set(globalforce, force); vec_set(globalpoint, point); vec_rotate(globalforce, entity->pan); vec_rotate(globalpoint, entity->pan); vec_add(globalpoint, entity->x); newton_bodyaddforceglobal(globalforce, globalpoint); }
i think lite-c still doesn't come with a vec_cross() function so you have to do one yourself. (...and i guess you also should apply QUANTTOMETER in those functions.)
|
|
|
Re: newton
[Re: Shadow969]
#113108
10/31/07 19:08
10/31/07 19:08
|
Joined: Aug 2004
Posts: 1,345 Kyiv, Ukraine
VeT
Serious User
|
Serious User
Joined: Aug 2004
Posts: 1,345
Kyiv, Ukraine
|
and what about NewtonBodyGetVelocity? in debug panel, there are always zeros... so i tried
NewtonBodyGetVelocity(MH.NewtonChar,vectorf(temp_vec2.x,temp_vec2.y,temp_vec2.z)); NewtonBodySetVelocity(MH.NewtonChar,vectorf(temp_vec2.x,temp_vec2.y,temp_vec2.z));
primary, this code mustnd do anything... but in real this works like NewtonBodySetVelocity(MH.NewtonChar,vectorf(nullvector));
so, how can i get the speed of entity?
|
|
|
|