Changing character colider bounds(is it possible)

I am not too far in development to make changes to my movement, but I knew earlier that I would need to address this issue…
My characters are using the ‘character’ profile in the physics tab, because I found it the most stable…initially I was doing a raycast to the ground with a dynamic object and just setting the characters to the hit position…but I found myself walking through a lot of walls etc, so I switched to the character collider…
…anyway…
Is there a way I can change the min/max bounds of the giant sphere collider…seems anything other than sphere slides on slopes…I wouldn’t mind using the ‘capsule’ or ‘convex hull’…but they also slide on slopes…

…please someone educate me :slight_smile:
or can someone show me a link where I can find some good information to remove the sliding :)?

are you using UPBGE?

if so:
you can increase “Friction” in the physics tab there (dont know if that will solve it but you could try)

Yes, I am using UPBGE. No, I cannot use friction as it is not in the character wrapper.
This is all I have found. I assume I will not find much more than this…maybe someone has a better solution? I know many people use ‘dynamic’…but as I said I can walk through walls when I enable it, maybe I am using it wrong.

*I can scale things up to use the character collider, but I’m not sure what problems that will bring later.

you could use Dynamic, and whenever you walk you cast a ray to see if there is a wall

I can, but I want to limit the raycasting, another way is to cast and move the opposite direction of the normal…but again raycasting…I have enough of that. It can eat a lot of cycles if you use it on many characters.
I found a solution that is simple, I can apply the character collider to an empty…for some reason you can scale it with an empty…I just need to copy all my properties over to the empty and use that…I’ll see if it works :). I DOES scale with the empty so…??? I’ll do some testing and if it works mark this as solved…

actually why can your Dynamic Player go through walls? Mine cannot and he does not rayCast all the Time (only when dashing)…

I have no idea why I can walk through walls? I use applyMovement…that is probably why…even with a character collider I should not but it works fine…how are you doing movement?

OK, so I did a quick test(new scene) and with some slight script modifications it should work…step height is one thing that needs to be maxed out…or raised drastically anyway…a few modifications to raycasts and it should work fine…I just need to be careful about level/world design in cases where the characters heads can be obstructed by a mesh…that or use a raycast offset to ‘ground’ the collider…I will need to implement it actually in game before I know all the ins and outs.

i also move with applyMovement

except my enemies (so i dont have to run their script every frame)

Do not move with applyMovement. ApplyMovement is a teleporter - it teleports the object forwards by a small increment each frame - completely ignoring physics whilst doing so. Instead, set the worldLinearVelocity, or use a servo motion actuator (PID control).

yes, I am aware that it sets a location each frame ‘apply’…implies that…so I should look at ‘worldLinearVelocity’…that sounds like it does not use local transforms…can you break down it’s basic use, or provide a quick link. I’m not code illiterate, but I am short on time…and if you can spit out a one line piece of code, I would appreciate it…otherwise I can just do some homework on it tomorrow after work.

either use:

obj.setLinearVelocity((x,y,z),True)

or:

obj.localLinearVelocity = (x,y,z)

# Can Also Do
obj.localLinearVelocity[0] = x

https://pythonapi.upbge.org/bge.types.KX_GameObject.html#bge.types.KX_GameObject.localLinearVelocity

To move forward on the Y axis at one unit per second:


obj.worldLinearVelocity.y = 1

thanks, I will try this when I come home from work.

ok, this works…a few issues…

using dynamic…which I don’t care for, but it is easier to control the col shape.

  1. I assume increasing the friction will stop the sliding(because…grass != ice)?

  2. how do I overcome small obstacles(low steps etc)? Do I need to raycast down and set the colider to the hit position+offset amount?
    because I am getting stuck a lot…it’s not very smooth.

  3. Dynamic colliders… what are the benefits of them are over character colliders/physics

on a side not I cannot seem to get linearVelocity to work when using a character collider, but it works with dynamic?

ok, well after some messing around today(after work…I hate overtime…especially on the weekend) I managed to get everything back to working order using the scaled empties to scale down the character collider. I do understand why I should not use ‘appyMovement’, but it seems to work fine on the character controller…no issues…with dynamic I end up with all typed of problems…from sliding(low friction) to climbing up walls…all those things add up to too many workarounds and redundancy checks so I am sticking with what has worked :)…

It did take sometime moving all the properties over by hand to an empty…since I cannot combine a mesh and an empty, but now I at least have a base to work from and enemies no longer get stuck at the edges of doorways or fences etc. I will mark this as solved again…although it was more about learning + finding a workaround…but that’s game dev for ya’.