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

Author Topic: Adjustment in Transform/Transformable  (Read 1703 times)

0 Members and 1 Guest are viewing this topic.

Grimshaw

  • Hero Member
  • *****
  • Posts: 631
  • Nephilim SDK
    • View Profile
Adjustment in Transform/Transformable
« on: March 02, 2012, 03:22:06 am »
Heys,

I am finding Transform and Transformable classes a little confusing because Transform is exactly what i want, but I can't retrieve the position, etc from it.

Also, when I saw Transformable, it looked even more like what I need, but it doesn't let me rotate relatively to an arbitrary point like Transform does. (or does it?)

Imagine a scene graph, with every node position being relative to the parent.
I want to be able to rotate a node around itself by default, but also around its parent, in order to obtain a "gravitation" effect , where the child rotates around the parent in a fixed distance.

Can someone please clarify me on this?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Adjustment in Transform/Transformable
« Reply #1 on: March 02, 2012, 08:05:52 am »
Quote
Also, when I saw Transformable, it looked even more like what I need, but it doesn't let me rotate relatively to an arbitrary point like Transform does. (or does it?)

You can change the Origin property, but it will impact the other transformations (position and scale) as well.

Quote
I am finding Transform and Transformable classes a little confusing because Transform is exactly what i want, but I can't retrieve the position, etc from it.

You can't retrieve the position/rotation/scale/origin from an arbitrary transform. You can get the position, almost get one rotation/scale which may or not match the initial one, but the origin would be lost.
And if you created a custom transform (by using the constructor which takes the 9 elements of the matrix) you would hardly be able to get any position/rotation/scale component.

The solution depends on what you really need, but SFML can't provide a generic way of combining arbitrary transforms and then retrieving their components.
Laurent Gomila - SFML developer

 

anything