3rd Person Platformer - General Movement (Python/Logic)

I’m trying to create a third person platformer in the BGE, and am coming across only a couple or maybe even just one problem. It’s the rotation. I know how to do it already, but it doesn’t come out the way I want. I’m also working with Python to so a logic brick or Python solution would be what I’m looking for or any advice in general.

Here’s two attempts at third person platforming I have made:

https://www.youtube.com/watch?v=oP4ROfheM1k&list=UUEM1zu2SJJ0NEM_zSEYHmLg (Rotation)

https://www.youtube.com/watch?v=tHSDBJLTVKc&list=UUEM1zu2SJJ0NEM_zSEYHmLg&index=2 (8 Way Movement)

I really want something more like a natural Sonic game, One in particular catches my eye:

https://www.youtube.com/watch?v=ALiCx7XLPj8&list=PL01CB882D0762F98F - This was made in blender and I was looking for something akin to this.

Any advice, tutorials, examples, would be nice.

I am learning Blender Python and have intermediate knowledge of the blender game engine.

Do you look for some Camera relative alignment/movement?

Edit: link updated

Thanks for the quick replies! I’ll get back to you both with my progress.

@Monster: The link did not work.

@Laser-blaster: Thanks I’ll try this out!

I updated the link

Thank you guys! Now I have another question (is it okay if I keep them in this topic?) I wanted to make make character be able to jump on objects to hurt/destroy them but I don’t see any way I can add logic that detects when a property is set to 1 or not. It can detect a property but it can’t detect what the property is set at- is there any way to do this?

Also thanks for the engine laser and monster and for my next project I’ll definitely look more into these!

(my progress so far: https://www.youtube.com/watch?v=TINabMF4JMU)

Sorry for the double post but I have this code working through my head over and over… I know what I want but GML doesn’t carry over to python very smoothly :stuck_out_tongue: Well sort of.

What I have in mind is that the script would get the Cam.zRotation (or what the variable may be called) And compare it’s rotation to such and rotate when a key is pressed a certain until reaching the point where it shouldn’t anymore. Something like this:

  • player rotation script -

cam = bge.getSceneObject[“Camera”]
rot = z.Rotation
speed = vec_vel.magnitude

if speed < 0.001:

#when key left is pressed
if rot &lt; cam.rot-180:
	rot += 90 #should quickly rotate player to face left
#when key right pressed
if rot &gt; cam.rot+180:
	rot -= 90#should rotate quickly rto face player right
#when key up pressed
if rot &gt; cam.rot or rot&lt;cam.rot:
	rot += 90
#when key down pressed
if rot&gt;cam.rot+360 or rot&lt;cam.rot-360:
	rot -= 90

if speed > 3 and speed<6:

#here I would do the same thing but the cam rotation checks would be close angles so your not turning completely left at one point while holding up and make the rotation speed less. 

and so on and so on…

…this is just farse code I was thinking on and I really think would work, any help would really be appreciated and telling me if thsi would even work or not.

Question: (Didn’t wanna make multiple topics) Is there a way to call the speed at which your character is going? In python that is. I know magnitude but that only works for additive movement, which in my game that I’m making isn’t a very good option. Any help is appreciated.

You could use the object’s worldLinearVelocity vector, but that’s magnitude; I’m unsure of what you mean by “additive movement”.

that depends if you have a logic brick acting as your movement system, when you have an motion actuator you have the dLoc variable where you can find your speed.
without a motion actuator you can check with two empties in line with the path you follow and measure the time it took to pass that distance.

^ Eh? DLoc isn’t really speed, and it’s really not suggested to use for character motion.

I pretty sure he is talking about like acceleration motion up to a target top speed. “additive motion” thats what your talking about right?

Right. I have logic bricks that set speed rather than use the linear velocity ‘ad’ option.

dLoc gives the distance you will travel over the logic tic.
for example: I have y is forward dLoc could be [0,1,0] so my character will move 1 unit per tic forward.

Is it okay to bump this up with a question?

Is there a way to track how fast your character is moving through logic? I’d like to set up a brake system before the character rotates to turn the other direction. So can any of the logic bricks or logic brick combos do this, or is this something that I’d have to learn python for? I took a long break from blender and forgot most of what I knew so I’m just throwing together a quick game before I want to get more seriously back into it, that’s why I’m looking for a logic brick solution, for now at least. Maybe later I will try to learn python again.