WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 02-18-2010, 09:37 AM
jvacare1 jvacare1 is offline
Member
 
Join Date: Aug 2009
Posts: 6
how to remove velocity when mouse is disabled?

I have an environment in which there is a hotspot which detects the arrival of the mainview. When the mainview arrives in the hotspot, the script disables the mouse while a scheduled task waits for user input.

The problem is that if the mouse is being used to navigate the mainview, any velocity or rotational velocity is preserved when the mouse is disabled. This means that if the mouse navigates the mainview into the hotspot, and the mouse is disabled, the mainview seems to continue to spin, move forward, or whatever the last command of the mouse input was.

Is there a way to set the velocity and rotational velocity of the mainvew to zero after disabling the mouse, to remove this effect?

A simplified version of my environment script (which still exihibits the problem) is below.

Thanks,

Jason

Code:
import viz, viztask, random, time, re, os
viz.go()
viz.gravity(viz.ON)

def NavigationLockDown():
  viz.mouse(viz.OFF)

def NavigationUnlock():
  viz.mouse(viz.ON)

def HotSpotHandler(id, x, y, z):
  NavigationLockDown()
  viztask.schedule(PerformTrialTask())

def InitiateHotSpot():
  viz.callback(viz.HOTSPOT_EVENT, HotSpotHandler)
  viz.starthotspot(3, viz.RECTANGLE_HOTSPOT_IN, 0, 4, 2, .5)

def PerformTrialTask():
  viz.MainView.goto([0, 1.82, 4])
  viz.MainView.lookat(ThingOfInterest.getPosition())
  d = viz.Data
  PROMPT_TEXT = viz.addText('What will you do?', viz.SCREEN, scene=1)
  PROMPT_TEXT.setScale([.5, .5, 1])
  PROMPT_TEXT.translate(0.05, 0.9)
  Keys = ('a', 'j')
  while True:
    yield viztask.waitKeyDown(Keys, d)
    if (d.key == 'j'):
      NavigationUnlock()
      return

    elif (d.key == 'a'):
      NavigationUnlock()
      return

InitiateHotSpot()
Reply With Quote
 

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Navigating an avatar using mouse position(2D) in 3D environment james007 Vizard 1 10-16-2009 12:29 PM
how to do it using mouse nasr Vizard 0 05-12-2009 03:38 AM
Mouse problem steve Vizard 7 07-14-2005 04:01 PM
Draw Line between Points selected by mouse Johannes Vizard 7 01-07-2005 03:50 PM
Halting mouse view-transforms FlyingWren Vizard 1 10-01-2003 06:29 PM


All times are GMT -7. The time now is 06:58 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC