How to set a relative parent-child relationship?
5 posters
How to set a relative parent-child relationship?
Is this code supposed to make the child's transform RELATIVE to the parent?
Child->_SIO2transform->_SIO2parent = Parent->_SIO2transform;
That is . . . will Child->_SIO2transform->loc be rendered RELATIVE to Parent->SIO2transform->loc?
I tried this and . . . I have child objects rendering completely out of place . . . not how they were designed in Blender.
Thanks for your help.
Child->_SIO2transform->_SIO2parent = Parent->_SIO2transform;
That is . . . will Child->_SIO2transform->loc be rendered RELATIVE to Parent->SIO2transform->loc?
I tried this and . . . I have child objects rendering completely out of place . . . not how they were designed in Blender.
Thanks for your help.
sgreenwalt- Posts : 18
Join date : 2009-04-24
Location : Layton, Utah
Re: How to set a relative parent-child relationship?
The position that is exported from blender is the world position not relative to the parent... If you want the relative position you have to calculate the relative position manually.
What I am really asking . . .
What I am really asking is:
What is the purpose of _SIO2parent?
Does the engine have the ability to adjust the child objects location (relative to the parent) if the parent's location changes?
What is the purpose of _SIO2parent?
Does the engine have the ability to adjust the child objects location (relative to the parent) if the parent's location changes?
sgreenwalt- Posts : 18
Join date : 2009-04-24
Location : Layton, Utah
Re: How to set a relative parent-child relationship?
I'm not sure if this is an option or if it would work but could you offset your objects center then use _SIO2parent to get the effect you are looking for?
uprise78- Posts : 228
Join date : 2008-10-31
Re: How to set a relative parent-child relationship?
I am headed in that direction.
I was just hoping that, by simply specifying the parent->child relationship . . . that the engine would handle the rest (i.e. . . . move the parent and the children move with it).
I will have to write that.
I am not complaining.
From what I see so far, this engine is really excellent.
I was just hoping that, by simply specifying the parent->child relationship . . . that the engine would handle the rest (i.e. . . . move the parent and the children move with it).
I will have to write that.
I am not complaining.
From what I see so far, this engine is really excellent.
sgreenwalt- Posts : 18
Join date : 2009-04-24
Location : Layton, Utah
Re: How to set a relative parent-child relationship?
You could use a bullet 6DOF hinge constraint to achieve this I think...
If you search on the forums you should find some examples I believe.
An example was posted in this thread recently:
https://sio2interactive.forumotion.net/sio2-engine-f3/sio2-architecture-and-bullet-physics-integration-t669.htm
If you search on the forums you should find some examples I believe.
An example was posted in this thread recently:
https://sio2interactive.forumotion.net/sio2-engine-f3/sio2-architecture-and-bullet-physics-integration-t669.htm
Francescu- Posts : 136
Join date : 2009-03-18
Re: How to set a relative parent-child relationship?
First- set the location of child object. Bind matrix.
Second - bind parent-child chierarchy (more than two object chain have strange issues) - bind matrix.
Third - move Your parent - bind matrix.
First transformation will set Your child object position and rotation relative to child. So, if child have to be same as parent just set all to 0.0. I'm using parenting for my emitters (both emitter with sparkles and engine effect, first is set -1 in x, second 1 in x, and third -2 in y etc etc) binded to player.
Sometimes child object disappear - just force his rendering (I think this is problem with calculation child object matrix and actual child matrix, so culling system disables it).
Second - bind parent-child chierarchy (more than two object chain have strange issues) - bind matrix.
Third - move Your parent - bind matrix.
First transformation will set Your child object position and rotation relative to child. So, if child have to be same as parent just set all to 0.0. I'm using parenting for my emitters (both emitter with sparkles and engine effect, first is set -1 in x, second 1 in x, and third -2 in y etc etc) binded to player.
Sometimes child object disappear - just force his rendering (I think this is problem with calculation child object matrix and actual child matrix, so culling system disables it).
_-MADMAN-_- Posts : 52
Join date : 2009-04-23
Update
Followed Francescu's advice:
Some variant of the Bullet 6DOF hinge constraint seems to be the way to go.
I am new to Bullet . . . so I am still figuring things out . . . when I have something working I will post my findings.
Thanks everyone for your help.
Some variant of the Bullet 6DOF hinge constraint seems to be the way to go.
I am new to Bullet . . . so I am still figuring things out . . . when I have something working I will post my findings.
Thanks everyone for your help.
sgreenwalt- Posts : 18
Join date : 2009-04-24
Location : Layton, Utah
Re: How to set a relative parent-child relationship?
Have You tested your app with constraints on device? Maybe I'm doing something wrong, but with simple two joint constraint I had about 10fps - without it about 25, so bullet and real physic are really expensive for iphone. If You have better performance - just give me a sign
_-MADMAN-_- Posts : 52
Join date : 2009-04-23
Re: How to set a relative parent-child relationship?
That interesting - are you meshes convexhull ones? Just asking as when I tried with simple meshes from tutorial06 I did not see drop in FPS at all...I have not tried with the monkey though ;-)_-MADMAN-_ wrote:Have You tested your app with constraints on device? Maybe I'm doing something wrong, but with simple two joint constraint I had about 10fps - without it about 25, so bullet and real physic are really expensive for iphone. If You have better performance - just give me a sign
Francescu- Posts : 136
Join date : 2009-03-18
Re: How to set a relative parent-child relationship?
Actually I'm using only rigid body spheres. Never tried convex or triangle mesh as physic object in sio2.
Oh, but important thing - constraint was with six limiters and hinge values for each of them. FPS drop stared of course after adding limits etc. In fact I can't find the reason for using real physic for simply behaviors, I have played with physic only in case of my player and vehicles.
Other fact is that actually I have objects controlled by about 10 forces, it is duplicated five times and forces aren't the same, which gives us about 50 forces at same time - so any next "physic things" in my app make it sloooooowwwww
But maybe I'm doing something wrong
Regards,
Mad
Oh, but important thing - constraint was with six limiters and hinge values for each of them. FPS drop stared of course after adding limits etc. In fact I can't find the reason for using real physic for simply behaviors, I have played with physic only in case of my player and vehicles.
Other fact is that actually I have objects controlled by about 10 forces, it is duplicated five times and forces aren't the same, which gives us about 50 forces at same time - so any next "physic things" in my app make it sloooooowwwww
But maybe I'm doing something wrong
Regards,
Mad
_-MADMAN-_- Posts : 52
Join date : 2009-04-23
Re: How to set a relative parent-child relationship?
Yes I bet - that's a lot of forces.
Are you using a separate thread for the physics?
Are you using a separate thread for the physics?
Francescu- Posts : 136
Join date : 2009-03-18
Re: How to set a relative parent-child relationship?
Unfortunately not - I left that for last part of my work. I'm not sure how to make properly work thread - I divided app to four threads - one for physic, one for stats and time calculation, next for rendering and the last for other game variables. And only one thread crushes app - physic thread... no idea why. In tut we can read, that render physic call have to be before rendering process, but thread crushed no matter where rendering was.
_-MADMAN-_- Posts : 52
Join date : 2009-04-23
Re: How to set a relative parent-child relationship?
Did you check where time was spent the most with Shark? You could also use the activity / CPU sampler instrument tool...It's very likely bullet but it would be interesting to see where it is happening since you don't have convexhull meshes..._-MADMAN-_ wrote:Unfortunately not - I left that for last part of my work. I'm not sure how to make properly work thread - I divided app to four threads - one for physic, one for stats and time calculation, next for rendering and the last for other game variables. And only one thread crushes app - physic thread... no idea why. In tut we can read, that render physic call have to be before rendering process, but thread crushed no matter where rendering was.
Francescu- Posts : 136
Join date : 2009-03-18
Permissions in this forum:
You cannot reply to topics in this forum