That's it. ;)

I have tried and tried but I cannot seem to figure out how to do a certain thing in the game engine. :stuck_out_tongue: 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. :stuck_out_tongue: 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. :stuck_out_tongue: 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. :smiley:

Thank you, and have a nice day. :stuck_out_tongue:

No! You must pay! :evilgrin: LOL - Just kidding. :stuck_out_tongue:

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.

CamTest.blend (450 KB)

This example may or may not be what you need - you might need more to go on.

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. :stuck_out_tongue:

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

 
import math
pi = 3.141592653589793238462
controller = GameLogic.getCurrentController()
p2 = controller.getOwner()
 
p1 = GameLogic.getCurrentScene().getObjectList()["OBInsert_object_name_Here"]
p1x = p1.getPosition()[0]
p1y = p1.getPosition()[1]
p1z = p1.getPosition()[2]
pex = p2.getPosition()[0]
pey = p2.getPosition()[1]
pez = p2.getPosition()[2]
xdist = (p1x - pex)
ydist = (p1y - pey)
 
p1ang = [0.0, 0.0, (((math.atan((ydist/xdist)))))]
p1rot= [0.0, 0.0, (pi+((math.atan((ydist/xdist)))))]
 
if xdist > 0:
 p2.setOrientation(p1ang)
if xdist < 0:
 p2.setOrientation(p1rot)
 
 

where it says insurt object name here thats where you should put the object you want to follow.

than assign this script to your caracter.

the distance thing on second thought is unnessesary

just set up your logic bricks to run this script and move on the x axis when you press the same key

exmple: when you press up run the script and move forward on the x axis.

than just move your object to follow

C.A. - I never thought about it but starlit movement is very similar to what I want. :stuck_out_tongue:

Kylona - Donā€™t know if Iā€™ll need that but thanks anyways. :smiley:

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. :stuck_out_tongue: 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. :confused:

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).

CamTestNew.blend (471 KB)

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. :stuck_out_tongue: 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 someone tell me why none of my line breaks are appearing when I post? The post I just made is an eyesore to look at because of it.

The demo you downloaded isnā€™t similar to the video. You could ask for it. But, I guess you already solved your problem.

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.

Nevermind, I figured it out like five minutes after I posted. Sorry for the trouble if any.

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?

Attachments

Nintendo sytle movement.blend (201 KB)