ARudik / gamekit

Automatically exported from code.google.com/p/gamekit
0 stars 0 forks source link

Steering Object sends objects the wrong way #228

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a gkSteeringPathFollowing object and do minimal set up (the logic 
demo code is an excellent start).
2. Set a valid goal position and begin updating the steer object

What is the expected output? What do you see instead?
- With debug physics active, the generated nav path can be seen.  You would 
expect the steering object to control the gkGameObject towards the goal, but it 
will head off in some other direction (looks like it's the opposite way - but 
this could be coincidence).

What version of the product are you using? On what operating system?
This is using gamekit built from sources grabbed at the start of April 2012 (on 
Windows 7).

The error seems related to how the linear velocity is applied in 
gkSteeringObject.cpp.  Changing line 472 from:

m_obj->setLinearVelocity(m_forward * m_speed);

to

m_obj->setLinearVelocity(m_forward * m_speed, TRANSFORM_LOCAL);

fixes the issue (and makes sense, since we'd want to move the object forward in 
local space).  I've built gamekit to use blend files from blender 2.63+, so 
haven't tested the actual LogicDemo.  I'm not sure why the steer object would 
work without the TRANSFORM_LOCAL for LogicDemo.

Original issue reported on code.google.com by psp5...@gmail.com on 7 May 2012 at 12:51

GoogleCodeExporter commented 9 years ago
additional information related to the above: the gamekit version was r1077 
(compiled Debug profile on Visual Studio 10 Express).

Original comment by psp5...@gmail.com on 7 May 2012 at 3:37

GoogleCodeExporter commented 9 years ago
You are perfectly right. The movement have to be in local-space. When we added 
support for real ghost objects inside blender we accidentaly removed support 
for character-controller-mapping which hijacked the ghost-flag in the 
blender-phyiscs-panel. 
If you have a look at the setLinearVelocity(..) method in gkGameObject you see, 
that there are two options. If the gameobject has a rigid body use 
rigidbody-linvel or if it has a character use character-controller's 
setVelocity. The character's one follows the character-direction so it is 
local-space already, but the rigidbody's one use the 
default-space(TRANSFORM_PARENT) which is obviously wrong.

Btw, the LogicDemo was/is broken at the moment because of exactly this issue. 
What I will do now, is add Character-Support again and additionally fix 
gkSteeringObject as you mentioned.

Thx for reporting

Original comment by thomas.t...@googlemail.com on 8 May 2012 at 5:41

GoogleCodeExporter commented 9 years ago
Many thanks for the informative update - it's taking a while, but I think I'm 
beginning to get a good feel for the gamekit source code :)

Original comment by psp5...@gmail.com on 8 May 2012 at 10:14

GoogleCodeExporter commented 9 years ago
Ok, physics-character and rigidbodies using local linear-velocity are in trunk 
now.
http://code.google.com/p/gamekit/source/detail?r=1078
http://code.google.com/p/gamekit/source/detail?r=1079

Again, thx for reporting.

Original comment by thomas.t...@googlemail.com on 9 May 2012 at 12:26