View Single Post
  #4  
Old 09-11-2014, 02:16 PM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
Quote:
May I ask how can I get the real-time spring force I applied?
After you've defined and enabled the spring effect you could create your own function that returns the spring effect force based on F = k(P - X). Something like the following:

Code:
import vizmat

def getSpringForce():

	#get effect position and gain.
	P = springEffect.getPosition()
	k = springEffect.getGain()
	
	#get haptic device position
	X = device.getPosition()
	
	#return force
	return k * vizmat.Distance(P,X)
Quote:
Position here represents the effect position, right?
Yes, the position value you pass in when you define the spring effect is the effect position.

Quote:
And what is the relationship between magnitude and spring force? In F = k(P-X), magnitude is the max spring force?
The magnitude of the effect force is capped at the magnitude value you define.
Reply With Quote