Page MenuHome

BGE local space character movement is funky when add is checked
Closed, DuplicatePublic


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 motion actuator is set to local and add the the object moves when rotated on Z axis in weird ways (kind of hard to explain.)

Exact steps for others to reproduce the error
Start game engine
Use WASD to move and Q and E to rotate.
Once you rotate over 0° the direction you move is off. If you rotate around 180° your movement becomes very jerky.



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:21 AM

Hmm, the character controller actually rotates the object. I guess there's a problem there or maybe the walk direction is not calculated correctly. I'd start by looking at KX_ObjectActuator.cpp, lines 223-255.

In cases like this it would be good to have some sort of debug visualization. So we could draw things like the walk direction vector and see if it's pointing in the right direction.
I'm not sure how one would do that in the game engine.

Another thing that I noticed is that btKinematicCharacterController::setWalkDirection() can be called with a 0 vectror, but trying to normalize a 0 vector will assert. So there's also a bug here as well.

I will ask around for the debug visualization.
@Sergej Reich (sergof) What do you suggest for correcting the call to btKinematicCharacterController::setWalkDirection() with a 0 vector?

@Inês Almeida (brita_) that depends on whether walk direction is allowed to be 0 or not. If it can be zero just check for that and don't call normalize.
I'm not sure what's intendet here, maybe ask @Mitchell Stokes (moguri)?

I haven't looked much at this yet, but T34349 might be related.

Here is a patch that resets the walk direction every frame (if the feature is enabled). This helps to simplify the character motion actuator. It also gets rid of the automatic normalization to avoid the strange issues in T34349. While it would be a nice feature to have, it is awkward to implement. If users want better control over character physics, they should just use Python.

As for a walk direction of 0, this is the only way I know of to actually stop a character from moving (short of resetting the whole character controller). So, I think this more a Bullet bug than a Blender bug.