WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #4  
Old 01-06-2014, 07:17 AM
Erikvdb Erikvdb is offline
Member
 
Join Date: May 2013
Posts: 63
Frank, that only starts/stops the spinning, it doesn't ease-in or out.

I think a more flexible solution would be to wire -in 3ds max terms- the wheel rotation to the car translation. I can't really remember how it works best exactly, but here's a quick and dirty version, based on Frank's code:

Code:
import viz
import vizact
import vizmat

viz.go()

car1 = viz.add('box.wrl')
carPos = car1.getPosition()

viz.eyeheight(0)
viz.MainView.setPosition(-5,0,-20)

action1 = vizact.moveTo([-10,0,0],speed=4.00, interpolate=vizact.easeInOut)

def actionTime():
	car1.addAction(action1,0)
	
def onUpdate():
	global carPos
	newPos = car1.getPosition()
	distance = vizmat.Distance(carPos,newPos)
	rotation = distance * viz.getFrameElapsed() * 2000 
	car1.setEuler([0,0,rotation],viz.REL_LOCAL)
	carPos = newPos
	
vizact.onkeydown(' ', actionTime)
vizact.onupdate(0, onUpdate)
The 2000 number should be based on the wheel circumference, but I forgot how it relates exactly, so it's just an arbitrary multiplier.
Reply With Quote
 

Tags
car wheel rotation


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
Steering wheel mini Biom Vizard 2 06-17-2013 11:53 PM
Custom Joystick Rotation mhead10 Vizard 9 11-26-2012 12:06 PM
Changing Force-feedback on Wheel Cage Vizard 3 10-23-2010 08:37 AM
set bone rotation - cal3d munteanu24d Vizard 0 03-23-2010 04:25 AM
Unable to perform 360 rotation using vizact.spinto vijaykiran Vizard 2 09-29-2009 08:39 AM


All times are GMT -7. The time now is 10:55 PM.


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