Rotate character to direction of key press, and begin walking

Incase you still need help, use this logic setup:

Properties:
Idle (BOOL): true

Always_____Expression: Idle == true_____Action (or IPO) Walk: Loop End
Keyboard: Forward____AND_______Property: Idle = Assign: false

Sorry for being such a nuisance, but I’ve met another issue =
I posted it on the thread’s first post (the main one, original one, etc…)

erm, if the idle animation has a higher priority number than any other animation, it can always be left on- it’ll only play when no other animations are running. this makes things a bit cleaner.

do you want the character to turn left according to the camera, or the world? it’ll be a lot easier to make them turn to the global left, but then if the camera turns at all pressing left might make the character walk towards the camera or whatever (did that make any sense?)
do you want python or not? I could make an answer either way, python would be a LOT easer unless you didn’t know it well enough.

also, basically the only resource I use for the BGE, aside from these forums, is the python bindings. Unfortunately, not a lot has been written for the game engine in general, and what has tends to be out of date; the people who understand it would rather be either working on or with the engine, and the people who don’t, well, don’t. that doesn’t leave a lot of people to write documentation, especially without any pay.

Thanks for the lengthy reply!
I’ll use that ‘idle pose’ note you said.
To answer your first question, I’d want to turn left according to the camera, thanks for that note, I hadn’t thought about that.
To answer your SECOND question, if Python makes it a lot easier, I could definitely try. I have very little experience with Python (I tried a little bit of a tutorial, also had to do some searching to get expressions right), so if you required me to have abundant knowledge in a certain area, I’d probably have to spend a couple hours (or days depending on what it is) learning about it, so I guess whether or not it’s actually worth it would be your decision, since I don’t know much about the two possible methods.

  • Also, if doing it without the use of Python isn’t too difficult/confusing (both on my part [learning/implementing] and yours [teaching/explaining]), I could definitely do that as well.
    I’ll check out that Python Bindings site in a little bit, thanks for the link (and the provided information on the site as well =p)

I already had a file that uses this method, so it was easy enough to comment (sorry for my terrible explanations -_-; ) if you want a different method (maybe one that doesn’t use the orientation matrix…) I can make that.

if you feel up to learning the orientation matrix, (I don’t recommend it if you’re still unsure about python) you can check out Social’s tutorial.

'k, I think I’ve thrown enough random information at you for a bit ^^

[edit] I had an extra indent in the file accidentally, it’s fixed now

Thanks a bunch! (sorry for delayed response, school’s long X_X) I was able to quickly skim through at school and it indeed looks like a bit much, but hopefully I can figure out what to do, thanks for the assistance http://tehclan.com/forum/style_emoticons/Light/smile.gif

I looked at the .blend file you provided, and it was just what I wanted to do! Since it seemed so complex, I didn’t think I’d be able to do it myself from that tutorial you provided, so I tried to just duplicated everything you did in the file on my own game. I thought I had it working, or at least close, but it… well… isn’t. I created the “empty” objects, renamed everything appropriately, added the 3 python files as well as the code, added all the sensors/controllers/actuators you had (or at least as far as I could tell), even the vertex parenting (if that’s what it was called, it was in a comment on the CharacterControl python script). To top it off, when I’m in camera view and I press the ‘p’ key to start the game, everything goes blank and I literally can’t see anything. If you’re still around, would you mind taking a look…?

The .blend file: http://h1.ripway.com/ashflash/testsonic1.blend

The character’s moving animation is kind of suckish, but it was my first time, I’ll probably improve it once I get this walking thing figured out (so at the moment it looks more like he’s ice skating)

Edit: Forgot to mention, but thanks a bunch for the assistance http://tehclan.com/forum/style_emoticons/Light/happy.gif

okay, I found some problems, some of them my fault and some were things you missed ^^
…but I could only get it to half-work, there’s gotta be something I’m still missing :frowning:

let’s start with the things you made for the sake of my ego -_-;

  • some objects (the armature and the bounds, I think) were scaled. this can cause things to act in unexpected ways in the GE.
  • the rotG actuator wasn’t attached to the mouse move script (I’m sure you would have noticed that yourself once the other problems were fixed, but whatever)
  • the parent order was off- it should go like this (indented items are children)
    -Player bounds
    —camParX (vertex parented- more on that later)
    ------camParY (useful if you want to rotate the camera vertically, but not entirely necessary otherwise, so you could leave this out if you wanted)
    ---------camera

Okay, now on to my mistakes.
I must have been really tired when I made that file, 'cause I basically skipped over the vertex parenting. to vertex parent for the purposes of this method…
-select the player bounds, and place the cursor on it (shift-s, cursor to selection)
-select camParX and then player bounds
-go into edit mode, and add a vertex (deselect everything, then ctrl-click anywhere)
-snap the vertex to the cursor (shift-s, selection to cursor)
-now, with just the center vertex selected, you can ctrl-p.
basically, since camParX only has a point for a parent, it can’t get any rotational information, and keeps its own orientation. it still moves with the player however, so the camera can still follow along.

-the empty the camera was parented to (camRay in my file) was a leftover from something else, not really useful any more.

but what confuses me is that after these things are fixed, it turns fine, but doesn’t move. I have no idea what’s wrong…

I recommend appending from my file (or appending sonic into my file- either way should work) using shift-F1, driving to the file you want, going in the blend, choosing the objects you want, and importing them from there (I think you have to do it one object at a time, sorry)

…sorry I couldn’t be more help, maybe I’ll give a shot at making that more understandable version later this weekend. python is all well and good if it’s cleanly written (unlike mine) and you understand it, but it’s not too helpful if it’s not…

[edit] wow, I didn’t realize I had written this much, I get carried away too easily :slight_smile:

Thanks for writing so much I guess, it usually really helps (plus it’s nice to know you’re willing to spend the time to help me with a lengthy explanation . So it seems to be working just great! I wasn’t sure how to do it properly from my file, so I just imported the Sonic character from the sonic .blend file and remade his walking animation (it needed work anyways). I made that box that’s was there previously invisible during game play, scaled sonic to the right size, yadda yadda…

Just a small problem. The max FPS [frames per second] I’m getting is about 18, with an average of like 16 or so. Why is this? I tried raising the FPS from 25 to 45 just to see if it went any faster, but no improvement. Since it might be important, I’m using 2.46 (I like to use the most recent versions of any program, to keep up to date and such). Here’s the .blend file for your own (whoever “you” happens to be in this case, lol) “experimentation” (in case I didn’t provide enough information)
http://h1.ripway.com/ashflash/Sonic_Game.blend

hmm, I’m pulling 60 fps whether I have all frames enabled or not, which is odd 'cause with all frames i usually get about 200 with such a simple file.
some people were talking about problems with “use blender materials”, try turning that off? it’s in the “game” menu up top.

I’m back from school now

Thanks for the idea, but when I disabled (unchecked) it, I only gained about 2 FPS or so. Is there anything else that could cause this? I’m going to do a little looking around for something that’s constantly doing something that could bog it down…

Wow…
when I disabled “show framerate and profile” from the Game menu, it sped right up! Really weird, but I guess it isn’t too much a problem http://tehclan.com/forum/style_emoticons/Light/smile.gif

Hmm just to be sure you should check your logic setup to make sure it’s as efficient as possible. You can create an empty called something like ‘always’ and just link all functions requiring an always function to that empty. The logic can be just as much a drag on the framerate as the graphics.

If you’re using python scripting try to see if there’s a more efficient way to give the same output.

It’s strange that the game should speed up when you disable the viewing of framerate and profile. You’d think drawing a textbox in the corner of the screen and making it display info wouldn’t be that difficult.

Meh, whatever floats your boat I 'spose.

the logic is using less than 1% of the resources, with the physics pulling 50% and rasterizer (graphics) at about 30. the rest is overhead. (why didn’t I look at the percentages before?)
this is odd because the only physics should be a cube, with rigid body disabled. the only other collision-enabled faces are 256 quads making the ground. the graphics consist of a single UV mapped texture (on the ground) the ground’s faces, and a model of sonic, no special effects or anything.

I’m gonna run it in 2.45 to see if it’s any faster.
[edit] I can’t get to the download page for older blender versions, if anyone has 2.45, they might try comparing the two? there were several threads about speed loss in 2.46.

I happened to have it laying around, so I uploaded it to some site called 2shared :smiley:

Edit: I tried playing the game in 2.45 and I’m getting the same result >_>