Jump to content

Parent an entity to two parents


Laurens
 Share

Recommended Posts

Hi,

 

Is it possible to have two seperate entities and parent a third entity to both of these entities? Like so:

 

Parent       Parent
  |           |
   -- Child --

 

Thanks!

 

 

Can I ask what you would be applying this in?

simpleSigPNG.png

 

Programmer/Engineer/Student

www.reikumar.com

 

2.6 GHz Intel Core Duo - nVidia GeForce 8600 GT - Windows 7 64-bit - 4 Gigs RAM

C++ - Visual Studio Express - Dark GDK - Leadwerks SDK

Link to comment
Share on other sites

Was afraid so.

 

Basically I have two independent towers that are connected by a beam (plane with a texture). Now, if either one of the towers is destroyed, so should the beam. I was planning on parenting the beam to both towers and then when either tower is destroyed, FreeEntity would also free the beam.

 

Anyway, guess I'll have to find some other way then ;)

 

Thanks everyone!

Link to comment
Share on other sites

I have not yet seen this command but if the index parameter means I can store multiple targets than this would indeed solve my problem. I would simply set the target for the beam to both towers and check for NULL through GetEntityTarget each update call. That would be awesome :)

 

Will try it out as soon as I get home.

 

Thanks!

Link to comment
Share on other sites

You could make this Beam an object and have a pointer to it in each tower. Then when you create a Beam object assign it the to towers that make the connection. Then when your Tower object is destroyed check if the Beam object it has is null and if not destroy it also.

Link to comment
Share on other sites

Hi all,

 

I finally went with SetEntityTarget. The constructor of Beam sets the target to both Towers that are passed via parameters. Then, in the Update() method I check GetEntityTarget for NULL. If either is NULL, the Beam frees itself.

 

Thanks for the help all!

 

Cheers!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...