Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: set parent...  (Read 1398 times)

0 Members and 1 Guest are viewing this topic.

digimikeh

  • Newbie
  • *
  • Posts: 18
    • View Profile
    • Email
set parent...
« on: July 16, 2020, 05:49:33 pm »
Hi
Im wondering if there is a built in set parent function ...
If not, then i have a raw solution but i don't know how elegant is it, is setting the position and rotation of the child object using the current rotation and position of the parent in the game loop....

Is that the only way to do it?

Thanks

Hapax

  • Hero Member
  • *****
  • Posts: 3351
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: set parent...
« Reply #1 on: July 20, 2020, 11:00:02 pm »
Hi!
"Linking" child object co-ordinate systems to parent objects would need to be done manually, yes.
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10815
    • View Profile
    • development blog
    • Email
Re: set parent...
« Reply #2 on: July 23, 2020, 08:16:40 am »
When building hierarchies it can be useful to pass around sf::Transform instances, e.g. to the draw function. That way relative movements can be done without much effort.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

 

anything