Rosario 3D

My developer blog

Slide su aptica e fisica in real time

Qui potete trovare in allegato le slide su la lezione di giovedì

Qui potete trovate gli esempi e la libreria physX

esempi physX

Questo è un semplice esempio dell’algoritmo di virtual coupling

// VIRTUAL COUPLING
function FF(device, cursore, dt){
   var phPos = vector(3);
   var t = vector(1);                // tempo del grabber
   var objPos      = cursore.getPosition();
   var velocity    = cursore.getVelocity();
   var force;
   static var k = 15;   // guadagno
   static var d = 0.5;  // smorzamento

   device.getPosition(&phPos, &t);

   var kcomponent = (phPos-objPos)*k;
   var dcomponent = d * velocity;
   force =  kcomponent - dcomponent;

   cursore.addForceAbs(force.x, force.y, force.z);

   device.ApplyForce(force, t[0]);
   return force;
}
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: