WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #3  
Old 06-09-2014, 01:37 AM
befl0 befl0 is offline
Member
 
Join Date: Jun 2014
Posts: 13
import viz
import vizact
import vizcam
import time
from StopWatch import StopWatch
from Start import Start
from Line import Line
from Square180 import Square180
from CircledCylinder import CircledCylinder
from EightFigure import EightFigure
from Square360 import Square360
from ReverseGate import ReverseGate

viz.setMultiSample(4)
viz.fov(60)
viz.go(viz.FULLSCREEN)

#This code adds a ground for them to stand on.
env = viz.addChild('ground_grass.osgb')
env.collidePlane()

Light = viz.add(viz.LIGHT)
Light.position(0,1,0,0)
Light.intensity(1)
Light.spread(180)

view=viz.MainView

viz.phys.enable()
male = viz.addAvatar('vcc_male2.cfg')
male.state(6)

view.setPosition(0,0.3,0)

link = viz.link(view, male)
link.preTrans([0,-0.8,0.45])
link.setEuler([None,-20,None])
#link.preTrans([0,-0.12,0.35])

MOVE_SPEED = 5
TURN_SPEED = 60
viz.phys.enable()


def updateMove():
if viz.key.isDown(viz.KEY_UP):
view.move([0,0,+MOVE_SPEED*viz.elapsed()],viz.BODY_ORI)
elif viz.key.isDown(viz.KEY_DOWN):
view.move([0,0,-MOVE_SPEED*viz.elapsed()],viz.BODY_ORI)
elif viz.key.isDown(viz.KEY_RIGHT):
view.setEuler([TURN_SPEED*viz.elapsed(),0,0],viz.BODY_ORI,viz.REL_PARENT)
elif viz.key.isDown(viz.KEY_LEFT):
view.setEuler([-TURN_SPEED*viz.elapsed(),0,0],viz.BODY_ORI,viz.REL_PARENT)

pass


vizact.ontimer(0,updateMove)

rampe=viz.addChild('rampe.wrl')
rampe.setPosition(0,0,1)
rampe.setEuler(0,90,0)
rampe.collideBox()
rampe.disable(viz.DYNAMICS)

rFootBox = viz.add('box.wrl',scale=[0.1,0.1,0.1])
rFootBox.collideBox()
rFootBox.disable(viz.DYNAMICS)
rFootBox.enable(viz.COLLIDE_NOTIFY)
rFoot = male.getBone('Bip01 R Foot')
rFoot.lock()
rFootLink = viz.link( rFoot , rFootBox )
rFootLink.preTrans([0.05,0.15,0.18])
rFootBox.disable(viz.RENDERING)


lFootBox = viz.add('box.wrl',scale=[0.1,0.1,0.1])
lFootBox.collideBox()
lFootBox.disable(viz.DYNAMICS)
lFootBox.enable(viz.COLLIDE_NOTIFY)
lFoot = male.getBone('Bip01 L Foot')
lFoot.lock()
lFootLink = viz.link( lFoot , lFootBox )
lFootLink.preTrans([0,0.15,0.18])
lFootBox.disable(viz.RENDERING)


def collidBox(e):
global poleArray
if (e.obj1 == rFootBox) or (e.obj1 == lFootBox):
if(e.obj2==rampe):
view.collision(viz.ON)
view.gravity(9.8)


viz.collision(viz.OFF)

viz.callback(viz.COLLIDE_BEGIN_EVENT,collidBox)



This is my code. I put the ramp I create with sketchup in a zip folder.

Thanks
Attached Files
File Type: zip ramp.zip (903 Bytes, 8029 views)
Reply With Quote
 

Tags
avatar, climp, collision, ramp

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
Avatar Material Problem Erikvdb Vizard 1 03-04-2014 03:46 AM
Unexpected Avatar lookAt() behavior when using yield statements chris2307 Vizard 2 12-17-2013 02:58 AM
.osg biped avatar problem alvinadi Vizard 3 12-20-2011 10:29 AM
Avatar speaking problem Uttama_vizard Vizard 4 03-23-2009 11:29 AM
Problem with letting an avatar face towards another avatar ghazanfar Vizard 2 03-21-2007 02:30 AM


All times are GMT -7. The time now is 03:17 AM.


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