WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 09-14-2010, 01:07 AM
vJimZ vJimZ is offline
Member
 
Join Date: Sep 2010
Location: Stanford University
Posts: 2
Help Creating Interactive City Env from .dae

Hi everyone,

I'm fairly new to Vizard, and am having trouble making the environment map of a city interactive.

The environment map is loaded from a .dae file, and contains the ground floor as well as a sea layer above it, and some buildings.

I have an avatar moving around the world, controlled by arrow keys.

I would like to make it so that the user cannot collide with either the buildings and the sea areas.
I tried collisionMesh, collisionBox, and collisionSphere on both the avatar and the environ map variable and they do not work; the avatar simply walks through them. When I try a simple line like printing "collide" on collision, nothing happens.

My code is:
--------------------------------------------------------------------------
import necessary files

viz.go()
viz.clearcolor(viz.SKYBLUE)
viz.phys.enable()

#Resources

#Builds the basic background resources
city = viz.add('art/city.dae')
city.setScale([.01,.01,.01])
city.collideMesh()
viz.collision(viz.ON)
viz.collisionbuffer(0.3)

#######Add avatar details here###############
male = viz.add('vcc_male.cfg')
male.setPosition([10.0, 0, 40.0])
male.collideMesh()

### Sets the position to be just behind the avatar
matrixPos = male.getPosition()
matrixPos[2] = matrixPos[2] - 10
viz.MainView.setPosition(matrixPos)

## other functions here that account for movement####
#######################################
Reply With Quote
  #2  
Old 09-14-2010, 02:45 PM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
It's possible if the models are too thin the physics engine will not register the collision.

What code did you use to be notified of a collision and print that it occured?
Reply With Quote
  #3  
Old 09-14-2010, 05:30 PM
vJimZ vJimZ is offline
Member
 
Join Date: Sep 2010
Location: Stanford University
Posts: 2
Hi Jeff,

Thanks for the reply.

To make the code detect a collision:
male.enable(viz.COLLIDE_NOTIFY)
def onCollide(e):
print "collided"

viz.callback( viz.COLLIDE_BEGIN_EVENT, onCollide)

The console prints "collided" when the character first lands, and plenty of "collided" are printed as the character is running around, but not when buildings are hit. The world is around 30km x 30km x 10km, but I scaled it by a factor of 0.01.

Is there some way to increase the "thickness" of the model to the point that it can detect collisions?
Reply With Quote
  #4  
Old 09-15-2010, 12:23 PM
Gladsomebeast Gladsomebeast is offline
Member
 
Join Date: Mar 2005
Location: Isla Vizta, CA
Posts: 397
Because viz.COLLIDE_BEGIN_EVENT only calls onCollide once per collision, you get one notification of collision when the avatar hits the city model's ground, even though the avatar moves on to collide with the city model's buildings.

so events go like this: avatar drops into world -> collide begin event called -> avatar is still colliding with world but walking around -> avatar walks into building but never lost touch with city model so no new collide begin event.

I think the better way to move you avatar around in the world is with a velocity motor created with the male.addVelocity fuction. There are a few tricks on how to use a velocity motor, so check out the docs on "addVelocity" and the example script in this article:

http://vizworkshop.com/articles/walkthrough_app
__________________
Paul Elliott
WorldViz LLC
Reply With Quote
Reply

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
Interactive Window ChrisB Vizard 1 01-19-2005 11:36 AM


All times are GMT -7. The time now is 12:01 PM.


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