I have tried and tried but I cannot seem to figure out how to do a certain thing in the game engine. What is it you ask? Movement. Just like the movement in The legend of zelda Ocarina of Time AND in Super Mario 64/Galaxy/Galaxy 2. What I mean by āmovementā is the way mario/link movesā¦ When you push Up arrow, you move forward and your character faces forward. When you push Left arrow, you move left and your character faces left and the camera slowly goes behind you and you slowly have to switch from left arrow to up arrow to keep moving in the same direction. Get what Iām sayinā? Iāve done quite a bit in python and I know quite a bit of python. I am just not experienced enough with it I guess. What I want is a simple .blend example with this movement. I donāt care if itās just a cube and a camera just as long as it works. I know that people are busy and I was considering just paying someone to show me. But I am out of money so I was hoping that a nice blender artist would read this thread and help a guy out.
Hereās a little test I threw together. Itās interesting - Iāve never done this camera setup exactly before, though I have done a third-person shooter-type setup. This one is actually more complex than it seems - in a game like Mario Galaxy or Ocarina of Time, the camera only physically moves to follow the player if he gets too far away. Otherwise, it hovers and simply watches him.
Also, when something obstructs the cameraās view of the player, it usually moves back to not allow anything to obstruct the Playerās view. This can be done in the BGE by means of a rayCast function from the Player to the camera.
Iāve done the hovering and watching in this example, as well as the relative movement of the Player. In such an adventure game, the armature would face its own independent direction (so that he will face toward where heās moving), because the collision box is facing and moving dependent on the cameraās facing direction.
SolarLune - that seems to be going in the direction of what I want. But is there anyway you could set up a simple figure and armature to follow an empty or whatever so it moves like in zelda ocarina. If it isnāt too much trouble.
fullgrown has recently done something pretty similar to what you ask with Help of SolarLuneās BGHelper Orbiting Camera, look at his latest Starlit Video.
Though for what you ask you simple should have four to eight Empties placed around the Player but parented to either the Camera or an Empty the Camera turns around, if that is the Case. The eight Empties would then turn with the Camera and as soon as you press your directive Keys, you would make the Player face (track to) a particular Empty.
That would be the Basic Method, most probably.
you can wright a script to have an object point towards a specific object. and then the speed of the caracter is based on the distance between it. Im not sure how to script in 2.5 and above but i have a 2.49 script
Just checked the starlit demo and itās not quite what I had in mind. I donāt want a mouselook script. And he has walk left and walk right animations. And the character always points forward when you let go of the keysā¦ Not the kind of movement I was looking for. But I think if I put the 8 empties around my character and just have it follow those empties (which is pretty much exactly what you guys were saying) then I could make it do what I want.
Kylona, if you could make a simpler (smaller) script so I could just add it to my main script so whenever I push āWā, it follows that empty thatās in front of it. Get what Iām saying?
Also I once set up a lilā Platformer Script and turninā the Player worked like this:
keyboard = g.keyboard.events
if keyboard[e.AKEY] or keyboard[e.LEFTARROWKEY]:
own.alignAxisToVect((-1,0,0),0,1.0)
own.localLinearVelocity[0]=speed
if keyboard[e.DKEY] or keyboard[e.RIGHTARROWKEY]:
own.alignAxisToVect((1,0,0),0,1.0)
own.localLinearVelocity[0]=speed
The alignAxisToVect Command tells the Direction to go and the Line after makes him go.
Since I needed just two Directions, the Script is really minimalistic. But the Player automatically turns into the Direction I tell him.
I have not yet tried to expand on that Script, but it could be modified that Way that the Vector would be calculated from the Cameraās orientation.to_euler().z ā though I have never been good with Vectors.
Okay, hereās another attempt. This one has better camera work, as it follows the Player around. In a game, I would probably map the rotation of the camera to the mouse, like C.A. mentioned. On a console, it would be the right analog stick (usually).
I also have an armature and a mesh child (mesh parented to armature, parented to moving collision box), and the armature and mesh turn toward the direction they head in. The directions seem to be locked to 8 because itās turning according to the movement speed you move, which is locked. If you allow for more motion, via acceleration, friction, and maximum speed, the Player will turn smoothly toward the direction he is heading towards (except from a full stop).
Thank you, SolarLune! When it comes to python I know I can always count on you! ;D This works pretty much the way I wanted it to. The only problem would be for it to change direction more smoothly. But that can wait until later.
Making a really good 3rd person camera system like Zelda or Mario is HARD! The method I used in the past was to slow parent the camera to the player, then slow parent 8 empties to the camera itself(one for each of the 8 possible keyboard directions, spaced VERY far away from the camera/player), and have the player track to the empties(at a moderate speed) when the keys are pressed. But that still doesnāt have all of the subtle nuances of a great camera system, such as how the camera stops rotating to follow you when you stop walking, yet, after a while, comes back into place behind you, and, how the camera can smoothly transition between being manually controlled and moving automatically. To do those things, youād probably have to ditch parenting and write your own camera tracking script from scratch.
Can anyone here tell me or point me in the right direction of python to move an object in a sequence resulting in a square path. It doesnāt need to rotate. Just move positive.x 5, positive.y 5, negative.x 5, negative.y 5ā¦ so on and so forth. Any assistance would be awesome since Iāve been stuck on this for days now.
Its a little glitchy and could use some work but here it is. Im running 2.49 and it runs scripts so it will not work in 2.5. could someone look at the script and fix it for 2.5?