Jump to content




Photo

JavaScript Raycaster

Posted by benryves, 30 May 2006 · 88 views



A silly project from over the weekend: JavaScript raycaster.

I couldn't work out how to handle keypresses in Firefox, and Firefox is too slow and flickery to make it worthwhile. IE runs it fine but at less than 1FPS, meaning that more often than not you end up walking through the walls. Opera is about the only browser it works happily in (~12FPS). Ah well.




Mozilla has one and I'm sure The5K had a few.

Edit Mozilla's uses the nonstandard <canvas> tag.
Well it looks awesome, but I really don't feel like installing Opera. FireFox I got 10FPS but couldn't move and IE I got 1FPS.
I'm getting an average of 4 FPS in Safari (and the keys work) - but it freezes Camino.
Yay! 3fps (FX) and 12 fps (Opera) here. I'm wondering how fast this might run with the canvas tag. I might do some experiments later, but not until at least the weekend (exams and so forth). [grin]

Edit: I get about 8 fps in SeaMonkey... Maybe it's just Firefox that sucks? ;) Perhaps it's my extensions.
The Mozilla Raycaster uses

onkeydown="press(event);" onkeyup="release(event);"

I see yours take no parameters.

Anonymous Poster
Jun 01 2006 04:06 AM
Quick Firefox fix:

FIND:
onkeydown="KeyDown();" onkeyup="KeyUp();"
REPLACE WITH:
onkeydown="KeyDown(event);" onkeyup="KeyUp(event);"
FIND:
return window.event.keyCode;
REPLACE WITH:
return (window.event) ? window.event.keyCode : evt.keyCode;

It's almost unusably slow, though.
PARTNERS