From: Ethan Glasser-C. <gl...@cs...> - 2006-11-02 04:17:08
|
Hart's Antler wrote: > Hi Ethan, >=20 > not sure if this will do what you want, but when i want to make an obje= ct follow a point i use a > magnet function, it won't be perfect, it will slip a little, try adjust= ing the value of magnet >=20 > target =3D vec3( x,y,z ) > magnet =3D 100 > v1 =3D vec3( body.getPosition() ) > v2 =3D target-v1 > body.addForce( v2.normalize()*magnet ) This is a useful stopgap, thanks. I see that the ODE manual says: "How can an immovable body be created? In other words, how can you create a body that doesn't move, but that interacts with other bodies? The answer is to create a geom only, without the corresponding rigid body object. The geom is associated with a rigid body ID of zero. Then in the contact callback when you detect a collision between two geoms with a nonzero body ID and a zero body ID, you can simply pass those two IDs to the dJointAttach function as normal. This will create a contact between the rigid body and the static environment. Don't try to get the same effect by setting a very high mass/inertia on the "motionless" body and then resetting it's position/orientation on each time step. This can cause unexpected simulation errors." I guess what I'm doing is much like that, resetting its position every time step, and I'm not surprised that it causes errors. But what I'd like, ideally, to do, is, well, make an immovable body that moves. :) This is what I called "static" in my original email. The above recipe works fine until you add joints; once that happens, the static object's velocity can be altered, which isn't what I want. Maybe the best solution is to make a new kind of joint. I'll look into this possibility next. Ethan |