sasikalar / gamekit

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

createGroupInstance fail on grouped physic objects with constraint #284

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.calling OgreKit.createGroupInstance() to instantiate a group of physic 
objects with constraints

2.application crash

3.

What is the expected output? What do you see instead?
the group instantiated. but the result is crash.

What version of the product are you using? On what operating system?
Ogrekit lua runtime

Please provide any additional information below.
looks like "scene->findInstancedObject(cprops.m_target)" compares the target 
and scene content via object names. while for example the constraint search for 
object named "head" which is not available. in the scene "head/UID{0}" is the 
one that exist.

i try to edit the gkRigidBody.cpp
i edited the line 219
gkGameObject* target = scene->findInstancedObject(cprops.m_target + 
obj->getGroupInstance()->getUIDName());

i'm trying to edit the name of the object to search, and add the m_uidName 
after the target. somehow the application run (only for group instance created 
in blender, if created via code, the app instantly crash). also memory start to 
leak, and the FPS drop. 

i attach the blend file, lua file and the project.

Original issue reported on code.google.com by kornwar...@gmail.com on 11 Nov 2012 at 12:28

Attachments:

GoogleCodeExporter commented 9 years ago
i edited gkScene added this line, it is just some silly error blocking 
mechanism that i create. i do not know the proper way. i justify my self "sure 
new group instance doesn't need the physic controller to be replaced, they are 
totally new". lol. 
if(!obj->getGroupInstance())
    if (obj->getPhysicsController())
        m_physicsWorld->destroyObject(obj->getPhysicsController());

in gkRigidBody.cpp i added a conditional to check if the object is part of a 
group. In a large scene with lot of objects, i think it is faster to check only 
in the group where the object was(if it is in a group). beside it solve the 
object search which are based on name. 

gkGameObject* target = 0;
if(obj->getGroupInstance())
{
    target = obj->getGroupInstance()->getObject(cprops.m_target);
}
else
{
    target = scene->findInstancedObject(cprops.m_target);
}

i also edited the lua runtime sample, change the default file.
#define DEFAULT_LUA_FILE "spawnGroupedRagdoll.lua"

actually it is working, but the application became slow, like 6-10 FPS. i'm 
sure there's something wrong. i still need lot's of learning.

attached
1.patch
2.new blend file
3.lua file
4.lua project file

Original comment by kornwar...@gmail.com on 26 Nov 2012 at 2:04

Attachments:

GoogleCodeExporter commented 9 years ago
Actually, it is exactly how I would have fixed the issue (in gkRigidBody. Not 
so sure what you meant with the first part ). Actually I'm not sure why you get 
such small FPS, I get 300+. Actually it looks quite cool :D 

I only did test it with the runtime (not lua-runtime) placing an instance above 
the stairs with shit+a->group-instance->ragdoll-group. Actually there shouldn't 
be any difference...

Sry, that it took so long until you got a feedback. But I'm not having that 
much time at the moment.

That patch wasn't for sure that easy, but that might have helped you getting a 
bit more comfortable with the engine-code. :D 

Thx

Original comment by thomas.t...@googlemail.com on 27 Nov 2012 at 1:58

GoogleCodeExporter commented 9 years ago
Ok, commited the patch. Thx again

http://code.google.com/p/gamekit/source/detail?r=1218

Original comment by thomas.t...@googlemail.com on 27 Nov 2012 at 2:18

GoogleCodeExporter commented 9 years ago
one of the cause of bad FPS is i'm using intel D processor 1.6 GHz which are so 
old, also ultra GPU, the supreme intel Graphics Media Accelerator 3100. 
RTShader demo on youtube makes me cry :D.

Original comment by kornwar...@gmail.com on 27 Nov 2012 at 2:29

GoogleCodeExporter commented 9 years ago
Wow, that I do call marvelous specs :D Why is that so? Shouldn't be much fun 
using an ide either...

Original comment by thomas.t...@googlemail.com on 27 Nov 2012 at 2:33

GoogleCodeExporter commented 9 years ago
i just stuck with it these years :D. new year, new machine.

Original comment by kornwar...@gmail.com on 27 Nov 2012 at 3:57