How to 3rd person ball controller that can look up and down?

OH for sure I really don’t want to keep you from your project. i should be able to take it from here. To be honest with you when I first started this post I was only hoping for sloppy WASD movement where the ball was almost unresponsive and the camera movement was like it’s moving at 5 fps. Needless to say, I didn’t have my hopes up but look at it now. It feels like controls from a AAA game and the camera is so smooth that I think I can even play a shooter game with a controller and not even need aim assist. It also now has complex movements like wall climbing, wall running, and wall sticking. Im at a loss for words for what this has turn into. The only thing I can say is that ill use these controls to make the best game I could possibly make.

I have expanded my plans for this game drastically and im putting everything down on a list. I also am changing up what im making for this project and im gonna combine it with another game idea that I had. Currently, everything is coming together nicely and everything is complementing each other. I also got the game progression down and the gameplay loop as well. Originally I was gonna make a parkour-heavy marble madness but now I feel like this could be so much more… it’s funny how much time one has to think up things in a 10-hour boring workspace.

If you need any ideas or if it’s missing game progression, unique mechanics, or gameplay loop, im your man but ill help with anything really. Maybe I could also be your play tester for bugs if you want. I can do some level design or modeling as well. Just give me a message and ill answer.

1 Like

Ah, my other project was just too frustrating and so here comes the ultimate 3d World:
UPBGE_0.3_Ball_joy_vWorld.blend (2.2 MB)

Now it is possible to set the overall Gravity and the Player Gravity, rotate the view with and without setting the Player Gravity in all directions.

The scene Gravity dependent on GravityBox_World:

Rotate View according to ground without changing Player’s Gravity:

The same with changing Player’s Gravity (GravityBox_Player):

longer Video:

Ball:   
    W A S D or Joystick-RightStick: move
    SPACE or Joystick-RightStick-Button: jump  (or uplift when flying at zero gravity)
    Key T: Time jump back to position 5 seconds ago
    
View:
    Mouse or Arrow-Keys or Joystick-LeftStick or Joystick-Hat: Rotate view
    Mousewheel or Page-up/Page-down or Joystick-Shoulders: Zoom
    Middle Mousebutton or Home or Joystick-Button 1: Reset Zoom
    F or Joystick-LeftStick-Button: Camera Follows Ball On/Off

Boolean hole system:
    Player can create a hole in objects with property "ground" that closes after 5 seconds.
    Right Mouse Button: enable/disable placement mode
    Left Mouse Button: dig the hole
    
Joystick selection Menu:
    Show/Hide: Key J
    Toggle through: Left Mouse Click  

Ball has 2 game properties
'Mouse_sensitivity':
    Camera speed
'Keyboard_sensitivity':
    Ball Speed

Objects with property "ground" enable the Ball to jump.
Objects with property "obstacle" will let the camera go beyond. (also the floor has this)
Objects with property "transparent" and suitable Material will go transparent when view is blocked. 

Objects with property "vWorld" align the Camera and Player Gravity to the ground.
Objects with property "vView" align only the Camera to the ground (without setting the player's Gravity).
Objects with property "vGravity" align only Player Gravity to the ground.
Objects with property "Gravity_Player" sets the amount of Gravity e.g.:
    0.0 =  zero Gravity
    1.0 = normal Gravity  

Object with property "GravityBox_World" rotates the scene Gravity.


Respawn System:
    Objects with integer property "spawn_target" are used as spawn points: 1, 2, 3  etc.  (set them to no collision or empty)
        At scene start Player will be spawned to "spawn_target" with value 0.
    Objects with integer property "set_spawn_target" are used to set the active spawn point: 1, 2, 3  etc. on Collision
    Objects with property "respawn" will do the respawning on Collision
    
Load System:
    Objects with string property "load_scene" and a Scene name will load the Scene on Collision
    Objects with string property "load_blend" and a file name (e.g.: other.blend) will load the blend on Collision  (put the the blend file in the same directory)

    
How to use this in a new file:
    (delete any camera)
    - append the Collection "GameSystem"
    - append the Collection "Boolean_Hole_System" 

How to use link to new scenes:
    in the scenes outliner select the new scene
    then right click on the Collection "GameSystem" and choose "link to scene"
2 Likes

Argh, changed it all back. The radar is unreliable. (perhaps like the near sensor mentioned in another thread !?)
Using a collision mesh as a kind of multi-objects-in-a-row-RayCast-Replacement is far better.

this is some really shocking stuff. i had my mouth open throughout the whole read. the craziest thing is that this is what I was going for with gravity. I in the other hand didn’t do that much over the weekend I only got a little of the map done and textured but still haven’t gone to the more detailed part of the map until our god and savior decide to bless us with this.

i think is only fair I show what I have done so far.




as you could possibly see in the video the ball was jumping all over the place due to the ground texture having a displacement map and colliding with the ball constantly. I was trying to add a none visible ground 0.5 over the ground level and it was working but then the unthinkable happen later and the client crashed on me. later ill redo that and mess around with the lighting because right now some places are too dark for my liking. but compared to what you have done this looks like I was slacking off XD.

Haha, changed the Transparency system again. Simply using a recursive RayCast.

Wow, this looks cool!!! You really did a lot of your map in the meantime!
Can’t say too much to the collision you mention and show with the video. I hadn’t thought that a true displacement is possible. Perhaps there is a cheaper way to add detail.
Go on! :slight_smile:

Ah ok, this looks like jumping over mesh edges again. Does increasing physics substep help?
(In absolute worstcase the solution would be to disregard the physics collisions and let the ball ride on a raycast and use forces instead of torque. But I never did something like this and hesitate to do.)

that’s the thing, i don’t think this time it’s the edges because when i make the duplicate of the ground 0.5 above the texture one and remove the texture on it the ball moves normally. with the small occasional bouncing like before but i like these but with the displacment ground its literally becomes uncontrollable bouncing sence there is no air movement yet. also yes i have tried every physics substeps from 1 to 10 and it made no diffenece with the displacement ground. actually in my opinion it makes it slightly worse bouncing with the lower substep strangely enough but with the depilcated ground it does remove the bouncing almost to like really rare. so ill just have to sacrifice some extra polygons for the ground that have displacements.

now when i saw this i was like does it also affect the player to have it act like some kind of gavity player launcher depanding on the arrow cube. i was thinking this would have been like there is an unjumpable gap and the player needs to find the arrow cube to make the gravity box launch the player across… a road block of some sorts. sadly it doesnt but it still has potential for other things.

also when i downloaded the blend.file and tested it the camera seems like before. it doesnt have the alignaxis working. the werd thing is that it has the code set up but just doesnt work which makes me wonder if it was international to leave this mechanic out or if its a bug. if you wanted to keep this mechanic i really wont prive and completely understand.

in a unrelated note, i pledge that ill make another donation to you once i get my next paycheck you really deserve it even if its a small amount.

Yes, it would be possible. At the moment this cube is only affecting the others Gravity. (because otherwise you instantly would fly away out of the level :slight_smile: )
For your idea with the gap we could just lower the gravity when you crossed a sensor.
Or have an acceleration area.

Doesn’t it work directly in the downloaded blend? I should. (I don’t keep things secret.)
But as your background looks different perhaps you ported it and this might be the reason. (The whole CameraSystem has changed)

Tree Sponge

When close to a wall rotate vWorld (or you jump off)

1 Like


it’s straight from the download I haven’t implemented any other code besides the first ever one with just movement and camera… i don’t even implement the camera collision yet XD. I normally just test everything from your downloads. if this was not international then I really don’t know what’s going on. my only guess is that you might have an addon (that I don’t) that allows this code to work but other than that im at a loss.

that being said, God this mechanic is so damn awesome! I can already see myself spending hours just fooling around with it and finding every bug with it too… it looks so crazy and it begins back memories of Marble Blast Gold and the levels that have this kind of mechanic but this is so much more awesome. also, I remember getting into so much trouble playing it in school.

There is something wrong with the file you show in the videos. My File only uses 4 Python scripts (and a welcome text).
(I can’t exactly see the small code in the videos, but this is very different from mine. I think I see some code with “self” and even “server”. This is definitely not from me)

I don’t use Addons in this file. I even just redownloaded from this site to see if it was truncated but it’s ok.
(edit: I have the Addon logic nodes installed but don’t use logic nodes. And my file also works with it disabled. But I just realized that only with logic nodes activated this cool direct display of object properties is shown:

Without it you find them also in the logic bricks or dedicated sidepanel.

I hope you get it working.
This is my file:

Here is something new: Change Gravity with out view. (This also changes the movement directions because they have to be different when on perpendicular or upside down walls.)

All the behaviour can easily set by giving the objects properties:

Objects with property "vWorld" align the Camera and Player Gravity to the ground.
Objects with property "vView" align only the Camera to the ground (without setting the player's Gravity).
Objects with property "vGravity" align only Player Gravity to the ground .
1 Like

ok, I see now what’s happening. I have an addon from long ago called easy online https://www.youtube.com/watch?v=VZqZxq9xBDU which looks like it adds a bunch of code that conflicts with yours. ill start messing around with and remove any code that doesn’t seem that is from you. sadly removing the addon doesn’t remove the code so ill have to get dirty with it and do it manually. ill back to you once I solve the problem.

P.S. ok never mind I didn’t have to go through all that. all I needed to do is unlink all the code and redownload the file and everything is now working. the reason why the online addon seems to not work with this project is that they both have similar wording like transparent and gravity. which then it had a field day messing around with the project.

this is not a bug but just an awesome way to use the gravity box. if you add enough balls you could create a one-way wall.
= Inside =


= Outside =

1 Like

Perfect that you found the thing that destroys my file.
One day in future I wanted to try the Easy Online Addon and you saved me (and others) from a lot of frustration!!
To make it short:
The shipping version of EO (version 1.1.0) is buggy and will delete, truncate and overwrite the custom python scripts of a blend.
There is a version 2.0.0 out there that you can download here as zip and install. (you can’t remove the version 1.0.0 easily, only disable)

This version doesn’t destroy existing files AFAICT. Don’t know if it really works in UPBGE 3.0.

1 Like

(From the welcome text in the video I can see that you use an older version.)

I’m curious about the displacement jumping. Could you post a file?

ok, I was wrong about the edge not being the cause of the jumping. I was more busier with the map so I quickly judged my solution without testing it thoroughly. so I decided to put the map aside for today and forces on this issue. I have come up with a few compromises.

the first compromise is to change the shape of the sphere which did help a little but was not super useful IMO.

the second compromise was to increase the mass of the ball but also increase the force applied for it can move. this helped a lot more than the first compromise but what really did wonders is the gravity systems in the scene tab. having it up to 100 makes the jumping almost unnoticeable. it’s still there but one needs to be actively looking for it to notice it.

now, these compromises do come with their downsides. for the first one, it adds more poly for not much change. the second one messes up with mass thus one needs to add more force and torque to the ball for it to move. the third one is the biggest problem solver but it also comes with its downside namely the fact that jumping now is almost impossible and the fact if one falls off they will go to the nether realm real fast. maybe seeing that you’re a master with coding gravity you could have it so that once the player press jumps the gravity will be set back to normal and if the engine detects the ball touches the ground it will set gravity back as well. to me this is witchcraft but who knows you might be able to do it.

also here’s the blend.file that has these 3 compromises applied.
Testing.blend (4.6 MB)

and here’s a quick video on how it looks. the textured part has a ton of edges and the none texture has only two subdivide.

P.S oh and I didn’t mess with the physics steps because that is too important to sacrifice for this and it really didn’t help that much to begin with.

1 Like

Playing with scene Gravity is now more convenient in the last Vworld file.
I already had the movement and jumping forces dependent on the mass and Gravity but forgot to bind it to the scene setting.
Movement is dependent on mass.
Jumping is dependent on mass and Gravity. Fortunately I found an equation that makes the jump height always the same.

You can just try out different Scene Gravity settings and the movement and jumping height should always feel quite the same.

For your map if the ground is a plane I would just reduce the unnecessary faces.
I love to see these procedural Materials and how they are made. Very interesting. Sometimes I get nice materials by trial and error but it is always like painting wildly and if I try to get an exact result it always gets worse :slight_smile:

Excellent I am happy we could come up with a solution to this problem.

Oh for sure I love procedural textures for the fact that if you link everything right it could become photorealistic and if you don’t link it right the result could still be promising and you could change it anytime as well thus it has this non-destructive workflow. if I can help it I will always use procedural until something is just far too complex that making it procedural will just slow down the engine. in this case, using the old UV-texturing is better but procedural will always have a place in my heart. what I like to do is get a tutorial of a texture that has the general shape of what you want to make and then split off from there acting like some sort of launchpad. this is also the best way I can recommend to someone trying to learn procedural texture.

p.s oh my divine god of gravity please take this small offering from one of your lowly code peasant. no, really you deserve it.

Thank you soo much!!!

Now the amount of Gravity can altered in game.

Objects with property "Gravity_Player" sets the amount of Gravity e.g.:
    0.0 =  zero Gravity
    1.0 = normal Gravity

When flying at zero Gravity, jumping is replaced by an uplift and movement is by force in Camera direction (also up and down)

I really like the flying but it needs a few things for it to be great. the WASD force should have a loss of force when the key is not pressed to make it more controllable. Holding W while Looking Straight should equalize the uplift and descend to keep it straight. Holding Left-Shift should prevent the uplift and descend with the camera view but allows the player to move with the WASD at the altitude he is in. these are some ideas to make the flying way more controllable although the way it is now is fine too.

i had over time today so i didn’t get to build my project all day to day. so i didn’t get much done but here’s the little i did do.






I haven’t textured it or added any assists yet because I only had 5 hours on it. ill do more tomorrow.

1 Like

Ah, cool, with Indoor buildings! Haven’t thought about that!!

Yes, the flying feature was just a consequence of being able to change gravity amount.
Very good idea to add air friction! This alone makes it more controillable. You can set the amount in this line in Movement.py:

#drag when zero gravity
if own['GravityFactor']==0: own.localLinearVelocity*=0.995

Don’t want to mess up with a more complicated system.

As I mentioned earlier a good idea is to have a Respawn system. So I added a system which I believe is easy to handle. As always you just have to give objects the right properties.

Respawn System:
    Objects with integer property "spawn_target" are used as spawn points: 1, 2, 3  etc.  (set them to no collision or use empties)
    Objects with integer property "set_spawn_target" are used to set the active spawn point: 1, 2, 3  etc. on Collision
    Objects with property "respawn" will do the respawning on Collision

You can create as many spawn targets as you like and give the property a number.
You can use this as respawn system or teleport.
The code is all in Spawn.py .

Here’s a shortcut to the file: