Collision Box Help

Hello, I am somewhat new to blender (been using it for about 2 months) and ran into a problem. I am currently creating a simple game and have had some trouble with collision boxes. If I move my cube on a bridge for example it can move across it but as soon as I push into it from the side i eventually move through it. I have a collision box for my cube but I still am able to push through the bridge. Also if I add a collision box to the bridge I cannot even walk on it because it adds invisible walls. Is there a way to make the collision box only go around each face instead of the object as a whole or can you make a custom one? Thanks in advance! Ps I am currently using blender 2.62

There can be a lot of different things that could be causing your problems. The best thing to do in these situations is to post a simplified blend file so people can help you more easily.

When enabling collisions bounds, the default setting creates a box that fully encompasses the object. If want the collision bounds to be restricted to the faces of the mesh, use triangle mesh. However, you should note that this setting puts the most load on the physics engine, so you should try to avoid using it when possible, especially on high poly meshes.

In general, I prefer to create separate, invisible objects for collisions and set the visible, more complex mesh to no-collision. This gives you more control over the object’s collision bounds and lets you make simpler objects that will put less load on the physics engine while still being able to use the normal mesh as the visual component.

Thank you Mobious for the information. But here’s another question, what’s the best way to do collision boxes on a huge landscape or map?

I actually can’t really speak from experience there, but you can probably get by fine using triangle mesh on either the landscape itself or a lower poly version of it.

I may have made the triangle mesh setting sound worse than it is in my previous post. It only really becomes a problem when you begin to use it on multiple dynamic or ridgid body objects, so I think you should be fine using it on a large, static terrain object.

is compound checked? try setting your margin to .06
also, another neat thing, collide level apply force linear .1 add
so they are “buoyant” even if they fall through


Bounds.blend (469 KB)

@ Andy854610: What kind of motion is on the player? With Servo Motion or Simple Motion Force you will go slower on slopes, even to the point you can’t move at all.

@ Raco : The current motion of the player is through a python script with a simple applyMovement(forward/back) applyRotation (turning) and applyForce(jumping). Is there a better way to use motion or is this it?

well, apply force, and apply angular momentum on a dynamic works, what are you trying to achieve? I have a player that walks via torque and friction…

it’s all about what you want to do,

Yup, applyMovement does a teleport thing. It teleports is 0.1 units (or whatever) every time it is run.
Instead, have a look at servo motion, as it uses proper physics for motion.

As sdfgeoff explained applyMovement may be the problem. Servo motion is better. If you would be searching for more control even, use localLinearVelocity. It would enable the player to move regardless how steep slopes are.

Loooool, thank you man, I’ve been looking for something like that a lot of time, since I was using “linearVelocity” but it doesn’t work for “dynamic” objects (need local parameters). Just didn’t think about the “local” word before linearVelocity lol :stuck_out_tongue:

Ok so I will try servo motion. I know how use it with logic bricks but what would I type to use it in python? Also what do you guys think would be the best motion for a 3d platformer?

I’m happy you found what you were looking for. You could also use setLinearVelocity(velocity, False), but I think this can be considered as outdated. Have a look at the API, you’ll find lot’s of more stuff you can do with scripting! Fill in the search field words like ‘GameObject’, ‘Scene’, ‘Logic’, …

So then what would be the best type of motion to use in a 3d platformer in your guys’ opinions?

For me now I personally get the most out of localLinearVelocity but I have to look into Servo Motion controlled by a Python script. It really depends on how you want to move your player and if there are different types of movement on the player. Maybe I’m also interested to know if with Servo Motion you could come to a sudden stop and start of the motion. Anyone?

EDIT: I remember with this Movement Script tutorial, Servo Motion is controlled by a Python Script, but I will try to simplify it so it’s more readable (to me).

I have been experimenting with servo control and my character always slides is there an easy fix for this?

Material friction,

Look at the Movement Script Tutorial. There is a delay sensor named ‘Stop’ that is used to avoid sliding. But to be honest I don’t know if this would be the best way to do it. I personally prefer to use localLinearVelocity. Here’s a simple movement example.


SimpleMovement00.blend (81.7 KB)

Logic brick walk cycle controller
key W ------------------------------------------------------and--------------prop assign “count” 1
if count=0--------------------------------------------------/
(property sensor - interval) if Count 1 through 29-and--------------prop add count + 1
if count = 30 ----------------------------------------------and--------------prop = 0
if Count = frame blah --------------------------------and----------------do whatever

this way, if your walk cycle is 30 frames, you can move by applying force, or by linear motion etc,

and selecting a material and going to physics and turning up friction works pretty good,

So instead of using servo control I now use setLinearVelocity. It works pretty good and I was able to make my player not slide without the use of logic bricks. But if I am Falling and I move my player I fall really slowly. Is there a fix for this where even if a am moving while a fall I fall at the normal speed?