Fluent viewpoint rotation towards an object
Hi everybody,
I have a simple question: How can I fluently turn the viz.MainView towards an object somewhere in my environment (without knowing the angle between the current viewing direction and the object)? I could do all the math behind such a rotation myself, but I guess there's a smarter and much shorter way to achive that with Vizard's built-in methods. What I'm looking for is basically what the "viz.MainView.lookAt" function already does, extended by the possibility for a fluent movement instead of the discrete jump in viewing direction. Can anybody help me out with a good idea? Thanks in advance! |
Are you using Vizard 3 or 4?
If you are using Vizard 4, then you can use the vizact.spinTo action to animate the viewpoint to look towards a specific point. Example: Code:
# Animate looking at specified point for half a second |
farshizzo,
thanks for the quick reply. I'm running my script under Vizard 3, since large parts were written before the release of Vizard 4. Unfortunately, it seems like your code doesn't produce the result it's supposed to in Vizard 3. Is there any other possibility how this could work in Vizard 3? |
You can still use the spinto action in Vizard 3, however you will need to manually calculate the final rotation to spinto. You can do this by saving the main views current rotation, call the lookat function and save the new rotation, then restore the previous rotation.
|
farshizzo,
I can't see how quickly setting the viewpoint towards the object via "lookat()" and then set it back again to the original direction can work without resulting in a short flickering in the viewpoint. Maybe I got you wrong? |
I wrote some code myself to solve the problem:
Code:
import math |
All times are GMT -7. The time now is 05:47 PM. |
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC