Flow Ogre Wrapper compatibility test

Miscellaneous Forums/General Discussion/Flow Ogre Wrapper compatibility test

We decided to show something of flow since were getting closer to release. So heres one of the basic examples that come with flow that show you the basics of WASD character control, and boned anim control.

It's nothing fancy, but it will make for a good compatibility test. So let us know if it doesn't run.

The demo loads a OSM scene that contains a robot in two parts, and the rest is coded. Would have been simpler to just load the scene complete, but this does let you get a glimpse of using Ogre with Bmax.



You can DL the demo at:

http://www.flow3d.org/walkiestest.zip

NOTE: This isn't supposed to blow anyone away :), and the top half of the robot doesn't fit because most of the parts actually belongs to another robot.



Here's the main chunk of source code for the demo:


'Setting the Scene
	
	'Get the root scene node for attaching children-
		Global RootNode:TSceneNode = mainSceneManager.getRootSceneNode() 
	
	'Main scene light positioned to the right-
		Global Light:Tlight = mainSceneManager.createLight("mainLght") 
		Light.Setposition(- 40, 600, - 20) 
		Light.setDiffuseColour(1, 1, 1) 
		Light.setSpecularColour(.5, .5, .5) 
		Light.settype(TLight.LT_POINT) 
	
	'Load the Robot OSM Scene File-
		Local OfusionScene:TOSMScene = TOSMScene.Create(mainSceneManager, mainRenderWindow) 
		OfusionScene.initialise("walkie.OSM") 
		OfusionScene.createScene() 
	
		'Grab the robot legs entity and node-
		Global robot:TEntity = mainscenemanager.getEntity("Walkie") 
		Global robotnode:Tscenenode = robot.getParentSceneNode() 
		'Grab the robot head assembly ( head, weapons, mounts ) node-
		Global robotHeadAssembly:tscenenode = mainscenemanager.getentity("Box03").getParentSceneNode() 
	
		'Get the robot's spine for attaching the head assembly to-
		Global spine:TBone = robot.getSkeleton().getBoneWithName("MechPelvis") 
	
		'Get the robot leg's animations, enable standing by default-
		Global animWalk:TAnimationState = Robot.getAnimationState("Walk") 
		Global animStrafe:TAnimationState = Robot.getAnimationState("Strafe") 
		Global animStand:TAnimationState = Robot.getAnimationState("Idle") 
		animStand.setEnabled(True) 

		
	'Main Camera Setup
		Global cameraNode:TSceneNode = RobotNode.createChildSceneNode("cameraNode", 0, 0, 0) 
		cameraNode.setInheritOrientation(False) 
		Global mainCamera:TCamera = mainSceneManager.createCamera("mainCamera") 
		mainCamera.setPosition(0, 15, - 30) 
		mainCamera.setNearClipDistance(1.0) 
		'mainCamera.setAspectRatio(1.0) 
		cameraNode.attachObject(mainCamera) 
		
	'Set up the floor
		Global Floor:TEntity = MainSceneManager.createEntity("floor", "Plane01.mesh") 
		Global floornode:TSceneNode = RootNode.createChildSceneNode("floornode", 0, 0, 0) 
		floornode.attachObject(Floor) 
		floornode.scale(150, 0, 150) 
		Floor.setMaterialName("Rocks") 

'/Setting the Scene

'Viewport Setup
	Global mainViewport:TViewport = mainRenderWindow.addViewPort(mainCamera) 
	mainViewport.setBackgroundColour(TColourValue.Create(.5, .5, .5, 0.0)) 
	Global shadows:Int = True
	
'Variables used for mouselook-
	Global yaw:Float = 0
	Global mousepos_x:Int = ogre.width / 2
	Global mousepos_y:Int = ogre.height / 2
	Global currMouse_x:Int = ogre.width / 2
	Global currMouse_y:Int = ogre.height / 2
	Global mouserel_x:Int
	Global mouserel_y:Int
	Global rotyaw:Float = 0
	Global rotpitch:Float = 0
	
	cameraNode.rotate(0.0, 1.0, 0.0, 180, TS_LOCAL) 
	
'anim speed variables
	Global animSpeed:Float =.03
	Global strafeSpeed:Float =.5
	Global walkSpeed:Float = 1

Repeat
	mainCamera.lookAt(RobotNode.getPosition().x[0] , RobotNode.getPosition().y[0] , RobotNode.getPosition().z[0] ) 
	'Increase the animation timer each frame-
	'animState1.addTime(.005) 
	'Capture relative mouse coords-
	currMouse_x = MouseX() 
	currMouse_y = MouseY() 
	mouserel_x = currMouse_x - mousepos_x
	mouserel_y = currMouse_y - mousepos_y
	MoveMouse(mousepos_x, mousepos_y) 
	
	'Transform the camera based on these coords and keyboard activity-
	cameraNode.yaw(rotyaw + (mouserel_x * 3 *.025) , TS_LOCAL) 
	'cameraNode.pitch(rotpitch + (mouserel_y * 3 * -.025) , TS_LOCAL) 
	
	'Instead of actual movement, set up animations-
	
	'Check input to determine the states of the robot-
		animStand.setEnabled(False) 
		animStrafe.setEnabled(False)
		animWalk.setenabled(False) 
		
		'The following variables contain movement details:		
		Local Strafe:Int = KeyDown(KEY_D) - KeyDown(KEY_A) 
		Local Walk:Int = KeyDown(KEY_W) - KeyDown(KEY_S) 
		
		'Actually move the mesh:
		robotnode.translate(Strafe * strafeSpeed, 0, Walk * -walkSpeed, TS_LOCAL) 
		
		'Set the head assembly node's position to that of the spine bone. Get spine bone by transforming spine's local position
		'From it's parent bone by the leg entity's world transform.
		robotHeadAssembly.setPositionWithVector3(robot._getParentNodeFullTransform().mulWithVector3(spine._getDerivedPosition())) 

		'Lets reset animation type to keep animations synced together.
		If KeyHit(KEY_D) Or KeyHit(KEY_A) Or ..
		   KeyHit(KEY_W) Or KeyHit(KEY_S) Then animStrafe.setTimePosition(0) ;animWalk.setTimePosition(0) 
		
		If (Strafe Or Walk) Then
			If Strafe Then
				animStrafe.setenabled(True) 
				animStrafe.addTime(animSpeed * strafe) 
			End If
			
			If Walk Then
				animWalk.setenabled(True) 
				animWalk.addTime(animSpeed * walk) 
			End If
		Else
			animWalk.setEnabled(False) 
			animStrafe.setEnabled(False) 
			animStand.setenabled(True) 
			animStand.addTime(animSpeed *.1) 
		EndIf
		
		If KeyHit(KEY_C) Then shadows = 1 - shadows;mainviewport.setShadowsEnabled(shadows)
	'Render one frame every 60 seconds-
	ogre.renderOneFrame()
     Delay 1000 / 60	
Until KeyHit(KEY_ESCAPE) Or AppTerminate() 


End

Function Print(n:String) 
	
End Function


We will be releasing a modable game demo that shows flow being used in a game environment with integrated editor. Hopefully sometime in the second half of the month.



old vid we posted a couple of weeks ago, of a standalone version of the OSM editor in use.

http://www.flow3d.org/AD/speedup.wmv