Page MenuHome

Triangle mesh BGE character mode crash
Closed, ResolvedPublic


System Information
MS Windows 7 Home Premium 64-bit SP1
NVIDIA GeForce GT 555M

Blender Version

Broken: 2.71 Release Candidate 2 a19c1be

Although it's been broken since at least 2.67.1 r57348

Short description of error
When object's collision bounds is set to triangle mesh and physics mode is set to character, blender will crash when object hits another.

Exact steps for others to reproduce the error
Change object collision bounds to triangle mesh
Start game engine

(File is from another bug)



Event Timeline

Joseph Masaki (vertenflow) raised the priority of this task from to Needs Triage by Developer.
Joseph Masaki (vertenflow) updated the task description. (Show Details)
Inês Almeida (brita_) lowered the priority of this task from Needs Triage by Developer to Normal.Jun 18 2014, 10:31 AM

This is really the weirdest thing...the localGetSupportingVertexWithoutMargin should be defined for the triangleshape type that the offending variable is. I even have -fsanitize-address on and I haven't seen any error here.

However, a lead for you Ines might be that changing the physics type of the object from character to rigid body seems to bypass the problem. So maybe there's some initialization that is skipped here.

I suspect this might not be a blender bug, but you can see what happens differently between the two cases so you might at least somehow bypass this. I hope that helps even if a little.

To avoid any misunderstanding - I haven't seen any error -before- the crash. I can confirm the crash too (This is on Ubuntu 64 bit)

From a quick glance, the character controller needs a convex shape. This is either the main shape assigned, or a separate convex shape.
For the latter m_useGhostObjectSweepTest needs to be set to false.

At least one part of the bug is that we are casting the collision shape to a btConvexShape* in CcdPhysicsController::CreateCharacterController().

I'm not sure in what case you'd use a triangle mesh for characer controllers, maybe the best (and easiest) solution would be to disallow that completely.

As for adding a trimesh case in localGetSupportingVertexWithoutMargin(), that doesn't really make sense, for a convex shape ;)

@Sergej Reich (sergof) what to you suggest instead of casting the collision shape to a btConvexShape* ? both CcdPhysicsController::CreateCharacterController() and btKinematicCharacterController::btKinematicCharacterController that it is inheriting from receive a btConvexShape . Is that correct? Is this a problem even if we disallow triangle meshes?

@Inês Almeida (brita_) the problem with the cast is that the shape can be non-convex, as a trimesh is. So we have to at least make sure that the shape is in fact convex before casting.

If character is not supposed to have a triangle mesh shape, what about a fallback strategy, like the one used for character motion. Print a statement like that one:

"Character motion enabled on non-character object (Cube), falling back to simple motion."

and use the default shape. It can also be used as temporary patch.

I think I couldn't really guess what would be the best shape fallback. The user should set it, I think. @Sergej Reich (sergof) thoughts on this?

The idea is that on new files, users won't even have the option. On files that already have this combination it would be left untouched. I am unsure whether most users actually see the prints, so I think there would be cases where the option would be silently changed without the user noticing.

Inês Almeida (brita_) closed this task as Resolved.Feb 19 2015, 12:29 PM
Inês Almeida (brita_) claimed this task.

Closed with D984