Forum

Movement stopped working

12 December 2014 19:02
This is very odd and I at first assumed I'd mucked up the code but… now I'm not so sure.

I had file working (based on the 'making a game part1') last night. This morning when I opened the file, it start working as before but after i made a simple update to the Blend file, suddenly it stopped working.
THere were no console errors visible and other elements I had implemented (screen click) were fine but the movement and rotate functions were no longer working. The character would move or turn. I put in checks and it appears that the "move_cb" and "rotate_cb" are no longer being called.

I restored a backup of the entire folder from last night thinking I had changed something inadvertently but with the same outcome. No movement. The callbacks were not being called.

I'm at a loss. Any suggestions?

Side Note: when implementing the code I ran into the same problem and then suddenly, the code started working. The callbacks were being called. Wierd. Some strange voodoo thing I can't figure out.
12 December 2014 20:55
I've added a link to the file on Dropbox. If someone has the time (and patience ) I'd very much appreciate feedback on what may be going on.

Dropbox Link
14 December 2014 01:15
Hi!

There are two things I found in your code which block movement.

1) You commented a line:
m_app.enable_controls(canvas_elem);
, which among other things allows keyboard controls.

2) Much more difficult thing to find - you put your html into an iframe of another html. Such a setup do not allow browser to properly catch keyboard events. There are two ways to solve it:
a) Move all you <script> lines to index.html and leave iframe. Than you need to slightly change filepathes.
b) Remove i-frame (is it really needed?)
14 December 2014 19:45
Thanks Evgeny, very much appreciate the feedback.

On your first comment - I did at one point in trying to figure out what was going on did comment out that line but in my original code, it was left active. Thanks for point it out though as I'm learning and need to better understand how all the parts work.

The iframe IS the issue from what I can tell. As soon as I launch the file from the main html file, all is working just fine. I'll have to reconsider how I post my experiements and games from now on. The iframe is definitely not the way to go if you need keyboard interaction. Mouse clicks, etc do not seem affected which is good to know for future implementation.

Thanks again, you've at least gotten me past this hump and I know know it's not an issue of the engine but me - which is what I suspected. Next time I'll make sure I put the post in a more appropriate section ;)

James
15 December 2014 11:00
Glad it helped.

You are right about iframes. Projects with keyboard interaction should avoid it.

Anyway this is a good question and now we can give a link to this topic when similar problems will take place. =)

17 December 2014 01:42
If iframe loads need to be avoided, could we get easy access to add proper <title> and <meta description> tags?
17 December 2014 11:12
Hi,
could we get easy access to add proper <title> and <meta description> tags
If we would have only one export format - html - such options would be alright. But as we have a json export format these options would bring some ambiguities.

Thus I'd recommend using method described in part 3 of this tutorial and run your application in resizeable canvas.
19 February 2015 17:14

If iframe loads need to be avoided, could we get easy access to add proper <title> and <meta description> tags?

HTML <title> can be populated with in-Blender scene name since 15.01.
https://www.blend4web.com/doc/en/web_player.html#wp-title
The Founder | Twitter | Facebook | Linkedin
 
Please register or log in to leave a reply.