May 02, 2024, 02:05:36 PM

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


Child object delima.

Started by J B Wood (Zumwalt), August 06, 2006, 01:35:13 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

J B Wood (Zumwalt)

I have been working with Kryton9 on this issue now for like 3 or 4 days.
Here is what the problem is, I have a machine gun on the tank, its offset from the center of he turret.
The machine gun is seperate from the tank and the turret, but is a child of the turret.
When rotating it, it rotates at the center of the turret.
I tried adding yet another child to the turret and make the gun a child of that child and same result, it rotates at center of turret, not center of the machine gun axis.

In the designer engine, the gun housing is 0,0,0 on the grid, so what i am having a problem with, is the gun needs to be a child of the turret but have its own center of rotation.

Lets say the tank center is absolute 0,0,0, then the turret on the tank is centered on the tank, so far so good, its center matches the tanks center, now, we add a barrel to the turret, so it takes the turrets center of 0,0,0, excelent so far, now I add an offset object like the machine gun, it has a different center, and is positioned on load at the right location, but when rotated uses the turret center that it is a child of, not so good.

How do we offset the center of rotation?

Ionic Wind Support Team

Use a transform object like I did with the planet demo.  A transform object (other languages call it a pivot) lets you position a child of the transform and rotate it away from main object.
Ionic Wind Support Team

kryton9

Man, I even played with that program and made a mod for it. My memory is terrible, that is why i need to keep notes or have help so I can look up stuff all the time to refresh my memory.

Here is the link for that thread - Reply 7
http://www.ionicwind.com/forums/index.php?topic=760.0

J B Wood (Zumwalt)

I have updated the project, I tried to use trans like you stated, exact same results on the spin.
3 and 4 keys rotate the machine gun.
I just don't get it.

Ionic Wind Support Team

Don't have time to look at it at the moment.  Are you sure the machine gun needs to be a child of the turret?  Anything that is a child will rotate with it's parent.  The transfrom object lets you position a child away from it's parent so it spins in an orbit around the parent, when the parent is spinning.  And you can set it's own rotation individually.
Ionic Wind Support Team

J B Wood (Zumwalt)

Yes, because when the turret that the machine gun spins on, I need the machine gun to keep its center where it is mounted.
So inessance, the machine gun needs to be a child of the turret so that it keeps attached to the turret.
Maybe I am loosing this in translation, or maybe I don't know exactly what I need.

Probably both.
If I use transform without making it a child, it then is above the 0,0,0 world coordinates, but I need it on the turret, if that makes any sense.

Ionic Wind Support Team

Should work if you just make it a child of the turret, set it's position on the turret (in local coordinates) and rotate the machine gun object itself.
Ionic Wind Support Team