Forum Replies Created
- 
		AuthorPosts
 - 
		
			
				
I just had a quick hack with hingechain by enabling VR and it seems to behave eactly the same as without VR.
I didn’t play with UpdateRate at all – it defaults to 60, but it’s the elapsed time parameter that really matters here. A quick way to test the effect of different update rates is to remove scene.Update from OnRender and use something like this in your ctor instead:
Monkey1234New Timer( 120,Lambda()_scene.Update()End )This works (with hingechain physics anyway) with every update rate I throw at it until I start using values less than 60, the default UpdateRate. To fix this, I need to either reduce UpdateRate to 30 or increase MaxSubSteps to 2, ie: either use one update at 30hz or 2 at 60.
What you may be having problems with is the impulse stuff as I think. I believe impulse is ‘instantaneous’ so may have to be scaled by time somehow, will look into it.
The Scene.UpdateRate and Scene.MaxSteps properties are only used by bullet when stepping the simulation – they are passed to this function:
http://www.bulletphysics.org/mediawiki-1.5.8/index.php/Stepping_the_World
Thre first parameter of stepSimulation is computed by mojo3d and is simply the elapsed time since the last UpdateWorld.
You should be able to determine HMD refreshrate by DrawText-ing App.FPS and looking at the app window with HMD removed, or even just by Print-ing it.
On the Vive here, FPS is 90, but I seem to remember hezkore had to set SwapInterval=0 or he was getting 60?
Thanks, the box2d module is now published and will appear in future releases.
I haven’t had a chance to play with it yet, but it at least builds OK – well done, can’t have been easy!
Anyone else who wants to have a go with it, just use the module manager from the build menu to install it.
Is there a way to render a portion of an image without having to create new ones, as you do in the LoadSpriteSheet function?
There are versions of Canvas.DrawRect that have a source image parameter, eg: DrawRect( x,y,w,h,srcimage:Image,srcx,srcy,srcw,srch )
If it builds OK, just get it out there I think!
> Yes a simpler official resize method would be nice…
Ok, will do.
The View.Frame property can be used to ‘layout’ views – try adding this to your Window class:
Monkey1234Method Resize( width:Int,height:Int )Frame=New Recti( 0,0,width,height ).Centered( New Recti( 0,0,App.DesktopSize ) )EndI’m reluctant to add this to the Window class as a ‘core’ method as it duplicates functionality that’s already there (ie: Frame). However, perhaps it would make sense to add some stuff like via built-in extension methods? This approach worked out well with Entity class IMO.
And of course if your doing fullscreen there is also BeginFullscreen/EndFullscreen…
The easiest way is to override the window size in the window constructor.
Have a look at the mojo template project – replace the 640,480 with your desired size:
Monkey123456789101112131415161718192021222324252627282930313233Namespace myapp#Import "<std>"#Import "<mojo>"Using std..Using mojo..Class MyWindow Extends WindowMethod New( title:String="Simple mojo app",width:Int=640,height:Int=480,flags:WindowFlags=Null )Super.New( title,width,height,flags )EndMethod OnRender( canvas:Canvas ) OverrideApp.RequestRender()canvas.DrawText( "Hello World!",Width/2,Height/2,.5,.5 )EndEndFunction Main()New AppInstanceNew MyWindowApp.Run()EndNot sure if it’s of any use to you, but I’ve just added a new ‘weak reference’ type that is already in the develop branch and will be in the next binary release in a few days.
Weak references are mainly of use for writing ‘resource caches’ and the like – they are like variables in that they contain an object reference, only they don’t keep the object live for GC purposes.
Looks very cool!
So if I wanted to save a zip
More functionality will need to be added to the ZipFile class before this can (easily) be done.
Ok, haven’t done zip:: stream yet but you can now use Stream.SharedPath to get a unique path to an already open stream. This means the zipfile stuff is a lot nicer:
Monkey1234567Local zip:=ZipFile.Open( "asset::yasuko.zip" )Local data:=zip.ExtractData( "yasuko.jpg" )Local stream:=New DataStream( data )image=image.Load( stream.SharedPath )stream.Close()zip.Close()Nice, all working A-OK here!
See below for one possible solution. It loads a jpg image directly from a zip file.
It’s not very nice though, a simple ‘zip::’ stream would be sexier, or even some way to pass a DataStream to Image.Load. Will look into this…
Monkey1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253Namespace myapp#Import "<std>"#Import "<mojo>"#Import "yasuko.zip"Using std..Using mojo..Class MyWindow Extends WindowField image:ImageMethod New( title:String="Simple mojo app",width:Int=640,height:Int=480,flags:WindowFlags=Null )Super.New( title,width,height,flags )Local zip:=ZipFile.Open( "asset::yasuko.zip" )For Local file:=Eachin zip.FilesPrint fileNextLocal data:=zip.ExtractData( "yasuko.jpg" )Local path:="memory::("+ULong( data.Data )+","+data.Length+")"image=Image.Load( path )zip.Close()EndMethod OnRender( canvas:Canvas ) OverrideApp.RequestRender()canvas.DrawImage( image,0,0 )canvas.DrawText( "Hello World!",Width/2,Height/2,.5,.5 )EndEndFunction Main()New AppInstanceNew MyWindowApp.Run()EndHmm, I’ve done AmbientLight = 0 and all other lights 0, to no avail.
You need to set scene.EnvColor=Color.Black too, or you’ll still be able to see specular reflections.
 - 
		AuthorPosts