WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Vizard (https://forum.worldviz.com/forumdisplay.php?f=17)
-   -   .bsp->.obj->.osgt map Collision Problem/Resources for free maps? (https://forum.worldviz.com/showthread.php?t=5202)

plogic 10-24-2014 07:59 AM

.bsp->.obj->.osgt map Collision Problem/Resources for free maps?
 
Hello everyone,

I started playing around with Vizard 5 (64bit version) and wanted to include a level/map that was a bit more extensive, so I looked into importing Half Life/Counterstrike maps in the (Valve) .bsp format.

If you have any suggestions on where to find scenery / levels that are natively supported by Vizard and take some time to explore, I would be very grateful, to hear from you!

My workflow was as follows:
Since the .bsp Format that Vizard can read is not the same as the one in Valve .bsp maps, I used Nem's Tools Crafty to convert a .bsp to a .obj File and extract the relevant Textures. (If I load that .obj file into Vizard, the y and z coordiantes of all vertices are 0)
Then I used blender and import the .obj File, scale the map down a bit and use the osgexport Plugin to export the complete model, including textures to .osgt which I then load into Vizard.

The model seems to load fine and most of the textures are visible. Using vizcam.WalkNavigate I can move around freely. Yet, when I enable collision I have two problems:
  • I can not choose a starting position
  • I am not affected by gravity

When collision is off, I can set a starting position with setPosition, but when collision is on, I start on the origin instead (outside of any rooms).
Using a vizact.onkeydown event to toggle collision, I can see that collision with the walls seem to work once I am inside a room. Yet, when I walk over stairs, I do not seem to fall down and always hover at the same height.

Here is a minimal example:
Code:

import viz, vizcam, vizact

viz.go()
viz.clearcolor(viz.SKYBLUE)

map = viz.add('maps/cs_office.osgt')

tracker = vizcam.addWalkNavigate(moveScale=10.0)
tracker.setPosition([15.62396, -0.36471, -13.66633])
viz.link(tracker,viz.MainView)
viz.MainView.collisionbuffer(0.2)
viz.MainView.gravity(9.8)
viz.MainView.collision( viz.ON )

#This function is called when a collision occurs
def mycollision(info):
        print 'Collided!'

#Create a callback for a collision event
viz.callback(viz.COLLISION_EVENT, mycollision)

Using a different model (eg. playground or ground + some entities) works fine. I experimented with different eyeheights, collisionbuffers and scales of the map (to an extend where one room was many times greater than the whole dojo model).

My questions now are the following:
What are the conditions for gravity affecting the viewpoint in Vizard? (Can I eg. go below my starting position?)
Does the collision of the viewpoint treat certain models differently than others?
Did anyone have a similar problem?
And again: does someone know of a good source of maps/levels are known to work with vizard?

Thank you all very much.


All times are GMT -7. The time now is 02:48 AM.

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